From 01b62b7c4c7f02183d755d093e31b7932d16363c Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Sat, 31 Jan 2026 18:51:39 +0800 Subject: [PATCH] feat: replace TCP template with full client config and template variables --- internal/xrayconfig/template_tcp.json | 102 ++++++++++++-------------- 1 file changed, 47 insertions(+), 55 deletions(-) diff --git a/internal/xrayconfig/template_tcp.json b/internal/xrayconfig/template_tcp.json index 881110d..4ce753c 100644 --- a/internal/xrayconfig/template_tcp.json +++ b/internal/xrayconfig/template_tcp.json @@ -1,59 +1,31 @@ { "log": { - "loglevel": "warning" + "loglevel": "info" }, "routing": { "domainStrategy": "IPIfNonMatch", - "rules": [ - { - "type": "field", - "ip": [ - "geoip:cn" - ], - "outboundTag": "block" - } - ] + "rules": [] }, "inbounds": [ { - "listen": "0.0.0.0", - "port": 1443, - "protocol": "vless", + "listen": "127.0.0.1", + "port": 1080, + "protocol": "socks", "settings": { - "clients": [ - { - "id": "{{ UUID }}", - "flow": "xtls-rprx-vision" - } - ], - "decryption": "none", - "fallbacks": [ - { - "dest": "8001", - "xver": 1 - }, - { - "alpn": "h2", - "dest": "8002", - "xver": 1 - } + "udp": true + }, + "sniffing": { + "enabled": true, + "destOverride": [ + "http", + "tls" ] - }, - "streamSettings": { - "network": "tcp", - "security": "tls", - "tlsSettings": { - "rejectUnknownSni": true, - "minVersion": "1.2", - "certificates": [ - { - "ocspStapling": 3600, - "certificateFile": "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/{{.Domain}}/{{.Domain}}.crt", - "keyFile": "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/{{.Domain}}/{{.Domain}}.key" - } - ] - } - }, + } + }, + { + "listen": "127.0.0.1", + "port": 10801, + "protocol": "http", "sniffing": { "enabled": true, "destOverride": [ @@ -64,6 +36,34 @@ } ], "outbounds": [ + { + "protocol": "vless", + "settings": { + "vnext": [ + { + "address": "{{.Domain}}", + "port": 1443, + "users": [ + { + "id": "{{ UUID }}", + "encryption": "none", + "flow": "xtls-rprx-vision" + } + ] + } + ] + }, + "streamSettings": { + "network": "tcp", + "security": "tls", + "tlsSettings": { + "serverName": "{{.Domain}}", + "allowInsecure": false, + "fingerprint": "chrome" + } + }, + "tag": "proxy" + }, { "protocol": "freedom", "tag": "direct" @@ -72,13 +72,5 @@ "protocol": "blackhole", "tag": "block" } - ], - "policy": { - "levels": { - "0": { - "handshake": 2, - "connIdle": 120 - } - } - } + ] } \ No newline at end of file