-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Inbounds & Outbounds: TCP KeepAlive better default value #4931
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
Conversation
Linux 以外的系统,无需更改? |
从不认那两个sockopt参数变成了可以认 至于默认行为的改动是全都一起改动 |
我研究下,@Fangliding 你看看 #4915 (comment) |
尝试了在”出站“使用 |
@Fangliding |
windows也没问题 包括禁用也是正常的 |
那大概过十分钟我先合并这个 PR 吧,有问题的话以后的版本再改 |
我同意。 |
是不是你config写错了 {
"inbounds": [
{
"listen": "127.0.0.1",
"port": 10808,
"protocol": "socks"
}
],
"log": {
"loglevel": "debug"
},
"outbounds": [
{
"protocol": "freedom",
"streamSettings": {
"sockopt": {
"tcpKeepAliveIdle": 15,
"tcpKeepAliveInterval": 15
}
}
}
]
} |
应该是,我只配置 |
@Fangliding 你要改还是 |
要是两个数值不一样操作系统似乎会自行根据一些逻辑对这两个值进行修改 跟xray没有关系 比如 Windows上 tcpKeepAliveIdle = 15 的话 里面默认的 interval 的45也会被盖成15 这是操作系统行为 跟xray没关系 |
|
只设置"tcpKeepAliveIdle": 15 |
@Fangliding |
这也没得改( |
|
from #4927
重写了一下 tcp keepalive 的逻辑 删除了 sockopt_linux 里的操作 移到了 listener/dialer 中 这样可以跨平台
现在的逻辑
客户端 打开 TCP 连接使用和 Chrome 相同的 idle 和 interval (45秒) sockopt中两个数字任一为负则禁用 为正则覆盖默认值
服务端 监听默认不启用 任一大于 0 的 idle 或 interval 启用keepalive 并把相关数字设置成对应值 如果没设置 则为系统默认(而不是golang默认)
由于两个参数任一大于0启用和任一小于0禁用 一个正一个负会逻辑错误 如果发生这样的事直接返回错误