e1732a364fed / v2ray_simple

a verysimple proxy
MIT License
528 stars 104 forks source link

[Bug] lazy = true 時,fallback 無回應 #158

Closed kousyougi closed 1 year ago

kousyougi commented 2 years ago

Describe the bug【描述 bug】 設定 lazy = true 時,fallback 無回應。 取消 lazy = true 時,fallback 正常。

To Reproduce【如何复现该bug】 lazy = true 檢查 fallback 網站連線

Expected behavior【预期的行为】 正常連結到fallback網站

Envs (please complete the following information):【系统环境】 Linux x64 Config file 【配置文件,客户端服务端配置都提供】

[[listen]] tag = "my_vlesss1" protocol = "vlesss" uuid = "a684455c-b14f-11ea-bf0d-42010aaa0003" host = "0.0.0.0" port = 4433 cert = "/root/.acme.sh/site.cer" key = "/root/.acme.sh/site.key" lazy = true [[dial]] protocol = "direct" [[fallback]] dest = "192.168.0.100:82"

Debug Log 【Debug日志, 客户端 和 服务端 的 日志 都提供】

===============================
verysimple v1.2.4-beta.2, go1.18.2 linux amd64, with advLayer packages: [quic ws grpcSimple]
===============================
A very simple implementation of V2Ray with some innovation
===============================
2022-10-02 20:29:13.755 INFO    Program started
2022-10-02 20:29:13.755 INFO    zap log init complete.  {"logfile": "/etc/verysimple/vs_log_server"}
2022-10-02 20:29:13.755 INFO    Working at      {"dir": "/etc/verysimple"}
Log Level:1
2022-10-02 20:29:13.755 INFO    Options {"Log Level": "info", "UseReadv": true}
2022-10-02 20:29:13.758 INFO    Listening       {"protocol": "tcp+tls+lazy+vless", "listen_addr": "0.0.0.0:4433", "defaultClient": "direct", "dial_addr": ""}
2022-10-02 20:29:17.470 INFO    New Accepted Conn       {"connid": 693404, "from": "123.123.123.123:51805", "handler": "tcp+tls+lazy+vless://0.0.0.0:4433#my_vlesss1"}
2022-10-02 20:29:17.470 INFO    New Accepted Conn       {"connid": 210153, "from": "123.123.123.123:51804", "handler": "tcp+tls+lazy+vless://0.0.0.0:4433#my_vlesss1"}
2022-10-02 20:29:17.608 WARN    handshake inServer failed       {"connid": 210153, "client RemoteAddr": "123.123.123.123:51804"}
2022-10-02 20:29:17.609 WARN    failed in inServer proxy handshake      {"connid": 210153, "handler": "0.0.0.0:4433", "error": " [ invalid version  , Detail: invalid data, Data: 71 ] , with Buffer."}
2022-10-02 20:29:17.609 INFO    Request {"connid": 210153, "from": "123.123.123.123:51804", "target": "tcp://192.168.0.100:82", "through": "direct://"}
2022-10-02 20:29:17.731 WARN    handshake inServer failed       {"connid": 693404, "client RemoteAddr": "123.123.123.123:51805"}
2022-10-02 20:29:17.731 WARN    failed in inServer proxy handshake      {"connid": 693404, "handler": "0.0.0.0:4433", "error": " [ invalid version  , Detail: invalid data, Data: 71 ] , with Buffer."}
2022-10-02 20:29:17.732 INFO    Request {"connid": 693404, "from": "123.123.123.123:51805", "target": "tcp://192.168.0.100:82", "through": "direct://"}
2022-10-02 20:29:17.783 INFO    New Accepted Conn       {"connid": 168782, "from": "123.123.123.123:51806", "handler": "tcp+tls+lazy+vless://0.0.0.0:4433#my_vlesss1"}

下面是刪除lazy = ture的日誌,可以正常連到fallback的網站

