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

[Enhancement] 设置合理的keep alive idle及interval,避免额外的电量消耗 #45

Closed
cubarco opened this issue Nov 9, 2022 · 6 comments

Comments

@cubarco
Copy link

cubarco commented Nov 9, 2022

用surfboard连接vmess服务端,用tcpdump抓包可以看到客户端发起的keep alive的心跳:

15:39:12.949262 eth3  In  IP x.x.x.x.32954 > 192.168.1.158.xxxx: Flags [.], ack 2041, win 282, options [nop,nop,TS val 830384092 ecr 318136215], length 0
15:39:12.949386 eth3  Out IP 192.168.1.158.xxxx > x.x.x.x.32954: Flags [.], ack 2506, win 578, options [nop,nop,TS val 318151319 ecr 830293576], length 0

15:39:28.055572 eth3  In  IP x.x.x.x.32954 > 192.168.1.158.xxxx: Flags [.], ack 2041, win 282, options [nop,nop,TS val 830399196 ecr 318151319], length 0
15:39:28.055734 eth3  Out IP 192.168.1.158.xxxx > x.x.x.x.32954: Flags [.], ack 2506, win 578, options [nop,nop,TS val 318166425 ecr 830293576], length 0

golang默认将keep alive的心跳间隔设置在15s,而在xray-core已经给streamsettings增加了两个字段tcpKeepAliveIdle和tcpKeepAliveInterval,用于手动设置keep alive的心跳参数。

surfboard作为移动端应用,建议参考clash for android的做法禁用keepalive,或者配置xray参数,给tcpKeepAliveIdle和tcpKeepAliveInterval设置较长的时间间隔。

XTLS/Xray-core#1166
v2ray/v2ray-core#2564

@getsurfboard
Copy link
Owner

感谢反馈,将在下个版本跟进

@getsurfboard
Copy link
Owner

会考虑改成,默认禁用,在override中可以修改成开启

@getsurfboard
Copy link
Owner

Will be released in 2.18.4

@cubarco
Copy link
Author

cubarco commented Nov 11, 2022

@getsurfboard
升级2.18.4之后还是有keep-alive心跳。
调试了一下,发现xray有个bug,单独设置"tcpKeepAliveInterval": -1并不会生效,可以改成"tcpKeepAliveIdle": -1来workaround

详见:XTLS/Xray-core#1328

@getsurfboard getsurfboard reopened this Nov 11, 2022
@getsurfboard
Copy link
Owner

感谢反馈

@getsurfboard
Copy link
Owner

Will be released in 2.18.5

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