Skip to content

Commit 469a487

Browse files
oweidxiaokangwang
authored andcommitted
Create EN-US version of policy.md
1 parent dfa6321 commit 469a487

File tree

1 file changed

+127
-1
lines changed

1 file changed

+127
-1
lines changed

docs/en_US/config/policy.md

Lines changed: 127 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,129 @@
11
# Policy
22

3-
The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
3+
Local policies can configure user-related permissions, such as connection timeout settings. Every connection handled by V2Ray corresponds to a user, and different policies are applied according to the user's level. Local policies can vary based on different levels.
4+
5+
## PolicyObject
6+
7+
`PolicyObject` corresponds to the `policy` entry in the configuration file.
8+
9+
```json
10+
{
11+
"levels": {
12+
"0": {
13+
"handshake": 4,
14+
"connIdle": 300,
15+
"uplinkOnly": 2,
16+
"downlinkOnly": 5,
17+
"statsUserUplink": false,
18+
"statsUserDownlink": false,
19+
"bufferSize": 10240
20+
}
21+
},
22+
"system": {
23+
"statsInboundUplink": false,
24+
"statsInboundDownlink": false,
25+
"statsOutboundUplink": false,
26+
"statsOutboundDownlink": false
27+
}
28+
}
29+
```
30+
31+
> `level`: map{string: [LevelPolicyObject](#levelpolicyobject)}
32+
33+
A key-value pair where each key is a number in string format (JSON requirement), such as `"0"`, `"1"`, etc. The quotation marks cannot be omitted. This number corresponds to the user level. Each value is a [LevelPolicyObject](#levelpolicyobject).
34+
35+
:::tip
36+
Each inbound and outbound proxy can now set user levels, and V2Ray will apply different local policies based on the actual user level.
37+
:::
38+
39+
> `system`: [SystemPolicyObject](#systempolicyobject)
40+
41+
System policies for V2Ray
42+
43+
## LevelPolicyObject
44+
45+
```json
46+
{
47+
"handshake": 4,
48+
"connIdle": 300,
49+
"uplinkOnly": 2,
50+
"downlinkOnly": 5,
51+
"statsUserUplink": false,
52+
"statsUserDownlink": false,
53+
"bufferSize": 10240
54+
}
55+
```
56+
57+
> `handshake`: number
58+
59+
Time limit for connection handshake. Unit is seconds. Default value is `4`. When an inbound proxy processes a new connection during the handshake phase (e.g., VMess reading header data, determining target server address), if the time used exceeds this limit, the connection will be terminated.
60+
61+
> `connIdle`: number
62+
63+
Connection idle time limit. Unit is seconds. Default value is `300`. When processing a connection in inbound/outbound proxies, if no data (including uplink and downlink) is transmitted within `connIdle` time, the connection will be terminated.
64+
65+
> `uplinkOnly`: number
66+
67+
Time limit after downlink connection closure. Unit is seconds. Default value is `2`. When the server (e.g., remote website) closes the downlink connection, the outbound proxy will terminate the connection after waiting for `uplinkOnly` seconds.
68+
69+
> `downlinkOnly`: number
70+
71+
Time limit after uplink connection closure. Unit is seconds. Default value is `5`. When the client (e.g., browser) closes the uplink connection, the inbound proxy will terminate the connection after waiting for `downlinkOnly` seconds.
72+
73+
:::tip
74+
In HTTP browsing scenarios, you can set both `uplinkOnly` and `downlinkOnly` to `0` to improve connection closure efficiency.
75+
:::
76+
77+
> `statsUserUplink`: true | false
78+
79+
When set to `true`, enables uplink traffic statistics for all users at the current level.
80+
81+
> `statsUserDownlink`: true | false
82+
83+
When set to `true`, enables downlink traffic statistics for all users at the current level.
84+
85+
> `bufferSize`: number
86+
87+
Internal buffer size for each connection. Unit is kB. When set to `0`, internal buffer is disabled.
88+
89+
Default values (V2Ray 4.4+):
90+
91+
* On ARM, MIPS, MIPSLE platforms: default is `0`
92+
* On ARM64, MIPS64, MIPS64LE platforms: default is `4`
93+
* On other platforms: default is `512`
94+
95+
Default values (V2Ray 4.3-):
96+
97+
* On ARM, MIPS, MIPSLE, ARM64, MIPS64, MIPS64LE platforms: default is `16`
98+
* On other platforms: default is `2048`
99+
100+
:::tip
101+
The `bufferSize` option overrides the `v2ray.ray.buffer.size` setting in [environment variables](env.md#buffer-size-per-connection).
102+
:::
103+
104+
## SystemPolicyObject
105+
106+
```json
107+
{
108+
"statsInboundUplink": false,
109+
"statsInboundDownlink": false,
110+
"statsOutboundUplink": false,
111+
"statsOutboundDownlink": false
112+
}
113+
```
114+
115+
> `statsInboundUplink`: true | false
116+
117+
When set to `true`, enables uplink traffic statistics for all inbound proxies.
118+
119+
> `statsInboundDownlink`: true | false
120+
121+
When set to `true`, enables downlink traffic statistics for all inbound proxies.
122+
123+
> `statsOutboundUplink`: true | false
124+
125+
(V2Ray 4.26.0+) When set to `true`, enables uplink traffic statistics for all outbound proxies.
126+
127+
> `statsOutboundDownlink`: true | false
128+
129+
(V2Ray 4.26.0+) When set to `true`, enables downlink traffic statistics for all outbound proxies.

0 commit comments

Comments
 (0)