Skip to content

inbounds & outbounds: TCP KeepAlive better default value#4927

Closed
xqzr wants to merge 5 commits intoXTLS:mainfrom
xqzr:patch-3
Closed

inbounds & outbounds: TCP KeepAlive better default value#4927
xqzr wants to merge 5 commits intoXTLS:mainfrom
xqzr:patch-3

Conversation

@xqzr
Copy link
Contributor

@xqzr xqzr commented Jul 24, 2025

ISP NAT 会话老化时间,一般是 5 分钟(或者不少于);Xray 空闲连接超时(老化)时间 connIdle ,也是 5 分钟。
因此,我认为:开启 TCP KeepAlive 后,golang 默认每隔 15 秒,发送一次“TCP KeepAlive 探针”是不必要的。应该尽可能保持无线电静默。

https://t.me/projectXray/4134023?thread=4133903
https://t.me/projectXray/4375781?thread=4375765

@Fangliding
Copy link
Member

按照惯例客户端模仿chrome的话 keepalive time 应该是 45秒
而服务端对标nginx的话应该是全部使用系统设置

@Fangliding Fangliding changed the title inbounds & outbounds: TCP KeepAlive off By default inbounds & outbounds: TCP KeepAlive better default value Jul 24, 2025
@xqzr
Copy link
Contributor Author

xqzr commented Jul 25, 2025

nginx的话应该是全部使用系统设置

不。Nginx listen 部分(服务端)默认不启用 TCP KeepAlive。
如果,配置启用,但不配置间隔(时间),的确使用系统默认值

@Fangliding
Copy link
Member

@xqzr
Copy link
Contributor Author

xqzr commented Jul 25, 2025

不填的话遵照系统设置?

指的是不填参数,即是:[keepidle]:[keepintvl]:[keepcnt]

@xqzr
Copy link
Contributor Author

xqzr commented Jul 25, 2025

对于 TCP KeepAlive 开关(on/off),操作系统会遵循 RFC 1122必须默认关闭

@Fangliding
Copy link
Member

等会和sockopt里的数值交互还有点麻烦 我close了重写一下吧

@Fangliding Fangliding closed this Jul 25, 2025
@xqzr xqzr deleted the patch-3 branch July 25, 2025 07:09
maoxikun pushed a commit to maoxikun/Xray-core that referenced this pull request Aug 23, 2025
it2konst pushed a commit to it2konst/gametunnel-core that referenced this pull request Mar 1, 2026
drovosek229 pushed a commit to drovosek229/Xray-core that referenced this pull request Mar 16, 2026
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

Successfully merging this pull request may close these issues.

2 participants