===============================
verysimple v1.2.4-beta.2, go1.18.2 linux amd64, with advLayer packages: [quic ws grpcSimple]
===============================
A very simple implementation of V2Ray with some innovation
===============================
2022-10-02 20:40:32.750 INFO    Program started
2022-10-02 20:40:32.750 INFO    zap log init complete.  {"logfile": "/etc/verysimple/vs_log_server"}
2022-10-02 20:40:32.750 INFO    Working at      {"dir": "/etc/verysimple"}
Log Level:1
2022-10-02 20:40:32.750 INFO    Options {"Log Level": "info", "UseReadv": true}
2022-10-02 20:40:32.754 INFO    Listening       {"protocol": "tcp+tls+vless", "listen_addr": "0.0.0.0:4433", "defaultClient": "direct", "dial_addr": ""}
2022-10-02 20:40:37.304 INFO    New Accepted Conn       {"connid": 555230, "from": "123.123.123.123:51821", "handler": "tcp+tls+vless://0.0.0.0:4433#my_vlesss1"}
2022-10-02 20:40:37.304 INFO    New Accepted Conn       {"connid": 600091, "from": "123.123.123.123:51822", "handler": "tcp+tls+vless://0.0.0.0:4433#my_vlesss1"}
2022-10-02 20:40:37.365 WARN    handshake inServer failed       {"connid": 555230, "client RemoteAddr": "123.123.123.123:51821"}
2022-10-02 20:40:37.365 WARN    failed in inServer proxy handshake      {"connid": 555230, "handler": "0.0.0.0:4433", "error": " [ invalid version  , Detail: invalid data, Data: 71 ] , with Buffer."}
2022-10-02 20:40:37.366 INFO    Request {"connid": 555230, "from": "123.123.123.123:51821", "target": "tcp://192.168.0.100:82", "through": "direct://"}
2022-10-02 20:40:41.366 WARN    handshake inServer failed       {"connid": 600091, "client RemoteAddr": "123.123.123.123:51822"}
2022-10-02 20:40:41.366 WARN    failed in inServer proxy handshake      {"connid": 600091, "handler": "0.0.0.0:4433", "error": " [ read err , Detail: read tcp 192.168.0.3:4433->123.123.123.123:51822: i/o timeout, Data: 0 ] "}
kousyougi commented 2 years ago

補充一點,verysimple v1.2.1 版本開啟lazy時,fallback是正常的。

===============================
verysimple v1.2.1, go1.18.1 linux amd64, with advLayer packages: [grpcSimple quic ws]
===============================
A very simple implementation of V2Ray with some innovation
===============================
2022-10-02 21:15:53.731 INFO    Program started
2022-10-02 21:15:53.731 INFO    zap log init complete.  {"logfile": "/etc/verysimple/vs_log_server"}
2022-10-02 21:15:53.731 INFO    Working at      {"dir": "/etc/verysimple"}
Log Level:1
2022-10-02 21:15:53.731 INFO    Options {"Log Level": "info", "UseReadv": true, "tls_lazy_encrypt": true}
2022-10-02 21:15:53.734 INFO    Listening       {"protocol": "tcp+tls+vless", "listen_addr": "0.0.0.0:4433", "defaultClient": "direct", "dial_addr": ""}
2022-10-02 21:16:05.746 INFO    New Accepted Conn       {"from": "123.123.123.123:59116", "handler": "tcp+tls+vless://0.0.0.0:4433"}
2022-10-02 21:16:05.749 INFO    New Accepted Conn       {"from": "123.123.123.123:59117", "handler": "tcp+tls+vless://0.0.0.0:4433"}
2022-10-02 21:16:05.980 WARN    failed in inServer proxy handshake      {"handler": "0.0.0.0:4433", "error": " [ invalid version  , Detail: invalid data, Data: 71 ] , with Buffer."}
2022-10-02 21:16:05.981 INFO    Request {"from": "123.123.123.123:59116", "target": "tcp://192.168.0.100:82", "through": "direct://"}
e1732a364fed commented 1 year ago

收到。

e1732a364fed commented 1 year ago

已经推测出问题的来源。和firstbuffer有关。应该可以解决

e1732a364fed commented 1 year ago

试试最新代码吧,应该好了。