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

使用netch代理ssh进程到tuic,不进行ssh交互后连接在若干秒后断开。 #18

Closed
kckm opened this issue Apr 2, 2022 · 5 comments

Comments

@kckm
Copy link

kckm commented Apr 2, 2022

以下是客户端log,服务端也没什么有用的信息,需要的话我再抓吧。
.\tuic-client-0.2.3-x86_64-windows-msvc.exe -s hostname -p 3866 -t token -l 1080 --server-ip 1.2.3.4 --congestion-controller bbr --reduce-rtt --log-level debug
[2022-04-02T01:16:28Z INFO ] [relay] started. Target server: 1.2.3.4
[2022-04-02T01:16:28Z INFO ] [socks5] started. Listening: 127.0.0.1:1080
[2022-04-02T01:16:28Z DEBUG] [relay] [connection] [establish]
[2022-04-02T01:16:28Z DEBUG] [relay] [connection] [authentication]
[2022-04-02T01:16:31Z DEBUG] [socks5] [127.0.0.1:54580] [establish]
[2022-04-02T01:16:31Z DEBUG] [socks5] [127.0.0.1:54580] [handshake]
[2022-04-02T01:16:31Z INFO ] [socks5] [127.0.0.1:54580] [connect] [1.2.3.4]
[2022-04-02T01:16:31Z INFO ] [relay] [task] [connect] [1.2.3.4:22]
[2022-04-02T01:16:46Z DEBUG] [socks5] [127.0.0.1:54580] [disconnect]

@kckm kckm changed the title 使用netch代理ssh进程到tuic,连接在若干秒后断开。 使用netch代理ssh进程到tuic,不进行ssh连接在若干秒后断开。 Apr 2, 2022
@kckm kckm changed the title 使用netch代理ssh进程到tuic,不进行ssh连接在若干秒后断开。 使用netch代理ssh进程到tuic,不进行ssh交互后连接在若干秒后断开。 Apr 2, 2022
@EAimTY
Copy link
Collaborator

EAimTY commented Apr 2, 2022

从 ssh 连接建立到自动断开经过 15 秒,而默认的 QUIC 连接 max idle time 刚好也是 15 秒。ssh 没有原生的心跳机制,tuic 中转的 TCP 在没有传输数据时就没有 QUIC 的 UDP 包,所以不进行 ssh 交互时 QUIC 会认为这个连接是 idle 的。

我在设计 tuic 协议时没有考虑到这一点,之后会给 tuic 协议加上心跳机制。目前临时的解决方法是不要让 tuic 只中继 ssh,要在同时中继其它有持续数据传输的任务。

@kckm
Copy link
Author

kckm commented Apr 2, 2022

从 ssh 连接建立到自动断开经过 15 秒,而默认的 QUIC 连接 max idle time 刚好也是 15 秒。ssh 没有原生的心跳机制,tuic 中转的 TCP 在没有传输数据时就没有 QUIC 的 UDP 包,所以不进行 ssh 交互时 QUIC 会认为这个连接是 idle 的。

我在设计 tuic 协议时没有考虑到这一点,之后会给 tuic 协议加上心跳机制。目前临时的解决方法是不要让 tuic 只中继 ssh,要在同时中继其它有持续数据传输的任务。

还有个疑问,tuic没有mtu设置选项,请问tuic的mtu是自动探测吗?如果代理应用发了个大于mtu的udp包,又会怎样处理呢?

@EAimTY
Copy link
Collaborator

EAimTY commented Apr 2, 2022

--max-udp-packet-size 参数可以限制服务器/客户端收发的最大包,可以设置到小于等于 mtu,超出部分会被截断

@kckm
Copy link
Author

kckm commented Apr 2, 2022

--max-udp-packet-size 参数可以限制服务器/客户端收发的最大包,可以设置到小于等于 mtu,超出部分会被截断

了解,mtu抓包看了下应该是固定1228,比较保守的值。

@EAimTY
Copy link
Collaborator

EAimTY commented Apr 6, 2022

心跳机制已经在 0.3.0 版本完成了

@EAimTY EAimTY closed this as completed Apr 6, 2022
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

2 participants