Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]websocket连接cloudflare cdn失败 #271

Closed
1 task done
hak0 opened this issue Feb 28, 2021 · 4 comments
Closed
1 task done

[BUG]websocket连接cloudflare cdn失败 #271

hak0 opened this issue Feb 28, 2021 · 4 comments

Comments

@hak0
Copy link

hak0 commented Feb 28, 2021

  • 我确定我已经尝试多次复现此次问题,并且将会提供涉及此问题的系统和网络环境,软件及其版本。

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

简单描述这个 Bug

在x86_64平台的archlinux上使用aur的trojan-go时,连接cloudflare cdn失败。提示错误:

[ERROR] 2021/02/27 09:46:55 github.com/p4gefau1t/trojan-go/proxy.(*Proxy).relayConnLoop.func1.1:proxy.go:66 proxy failed to dial connection | websocket failed to handshake with server | malformed HTTP response "\x00\x00\x12\x04\x00\x00\x00\x00\x00\x00\x03\x00\x00\x01\x00\x00\x04\x00\x01\x00\x00\x00\x05\x00\xff\xff\xff\x00\x00\x04\b\x00\x00\x00\x00\x00\u007f\xff\x00\x00\x00\x00\b\a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"

如何复现这个 Bug

使用trojan-go连接cloudflare cdn ws

服务器和客户端环境信息

在此描述你的服务器和客户端所处的网络环境,系统架构,以及其他信息

中国电信百兆宽带,x86_64

服务端和客户端日志

服务端

[INFO]  2021/02/28 11:12:33 tcp connection from ip:22466
[INFO]  2021/02/28 11:12:33 tcp connection from ip:22472
[INFO]  2021/02/28 11:12:33 tls connection from ip:22466
[INFO]  2021/02/28 11:12:33 tls connection from ip:22472
[INFO]  2021/02/28 11:12:34 user f897dd6c19a1d212b4671e3bb0a65d8c1e98e7f7fbb58c30dee2e713 from ip:22466 tunneling to 91.108.56.141:443 closed sent: 93 B recv: 105 B
[INFO]  2021/02/28 11:12:34 user f897dd6c19a1d212b4671e3bb0a65d8c1e98e7f7fbb58c30dee2e713 from ip:22472 tunneling to 91.108.56.141:443 closed sent: 93 B recv: 105 B

客户端

2月 27 09:46:55 manjaro-hako-xps trojan-go[451]: [DEBUG] 2021/02/27 09:46:55 github.com/p4gefau1t/trojan-go/tunnel/adapter.(*Server).acceptConnLoop:server.go:49 socks5 connection
2月 27 09:46:55 manjaro-hako-xps trojan-go[451]: [INFO]  2021/02/27 09:46:55 socks connection from 127.0.0.1:40300 metadata ocsp.pki.goog:80
2月 27 09:46:55 manjaro-hako-xps trojan-go[451]: [ERROR] 2021/02/27 09:46:55 github.com/p4gefau1t/trojan-go/proxy.(*Proxy).relayConnLoop.func1.1:proxy.go:66 proxy failed to dial connection | websocket failed to handshake with server | malformed HTTP response "\x00\x00\x12\x04\x00\x00\x00\x00\x00\x00\x03\x00\x00\x01\x00\x00\x04\x00\x01\x00\x00\x00\x05\x00\xff\xff\xff\x00\x00\x04\b\x00\x00\x00\x00\x00\u007f\xff\x00\x00\x00\x00\b\a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"

服务端和客户端配置文件

服务端

run-type: server
local-addr: 0.0.0.0
local-port: 443
remote-addr: 127.0.0.1
remote-port: 80
password:
  - foo
ssl:
  cert: /root/trojan/cloudflare/foo.tk.pem
  key: /root/trojan/cloudflare/foo.tk.key
  sni: foo.tk
websocket:
  enabled: true
  path: /foo

客户端

{
   "run_type": "client",
   "local_addr": "::0",
   "local_port": 1089,
   "remote_addr": "foo.tk",
   "remote_port": 443,
   "password": [
      "foo"
   ],
   "log_level": 0,
   "ssl": {
      "sni": "foo.tki",
      "fingerprint": "firefox"
   },
   "websocket": {
      "enabled": true,
      "path": "/foo",
      "host": "foo.tk"
   }
}

服务端和客户端版本信息

请执行./trojan-go -version并将输出完整粘贴在此处

服务端

Trojan-Go v0.8.2
Go Version: go1.15.1
OS/Arch: linux/amd64
Git Commit: d051cf4c8852d708769ca1c4e514306a88da830b

客户端

Trojan-Go v0.8.2
Go Version: go1.15.1
OS/Arch: linux/amd64
Git Commit: d051cf4c8852d708769ca1c4e514306a88da830b

其他信息

你认为对我们修复bug有帮助的任何信息都可以在这里写出来

@DdVwl6Fj3a
Copy link

image
可能是这个问题,原先websocket指定http/1.1,现在这部分代码删了,可能协商成h2,你自己服务端改下代码,指定http/1.1,编译看看能不能解决

@qiuzi
Copy link

qiuzi commented Feb 28, 2021

fingerprint留空 新版firefox可能使用了h2

@hak0
Copy link
Author

hak0 commented Feb 28, 2021

感谢,删除配置文件fingerprint后连接正常

@hak0 hak0 closed this as completed Feb 28, 2021
@CXwudi
Copy link

CXwudi commented Oct 3, 2022

fingerprint改成chrome也出现相同问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants