Sockopt: Update KeepAlive

pull/728/head
风扇滑翔翼 2025-07-25 20:22:32 +08:00 committed by GitHub
parent 5e8104f666
commit 2490f3887a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 17 deletions

View File

@ -702,29 +702,17 @@ OCSP 装订更新间隔,单位为秒,默认值为 0. 任意非 0 值将启
填写 `true` 时,最底层 TCP 连接建立后,请求方必须先发送 PROXY protocol v1 或 v2否则连接会被关闭。
> `tcpKeepAliveInterval`: number
TCP 保持活跃的数据包发送间隔,单位为秒。~~该设置仅适用于 Linux 下。~~
它是连接不正常(未收到 ack时候的心跳包。
不配置此项或配置为 0 表示使用 Go 默认值。
::: tip
填负数时,如 `-1`,不启用 TCP 保持活跃。
:::
> `tcpKeepAliveIdle`: number
TCP 空闲时间阈值,单位为秒。当 TCP 连接空闲时间达到这个阈值时,将开始发送 Keep-Alive 探测包。
它是连接正常时候的心跳包
对于出站, xray 使用 Chrome 的默认值 idle 与 interval 均为 45s, 该选项与 `tcpKeepAliveInterval` 任意一个设置为负数将禁用该默认 keepalive, 正数则会覆盖该默认值。
不配置此项或配置为 0 表示使用 Go 默认值
对于入站, Keep-Alive 默认禁用,该选项与 `tcpKeepAliveInterval` 任意一个非零时启用,如果只设置二者之一那么另一个将跟随操作系统设置。
::: tip
填负数时,如 `-1`,不启用 TCP 保持活跃。
:::
> `tcpKeepAliveInterval`: number
TCP 进入 Keep-Alive 状态后发送 Keep-Alive 数据包间的时间间隔,单位为秒。其他行为见上。
> `tcpUserTimeout`: number