genshen / wssocks

socks5 over websocket
MIT License
152 stars 28 forks source link

客户端命令遇错 #28

Closed luckypoem closed 3 years ago

luckypoem commented 4 years ago

hi.

yudeMacBook-Air:~ brite$ ./wssocks-darwin-amd64 client -addr 127.0.0.1:1082 --remote wss://mydomain.com --key 316C5EBF1C04CC21B5019CC0 INFO[0000] http(s) proxy is disabled.
INFO[0000] connecting to wssocks server. remote="wss://mydomain.com"

FATA[0002] establishing connection error:failed to WebSocket dial: expected handshake response status code 101 but got 400 yudeMacBook-Air:~ brite$

怎么解决?

genshen commented 4 years ago

我看你的服务端用的是wss (启用的tsl/ssl), 请你服务端是用来nginx 之类的做了反向代理吗? 从现在的信息还看不出来具体是哪里的问题,方便附上服务端的命令行启动参数以及服务端的相关日志吗?

Tip: 对于目前的 v0.5.0-beta.2 版本,tsl/ssl 可以通过ngxin 配置(https://github.com/genshen/wssocks/issues/11#issuecomment-669324542) 或者 在服务端通过--tls, --tls-cert-file-tls-key-file参数配置。

luckypoem commented 3 years ago

哦,原来是本地命令中的“-addr 127.0.0.1:1082”写错了,应该是--addr 127.0.0.1:1082 ,我是在服务器上使用nginx做了反向代理。

luckypoem commented 3 years ago

但是翻墙不到2分钟,客户端就断开连接了:

yudeMacBook-Air:~ brite$ ./wssocks-darwin-amd64 client --addr 127.0.0.1:1082 --remote wss://mydomain.com --key 316C5EBF1C04CC21B5019C78 INFO[0000] http(s) proxy is disabled.
INFO[0000] connecting to wssocks server. remote="wss://mydomain.com"

INFO[0010] connected to wssocks server. remote="wss://mydomain.com" INFO[0010] server version compatible version code=3 version code=4 version number=0.5.0-beta.2 INFO[0010] listening on local address for incoming proxy requests. socks5 listen address="127.0.0.1:1082" ERRO[0035] write error:read tcp 127.0.0.1:1082->127.0.0.1:62894: use of closed network connection ERRO[0042] error websocket read:failed to get reader: received close frame: status = StatusMessageTooBig and reason = "read limited at 32769 bytes" ERRO[0042] accept tcp 127.0.0.1:1082: use of closed network connection TARGETs CONNECTIONs
play.google.com:443 1
www.blogger.com:443 1
apis.google.com:443 1
static.doubleclick.net:443 1
camo.githubusercontent.com:443 4
clients4.google.com:443 1
2.bp.blogspot.com:443 1
raw.githubusercontent.com:443 6
fonts.gstatic.com:443 1
alive.github.com:443 1
i.ytimg.com:443 1
lh3.googleusercontent.com:443 1
www.youtube.com:443 1
googleads.g.doubleclick.net:443 1
www.google.com:443 2
github.com:443 5
www.gstatic.com:443 1
TOTAL 31
yudeMacBook-Air:~ brite$

如何解决?

luckypoem commented 3 years ago

服务器端是仍然在运行,就是客户端搞了2分钟,就退出运行了

genshen commented 3 years ago

ERRO[0042] error websocket read:failed to get reader: received close frame: status = StatusMessageTooBig and reason = "read limited at 32769 bytes"

这个问题是 v0.5.0-beta.2 版本的一个 bug 导致的 (bug 同样也存在于v0.5.0-beta.1 版本),建议更新到最新 release 的 v0.5.0-beta.3 版本。


This problem has been known as a bug of v0.5.0-beta.1 and v0.5.0-beta.2. You can resolve it by upgrading wssocks to latest version (v0.5.0-beta.3).

luckypoem commented 3 years ago

不错,现在OK了