Correct policy timeout defaults (#886)

This commit is contained in:
Artem
2026-08-25 00:52:09 +08:00
committed by Fangliding
parent 901005cfbb
commit 090e425873
3 changed files with 32 additions and 28 deletions
+10 -10
View File
@@ -11,10 +11,10 @@
"policy": {
"levels": {
"0": {
"handshake": 4,
"handshake": 60,
"connIdle": 300,
"uplinkOnly": 2,
"downlinkOnly": 5,
"uplinkOnly": 1,
"downlinkOnly": 1,
"statsUserUplink": false,
"statsUserDownlink": false,
"statsUserOnline": false,
@@ -47,10 +47,10 @@ Xray 系统级别的策略
```json
{
"handshake": 4,
"handshake": 60,
"connIdle": 300,
"uplinkOnly": 2,
"downlinkOnly": 5,
"uplinkOnly": 1,
"downlinkOnly": 1,
"statsUserUplink": false,
"statsUserDownlink": false,
"bufferSize": 10240
@@ -59,7 +59,7 @@ Xray 系统级别的策略
> `handshake`: number
连接建立时的握手时间限制。单位为秒。默认值为 `4`。在入站代理处理一个新连接时,在握手阶段如果使用的时间超过这个时间,则中断该连接。
连接建立时的握手时间限制。单位为秒。默认值为 `60`。在入站代理处理一个新连接时,在握手阶段如果使用的时间超过这个时间,则中断该连接。
> `connIdle`: number
@@ -67,11 +67,11 @@ Xray 系统级别的策略
> `uplinkOnly`: number
当连接下行线路关闭后的时间限制。单位为秒。默认值为 `2`。当服务器(如远端网站)关闭下行连接时,出站代理会在等待 `uplinkOnly` 时间后中断连接。
当连接下行线路关闭后的时间限制。单位为秒。默认值为 `1`。当服务器(如远端网站)关闭下行连接时,出站代理会在等待 `uplinkOnly` 时间后中断连接。
> `downlinkOnly`: number
当连接上行线路关闭后的时间限制。单位为秒。默认值为 `5`。当客户端(如浏览器)关闭上行连接时,入站代理会在等待 `downlinkOnly` 时间后中断连接。
当连接上行线路关闭后的时间限制。单位为秒。默认值为 `1`。当客户端(如浏览器)关闭上行连接时,入站代理会在等待 `downlinkOnly` 时间后中断连接。
::: tip
在 HTTP 浏览的场景中,可以将 `uplinkOnly``downlinkOnly` 设为 `0`,以提高连接关闭的效率。
@@ -100,7 +100,7 @@ Xray 系统级别的策略
默认值:
- 在 ARM、MIPS、MIPSLE 平台上,默认值为 `0`
- 在 ARM64、MIPS64、MIPS64LE 平台上,默认值为 `4`
- 在 ARM64、MIPS64、MIPS64LE 平台上,默认值为 `60`
- 在其它平台上,默认值为 `512`
默认值可以通过环境变量 XRAY_RAY_BUFFER_SIZE 设置,注意在环境变量中单位为 MB(环境变量设置为 1 等于 config 设置为 1024)
+13 -9
View File
@@ -11,10 +11,10 @@ Local policy allows setting different user levels and corresponding policy setti
"policy": {
"levels": {
"0": {
"handshake": 4,
"handshake": 60,
"connIdle": 300,
"uplinkOnly": 2,
"downlinkOnly": 5,
"uplinkOnly": 1,
"downlinkOnly": 1,
"statsUserUplink": false,
"statsUserDownlink": false,
"statsUserOnline": false,
@@ -47,10 +47,10 @@ Xray system-level policies.
```json
{
"handshake": 4,
"handshake": 60,
"connIdle": 300,
"uplinkOnly": 2,
"downlinkOnly": 5,
"uplinkOnly": 1,
"downlinkOnly": 1,
"statsUserUplink": false,
"statsUserDownlink": false,
"bufferSize": 10240
@@ -59,7 +59,7 @@ Xray system-level policies.
> `handshake`: number
Handshake time limit when establishing a connection. Unit is seconds. Default value is `4`. When an inbound proxy processes a new connection, if the time used during the handshake phase exceeds this time, the connection is interrupted.
Handshake time limit when establishing a connection. Unit is seconds. Default value is `60`. When an inbound proxy processes a new connection, if the time used during the handshake phase exceeds this time, the connection is interrupted.
> `connIdle`: number
@@ -67,11 +67,11 @@ Connection idle time limit. Unit is seconds. Default value is `300`. When an inb
> `uplinkOnly`: number
Time limit after the downlink connection is closed. Unit is seconds. Default value is `2`. When the server (such as a remote website) closes the downlink connection, the outbound proxy will interrupt the connection after waiting for the `uplinkOnly` time.
Time limit after the downlink connection is closed. Unit is seconds. Default value is `1`. When the server (such as a remote website) closes the downlink connection, the outbound proxy will interrupt the connection after waiting for the `uplinkOnly` time.
> `downlinkOnly`: number
Time limit after the uplink connection is closed. Unit is seconds. Default value is `5`. When the client (such as a browser) closes the uplink connection, the inbound proxy will interrupt the connection after waiting for the `downlinkOnly` time.
Time limit after the uplink connection is closed. Unit is seconds. Default value is `1`. When the client (such as a browser) closes the uplink connection, the inbound proxy will interrupt the connection after waiting for the `downlinkOnly` time.
::: tip
In HTTP browsing scenarios, `uplinkOnly` and `downlinkOnly` can be set to `0` to improve connection closing efficiency.
@@ -85,6 +85,10 @@ When set to `true`, enables uplink traffic statistics for all users of the curre
When set to `true`, enables downlink traffic statistics for all users of the current level.
> `statsUserOnline`: true | false
When set to `true`, enables online user count statistics for all users of the current level. (Online criteria: connection activity within 20 seconds).
> `statsUserOnline`: true | false
> When set to `true`, enables online user count statistics for all users of the current level. (Online criteria: connection activity within 20 seconds).
+9 -9
View File
@@ -12,10 +12,10 @@
"policy": {
"levels": {
"0": {
"handshake": 4,
"handshake": 60,
"connIdle": 300,
"uplinkOnly": 2,
"downlinkOnly": 5,
"uplinkOnly": 1,
"downlinkOnly": 1,
"statsUserUplink": false,
"statsUserDownlink": false,
"statsUserOnline": false,
@@ -51,10 +51,10 @@ Xray будет применять различные локальные пол
```json
{
"handshake": 4,
"handshake": 60,
"connIdle": 300,
"uplinkOnly": 2,
"downlinkOnly": 5,
"uplinkOnly": 1,
"downlinkOnly": 1,
"statsUserUplink": false,
"statsUserDownlink": false,
"bufferSize": 10240
@@ -65,7 +65,7 @@ Xray будет применять различные локальные пол
Ограничение времени на установление соединения (рукопожатие).
Измеряется в секундах.
Значение по умолчанию - `4`.
Значение по умолчанию - `60`.
При обработке нового соединения входящим прокси, если время, затраченное на рукопожатие, превышает это значение, соединение разрывается.
> `connIdle`: number
@@ -79,14 +79,14 @@ Xray будет применять различные локальные пол
Ограничение времени ожидания после закрытия исходящего канала соединения.
Измеряется в секундах.
Значение по умолчанию - `2`.
Значение по умолчанию - `1`.
Когда сервер (например, удаленный веб-сайт) закрывает исходящее соединение, исходящий прокси разрывает соединение через `uplinkOnly` секунд.
> `downlinkOnly`: number
Ограничение времени ожидания после закрытия входящего канала соединения.
Измеряется в секундах.
Значение по умолчанию - `5`.
Значение по умолчанию - `1`.
Когда клиент (например, браузер) закрывает входящее соединение, входящий прокси разрывает соединение через `downlinkOnly` секунд.
::: tip