p4gefau1t / trojan-go

Go实现的Trojan代理,支持多路复用/路由功能/CDN中转/Shadowsocks混淆插件,多平台,无依赖。A Trojan proxy written in Go. An unidentifiable mechanism that helps you bypass GFW. https://p4gefau1t.github.io/trojan-go/
GNU General Public License v3.0
7.71k stars 1.67k forks source link

[BUG] 在套用CF CDN情况下 connection closed by peer #472

Open Larkelmes opened 1 year ago

Larkelmes commented 1 year ago

我们建议您按照下方模板填写 Bug Report,以便我们收集更多的有效信息

新换了一个服务器,用的腾讯云,环境ubuntu20.04,nginx,trojan-go0.5.1。之前使用亿速云服务器无问题,更换服务器之后出现无法连接。CDN代理已开启,网站主页可正常打开。

以下是trojan-go配置文件: { "run_type": "server", "local_addr": "0.0.0.0", "local_port": 10241, "remote_addr": "127.0.0.1", "remote_port": 8000, "log_level": 1, "log_file": "/usr/local/trojan-go/test.log", "password": [ "PWD" ], "buffer_size": 32, "dns": [], "ssl": { "verify": true, "verify_hostname": true, "cert": "/etc/letsencrypt/live/domain/fullchain.pem", "key": "/etc/letsencrypt/live/domain/privkey.pem", "key_password": "", "cipher": "", "cipher_tls13": "", "curves": "", "prefer_server_cipher": false, "sni": "domain.com", "alpn": [ "http/1.1" ], "session_ticket": true, "reuse_session": true, "plain_http_response": "", "fallback_port": 1234, "fingerprint": "firefox", "serve_plain_text": false }, "tcp": { "no_delay": true, "keep_alive": true, "reuse_port": false, "prefer_ipv4": false, "fast_open": false, "fast_open_qlen": 20 }, "mux": { "enabled": true, "concurrency": 8, "idle_timeout": 60 }, "router": { "enabled": false, "bypass": [], "proxy": [], "block": [], "default_policy": "proxy", "domain_strategy": "as_is", "geoip": "/usr/local/trojan-go/geoip.dat", "geosite": "/usr/local/trojan-go/geosite.dat" }, "websocket": { "enabled": true, "path": "/williamshakespearejodancomwekuin", "hostname": "domain.com", "obfuscation_password": "/*-+@@", "double_tls": true, "ssl": { "verify": true, "verify_hostname": true, "cert": "/etc/letsencrypt/live/domain/fullchain.pem", "key": "/etc/letsencrypt/live/domain/privkey.pem", "key_password": "", "prefer_server_cipher": false, "sni": "domain.com", "session_ticket": true, "reuse_session": true, "plain_http_response": "" } } }

如何复现这个 Bug

安卓ignter-go,点击右上方测试后出现connection closed by peer

服务端和客户端日志

[INFO] 2022/11/15 23:44:45 Websocket enabled [INFO] 2022/11/15 23:44:45 Websocket obfuscation enabled [INFO] 2022/11/15 23:44:46 Trojan-Go server is listening on 0.0.0.0:10241 [INFO] 2022/11/15 23:44:53 Conn accepted from 127.0.0.1:40118 [ERROR] 2022/11/15 23:44:53 github.com/p4gefau1t/trojan-go/protocol/trojan.NewInboundWebsocket:websocket.go:318 Failed to obtain websocket scapegoat | bad status [ERROR] 2022/11/15 23:44:53 github.com/p4gefau1t/trojan-go/proxy/server.(*Server).handleConn:server.go:76 Failed to start inbound session, remote:127.0.0.1:40118 | Invalid websocket request | Invalid double TLS handshake from 127.0.0.1:40118 | tls: first record does not look like a TLS handshake

abc2001x commented 1 year ago

我也出现这个, 检查配置也没查出什么问题

abc2001x commented 1 year ago

你是用一键安装的脚本吗

Larkelmes commented 1 year ago

你是用一键安装的脚本吗

后来我发现问题出在了混淆密码那里。我是这样解决的。按照官方推荐的配置方案,把WS中混淆密码删掉了,在SS中启用了密码。在这种条件下igniter-go和QV2ray都连接成功了

Larkelmes commented 1 year ago

你是用一键安装的脚本吗

后来我发现问题出在了混淆密码那里。我是这样解决的。按照官方推荐的配置方案,把WS中混淆密码删掉了,在SS中启用了密码。在这种条件下igniter-go和QV2ray都连接成功了

我用的不是一键安装