refactor: New tun udpnat
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
!!! quote "Changes in sing-box 1.14.0"
|
||||
|
||||
:material-plus: [udp_mapping](/configuration/shared/udp-nat/#udp_mapping)
|
||||
:material-plus: [udp_filtering](/configuration/shared/udp-nat/#udp_filtering)
|
||||
:material-plus: [udp_nat_max](/configuration/shared/udp-nat/#udp_nat_max)
|
||||
|
||||
!!! question "Since sing-box 1.11.0"
|
||||
|
||||
### Structure
|
||||
@@ -24,7 +30,9 @@
|
||||
"reserved": [0, 0, 0]
|
||||
}
|
||||
],
|
||||
"udp_timeout": "",
|
||||
|
||||
... // UDP NAT Fields
|
||||
|
||||
"workers": 0,
|
||||
|
||||
... // Dial Fields
|
||||
@@ -112,18 +120,16 @@ Disabled by default.
|
||||
|
||||
WireGuard reserved field bytes.
|
||||
|
||||
#### udp_timeout
|
||||
|
||||
UDP NAT expiration time.
|
||||
|
||||
`5m` will be used by default.
|
||||
|
||||
#### workers
|
||||
|
||||
WireGuard worker count.
|
||||
|
||||
CPU count is used by default.
|
||||
|
||||
### UDP NAT Fields
|
||||
|
||||
See [UDP NAT Fields](/configuration/shared/udp-nat/) for details.
|
||||
|
||||
### Dial Fields
|
||||
|
||||
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
!!! quote "sing-box 1.14.0 中的更改"
|
||||
|
||||
:material-plus: [udp_mapping](/zh/configuration/shared/udp-nat/#udp_mapping)
|
||||
:material-plus: [udp_filtering](/zh/configuration/shared/udp-nat/#udp_filtering)
|
||||
:material-plus: [udp_nat_max](/zh/configuration/shared/udp-nat/#udp_nat_max)
|
||||
|
||||
!!! question "自 sing-box 1.11.0 起"
|
||||
|
||||
### 结构
|
||||
@@ -24,7 +30,9 @@
|
||||
"reserved": [0, 0, 0]
|
||||
}
|
||||
],
|
||||
"udp_timeout": "",
|
||||
|
||||
... // UDP NAT 字段
|
||||
|
||||
"workers": 0,
|
||||
|
||||
... // 拨号字段
|
||||
@@ -114,18 +122,16 @@ WireGuard 对等方的列表。
|
||||
|
||||
对等方的保留字段字节。
|
||||
|
||||
#### udp_timeout
|
||||
|
||||
UDP NAT 过期时间。
|
||||
|
||||
默认使用 `5m`。
|
||||
|
||||
#### workers
|
||||
|
||||
WireGuard worker 数量。
|
||||
|
||||
默认使用 CPU 数量。
|
||||
|
||||
### UDP NAT 字段
|
||||
|
||||
参阅 [UDP NAT 字段](/zh/configuration/shared/udp-nat/)。
|
||||
|
||||
### 拨号字段
|
||||
|
||||
参阅 [拨号字段](/zh/configuration/shared/dial/)。
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
!!! quote "Changes in sing-box 1.14.0"
|
||||
|
||||
:material-plus: [udp_mapping](/configuration/shared/udp-nat/#udp_mapping)
|
||||
:material-plus: [udp_filtering](/configuration/shared/udp-nat/#udp_filtering)
|
||||
:material-plus: [udp_nat_max](/configuration/shared/udp-nat/#udp_nat_max)
|
||||
|
||||
!!! quote ""
|
||||
|
||||
Only supported on Linux.
|
||||
@@ -11,7 +17,9 @@
|
||||
|
||||
... // Listen Fields
|
||||
|
||||
"network": "udp"
|
||||
"network": "udp",
|
||||
|
||||
... // UDP NAT Fields
|
||||
}
|
||||
```
|
||||
|
||||
@@ -26,3 +34,7 @@ See [Listen Fields](/configuration/shared/listen/) for details.
|
||||
Listen network, one of `tcp` `udp`.
|
||||
|
||||
Both if empty.
|
||||
|
||||
### UDP NAT Fields
|
||||
|
||||
See [UDP NAT Fields](/configuration/shared/udp-nat/) for details.
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
!!! quote "sing-box 1.14.0 中的更改"
|
||||
|
||||
:material-plus: [udp_mapping](/zh/configuration/shared/udp-nat/#udp_mapping)
|
||||
:material-plus: [udp_filtering](/zh/configuration/shared/udp-nat/#udp_filtering)
|
||||
:material-plus: [udp_nat_max](/zh/configuration/shared/udp-nat/#udp_nat_max)
|
||||
|
||||
!!! quote ""
|
||||
|
||||
仅支持 Linux。
|
||||
@@ -11,7 +17,9 @@
|
||||
|
||||
... // 监听字段
|
||||
|
||||
"network": "udp"
|
||||
"network": "udp",
|
||||
|
||||
... // UDP NAT 字段
|
||||
}
|
||||
```
|
||||
|
||||
@@ -26,3 +34,7 @@
|
||||
监听的网络协议,`tcp` `udp` 之一。
|
||||
|
||||
默认所有。
|
||||
|
||||
### UDP NAT 字段
|
||||
|
||||
参阅 [UDP NAT 字段](/zh/configuration/shared/udp-nat/)。
|
||||
|
||||
@@ -8,7 +8,10 @@ icon: material/new-box
|
||||
:material-plus: [exclude_mac_address](#exclude_mac_address)
|
||||
:material-plus: [dns_mode](#dns_mode)
|
||||
:material-plus: [dns_address](#dns_address)
|
||||
:material-plus: [netns](#netns)
|
||||
:material-plus: [netns](#netns)
|
||||
:material-plus: [udp_mapping](/configuration/shared/udp-nat/#udp_mapping)
|
||||
:material-plus: [udp_filtering](/configuration/shared/udp-nat/#udp_filtering)
|
||||
:material-plus: [udp_nat_max](/configuration/shared/udp-nat/#udp_nat_max)
|
||||
|
||||
!!! quote "Changes in sing-box 1.13.3"
|
||||
|
||||
@@ -112,7 +115,9 @@ icon: material/new-box
|
||||
"geoip-cn"
|
||||
],
|
||||
"endpoint_independent_nat": false,
|
||||
"udp_timeout": "5m",
|
||||
|
||||
... // UDP NAT Fields
|
||||
|
||||
"stack": "system",
|
||||
"include_interface": [
|
||||
"lan0"
|
||||
@@ -553,12 +558,6 @@ Enable endpoint-independent NAT.
|
||||
|
||||
Performance may degrade slightly, so it is not recommended to enable on when it is not needed.
|
||||
|
||||
#### udp_timeout
|
||||
|
||||
UDP NAT expiration time.
|
||||
|
||||
`5m` will be used by default.
|
||||
|
||||
#### stack
|
||||
|
||||
!!! quote "Changes in sing-box 1.8.0"
|
||||
@@ -700,6 +699,10 @@ Hostnames that bypass the HTTP proxy.
|
||||
|
||||
Hostnames that use the HTTP proxy.
|
||||
|
||||
### UDP NAT Fields
|
||||
|
||||
See [UDP NAT Fields](/configuration/shared/udp-nat/) for details.
|
||||
|
||||
### Listen Fields
|
||||
|
||||
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||
|
||||
@@ -8,7 +8,10 @@ icon: material/new-box
|
||||
:material-plus: [exclude_mac_address](#exclude_mac_address)
|
||||
:material-plus: [dns_mode](#dns_mode)
|
||||
:material-plus: [dns_address](#dns_address)
|
||||
:material-plus: [netns](#netns)
|
||||
:material-plus: [netns](#netns)
|
||||
:material-plus: [udp_mapping](/zh/configuration/shared/udp-nat/#udp_mapping)
|
||||
:material-plus: [udp_filtering](/zh/configuration/shared/udp-nat/#udp_filtering)
|
||||
:material-plus: [udp_nat_max](/zh/configuration/shared/udp-nat/#udp_nat_max)
|
||||
|
||||
!!! quote "sing-box 1.13.3 中的更改"
|
||||
|
||||
@@ -113,7 +116,9 @@ icon: material/new-box
|
||||
"geoip-cn"
|
||||
],
|
||||
"endpoint_independent_nat": false,
|
||||
"udp_timeout": "5m",
|
||||
|
||||
... // UDP NAT 字段
|
||||
|
||||
"stack": "system",
|
||||
"include_interface": [
|
||||
"lan0"
|
||||
@@ -533,12 +538,6 @@ sing-box DNS 模块,等价于一条
|
||||
|
||||
性能可能会略有下降,所以不建议在不需要的时候开启。
|
||||
|
||||
#### udp_timeout
|
||||
|
||||
UDP NAT 过期时间。
|
||||
|
||||
默认使用 `5m`。
|
||||
|
||||
#### stack
|
||||
|
||||
!!! quote "sing-box 1.8.0 中的更改"
|
||||
@@ -680,6 +679,10 @@ TCP/IP 栈。
|
||||
|
||||
代理的主机名列表。
|
||||
|
||||
### UDP NAT 字段
|
||||
|
||||
参阅 [UDP NAT 字段](/zh/configuration/shared/udp-nat/)。
|
||||
|
||||
### 监听字段
|
||||
|
||||
参阅 [监听字段](/zh/configuration/shared/listen/)。
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
icon: material/new-box
|
||||
---
|
||||
|
||||
!!! quote "Changes in sing-box 1.14.0"
|
||||
|
||||
:material-plus: [udp_mapping](#udp_mapping)
|
||||
:material-plus: [udp_filtering](#udp_filtering)
|
||||
:material-plus: [udp_nat_max](#udp_nat_max)
|
||||
|
||||
### Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"udp_timeout": "5m",
|
||||
"udp_mapping": "endpoint_independent",
|
||||
"udp_filtering": "endpoint_independent",
|
||||
"udp_nat_max": 0
|
||||
}
|
||||
```
|
||||
|
||||
### Fields
|
||||
|
||||
#### udp_timeout
|
||||
|
||||
UDP NAT expiration time.
|
||||
|
||||
`5m` will be used by default.
|
||||
|
||||
#### udp_mapping
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
UDP NAT mapping behavior.
|
||||
|
||||
| Value | Behavior |
|
||||
|------------------------------|-------------------------------------------------------------------------------|
|
||||
| `endpoint_independent` | Reuse the same mapping for the same source address and port for all destinations. |
|
||||
| `address_dependent` | Use a separate mapping for each destination address. |
|
||||
| `address_and_port_dependent` | Use a separate mapping for each destination address and port. |
|
||||
|
||||
`endpoint_independent` is used by default.
|
||||
|
||||
#### udp_filtering
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
UDP NAT filtering behavior.
|
||||
|
||||
| Value | Behavior |
|
||||
|------------------------------|-----------------------------------------------------------------------------|
|
||||
| `endpoint_independent` | Accept packets from any remote endpoint. |
|
||||
| `address_dependent` | Accept packets only from remote addresses to which packets have been sent. |
|
||||
| `address_and_port_dependent` | Accept packets only from remote addresses and ports to which packets have been sent. |
|
||||
|
||||
`endpoint_independent` is used by default.
|
||||
|
||||
#### udp_nat_max
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
Maximum number of UDP NAT sessions.
|
||||
|
||||
When the limit is reached, the least recently used session is closed.
|
||||
|
||||
When unset or set to `0`, `4096` is used on iOS. On other platforms, a value from `4096` to `16384` is selected based on total memory;
|
||||
`16384` is used if total memory cannot be detected.
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
icon: material/new-box
|
||||
---
|
||||
|
||||
!!! quote "sing-box 1.14.0 中的更改"
|
||||
|
||||
:material-plus: [udp_mapping](#udp_mapping)
|
||||
:material-plus: [udp_filtering](#udp_filtering)
|
||||
:material-plus: [udp_nat_max](#udp_nat_max)
|
||||
|
||||
### 结构
|
||||
|
||||
```json
|
||||
{
|
||||
"udp_timeout": "5m",
|
||||
"udp_mapping": "endpoint_independent",
|
||||
"udp_filtering": "endpoint_independent",
|
||||
"udp_nat_max": 0
|
||||
}
|
||||
```
|
||||
|
||||
### 字段
|
||||
|
||||
#### udp_timeout
|
||||
|
||||
UDP NAT 过期时间。
|
||||
|
||||
默认使用 `5m`。
|
||||
|
||||
#### udp_mapping
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
UDP NAT 映射行为。
|
||||
|
||||
| 值 | 行为 |
|
||||
|------------------------------|----------------------------------------------------------|
|
||||
| `endpoint_independent` | 对相同的源地址和端口,所有目标复用同一映射。 |
|
||||
| `address_dependent` | 每个目标地址使用单独的映射。 |
|
||||
| `address_and_port_dependent` | 每个目标地址和端口使用单独的映射。 |
|
||||
|
||||
默认使用 `endpoint_independent`。
|
||||
|
||||
#### udp_filtering
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
UDP NAT 过滤行为。
|
||||
|
||||
| 值 | 行为 |
|
||||
|------------------------------|----------------------------------------------------------|
|
||||
| `endpoint_independent` | 接受来自任意远程端点的数据包。 |
|
||||
| `address_dependent` | 仅接受来自已向其发送过数据包的远程地址的数据包。 |
|
||||
| `address_and_port_dependent` | 仅接受来自已向其发送过数据包的远程地址和端口的数据包。 |
|
||||
|
||||
默认使用 `endpoint_independent`。
|
||||
|
||||
#### udp_nat_max
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
UDP NAT 会话的最大数量。
|
||||
|
||||
达到限制时,将关闭最近最少使用的会话。
|
||||
|
||||
未设置或设置为 `0` 时,iOS 使用 `4096`。其他平台根据总内存在 `4096` 到 `16384` 之间选择;
|
||||
无法检测总内存时使用 `16384`。
|
||||
Reference in New Issue
Block a user