mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-27 11:01:28 +00:00
documentation: Refactor multi networks strategy
This commit is contained in:
parent
012b0af2ab
commit
2a1ce5b6ec
|
@ -7,6 +7,8 @@ icon: material/new-box
|
||||||
!!! quote "Changes in sing-box 1.11.0"
|
!!! quote "Changes in sing-box 1.11.0"
|
||||||
|
|
||||||
:material-plus: [default_network_strategy](#default_network_strategy)
|
:material-plus: [default_network_strategy](#default_network_strategy)
|
||||||
|
:material-plus: [default_network_type](#default_network_type)
|
||||||
|
:material-plus: [default_fallback_network_type](#default_fallback_network_type)
|
||||||
:material-alert: [default_fallback_delay](#default_fallback_delay)
|
:material-alert: [default_fallback_delay](#default_fallback_delay)
|
||||||
|
|
||||||
!!! quote "Changes in sing-box 1.8.0"
|
!!! quote "Changes in sing-box 1.8.0"
|
||||||
|
@ -30,17 +32,18 @@ icon: material/new-box
|
||||||
"default_interface": "",
|
"default_interface": "",
|
||||||
"default_mark": 0,
|
"default_mark": 0,
|
||||||
"default_network_strategy": "",
|
"default_network_strategy": "",
|
||||||
|
"default_network_type": [],
|
||||||
|
"default_fallback_network_type": [],
|
||||||
"default_fallback_delay": ""
|
"default_fallback_delay": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Fields
|
!!! note ""
|
||||||
|
|
||||||
| Key | Format |
|
You can ignore the JSON Array [] tag when the content is only one item
|
||||||
|-----------|-----------------------|
|
|
||||||
| `geoip` | [GeoIP](./geoip/) |
|
### Fields
|
||||||
| `geosite` | [Geosite](./geosite/) |
|
|
||||||
|
|
||||||
#### rules
|
#### rules
|
||||||
|
|
||||||
|
@ -96,11 +99,9 @@ Takes no effect if `outbound.routing_mark` is set.
|
||||||
|
|
||||||
#### default_network_strategy
|
#### default_network_strategy
|
||||||
|
|
||||||
!!! quote ""
|
!!! question "Since sing-box 1.11.0"
|
||||||
|
|
||||||
Only supported in graphical clients on Android and iOS with `auto_detect_interface` enabled.
|
See [Dial Fields](/configuration/shared/dial/#network_strategy) for details.
|
||||||
|
|
||||||
Strategy for selecting network interfaces.
|
|
||||||
|
|
||||||
Takes no effect if `outbound.bind_interface`, `outbound.inet4_bind_address` or `outbound.inet6_bind_address` is set.
|
Takes no effect if `outbound.bind_interface`, `outbound.inet4_bind_address` or `outbound.inet6_bind_address` is set.
|
||||||
|
|
||||||
|
@ -108,12 +109,20 @@ Can be overrides by `outbound.network_strategy`.
|
||||||
|
|
||||||
Conflicts with `default_interface`.
|
Conflicts with `default_interface`.
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial/#network_strategy) for available values.
|
#### default_network_type
|
||||||
|
|
||||||
|
!!! question "Since sing-box 1.11.0"
|
||||||
|
|
||||||
|
See [Dial Fields](/configuration/shared/dial/#network_type) for details.
|
||||||
|
|
||||||
|
#### default_fallback_network_type
|
||||||
|
|
||||||
|
!!! question "Since sing-box 1.11.0"
|
||||||
|
|
||||||
|
See [Dial Fields](/configuration/shared/dial/#fallback_network_type) for details.
|
||||||
|
|
||||||
#### default_fallback_delay
|
#### default_fallback_delay
|
||||||
|
|
||||||
!!! quote ""
|
!!! question "Since sing-box 1.11.0"
|
||||||
|
|
||||||
Only supported in graphical clients on Android and iOS with `auto_detect_interface` enabled and `network_strategy` set.
|
See [Dial Fields](/configuration/shared/dial/#fallback_delay) for details.
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial/#fallback_delay) for details.
|
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
|
---
|
||||||
|
icon: material/new-box
|
||||||
|
---
|
||||||
|
|
||||||
# 路由
|
# 路由
|
||||||
|
|
||||||
|
!!! quote "sing-box 1.11.0 中的更改"
|
||||||
|
|
||||||
|
:material-plus: [network_strategy](#network_strategy)
|
||||||
|
:material-plus: [default_network_type](#default_network_type)
|
||||||
|
:material-plus: [default_fallback_network_type](#default_fallback_network_type)
|
||||||
|
:material-alert: [default_fallback_delay](#default_fallback_delay)
|
||||||
|
|
||||||
!!! quote "sing-box 1.8.0 中的更改"
|
!!! quote "sing-box 1.8.0 中的更改"
|
||||||
|
|
||||||
:material-plus: [rule_set](#rule_set)
|
:material-plus: [rule_set](#rule_set)
|
||||||
|
@ -26,6 +37,10 @@
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! note ""
|
||||||
|
|
||||||
|
当内容只有一项时,可以忽略 JSON 数组 [] 标签
|
||||||
|
|
||||||
### 字段
|
### 字段
|
||||||
|
|
||||||
| 键 | 格式 |
|
| 键 | 格式 |
|
||||||
|
@ -87,11 +102,9 @@
|
||||||
|
|
||||||
#### network_strategy
|
#### network_strategy
|
||||||
|
|
||||||
!!! quote ""
|
!!! question "自 sing-box 1.11.0 起"
|
||||||
|
|
||||||
仅在 Android 与 Apple 平台图形客户端中支持,并且需要 `auto_detect_interface`。
|
详情参阅 [拨号字段](/configuration/shared/dial/#network_strategy)。
|
||||||
|
|
||||||
选择网络接口的策略。
|
|
||||||
|
|
||||||
当 `outbound.bind_interface`, `outbound.inet4_bind_address` 或 `outbound.inet6_bind_address` 已设置时不生效。
|
当 `outbound.bind_interface`, `outbound.inet4_bind_address` 或 `outbound.inet6_bind_address` 已设置时不生效。
|
||||||
|
|
||||||
|
@ -99,12 +112,20 @@
|
||||||
|
|
||||||
与 `default_interface` 冲突。
|
与 `default_interface` 冲突。
|
||||||
|
|
||||||
可用值请参阅 [拨号字段](/configuration/shared/dial/#network_strategy)。
|
#### default_network_type
|
||||||
|
|
||||||
#### fallback_delay
|
!!! question "自 sing-box 1.11.0 起"
|
||||||
|
|
||||||
!!! quote ""
|
详情参阅 [拨号字段](/configuration/shared/dial/#default_network_type)。
|
||||||
|
|
||||||
仅在 Android 与 Apple 平台图形客户端中支持,并且需要 `auto_detect_interface` 且 `network_strategy` 已设置。
|
#### default_fallback_network_type
|
||||||
|
|
||||||
详情请参阅 [拨号字段](/configuration/shared/dial/#fallback_delay)。
|
!!! question "自 sing-box 1.11.0 起"
|
||||||
|
|
||||||
|
详情参阅 [拨号字段](/configuration/shared/dial/#default_fallback_network_type)。
|
||||||
|
|
||||||
|
#### default_fallback_delay
|
||||||
|
|
||||||
|
!!! question "自 sing-box 1.11.0 起"
|
||||||
|
|
||||||
|
详情参阅 [拨号字段](/configuration/shared/dial/#fallback_delay)。
|
||||||
|
|
|
@ -11,12 +11,18 @@ icon: material/new-box
|
||||||
"action": "route", // default
|
"action": "route", // default
|
||||||
"outbound": "",
|
"outbound": "",
|
||||||
"network_strategy": "",
|
"network_strategy": "",
|
||||||
|
"network_type": [],
|
||||||
|
"fallback_network_type": [],
|
||||||
"fallback_delay": "",
|
"fallback_delay": "",
|
||||||
"udp_disable_domain_unmapping": false,
|
"udp_disable_domain_unmapping": false,
|
||||||
"udp_connect": false
|
"udp_connect": false
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! note ""
|
||||||
|
|
||||||
|
You can ignore the JSON Array [] tag when the content is only one item
|
||||||
|
|
||||||
`route` inherits the classic rule behavior of routing connection to the specified outbound.
|
`route` inherits the classic rule behavior of routing connection to the specified outbound.
|
||||||
|
|
||||||
#### outbound
|
#### outbound
|
||||||
|
@ -27,23 +33,21 @@ Tag of target outbound.
|
||||||
|
|
||||||
#### network_strategy
|
#### network_strategy
|
||||||
|
|
||||||
!!! quote ""
|
See [Dial Fields](/configuration/shared/dial/#network_strategy) for details.
|
||||||
|
|
||||||
Only supported in graphical clients on Android and iOS with `auto_detect_interface` enabled.
|
|
||||||
|
|
||||||
Strategy for selecting network interfaces.
|
|
||||||
|
|
||||||
Only take effect if outbound is direct without `outbound.bind_interface`,
|
Only take effect if outbound is direct without `outbound.bind_interface`,
|
||||||
`outbound.inet4_bind_address` and `outbound.inet6_bind_address` set.
|
`outbound.inet4_bind_address` and `outbound.inet6_bind_address` set.
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial/#network_strategy) for available values.
|
#### network_type
|
||||||
|
|
||||||
|
See [Dial Fields](/configuration/shared/dial/#network_type) for details.
|
||||||
|
|
||||||
|
#### fallback_network_type
|
||||||
|
|
||||||
|
See [Dial Fields](/configuration/shared/dial/#fallback_network_type) for details.
|
||||||
|
|
||||||
#### fallback_delay
|
#### fallback_delay
|
||||||
|
|
||||||
!!! quote ""
|
|
||||||
|
|
||||||
Only supported in graphical clients on Android and iOS with `auto_detect_interface` enabled and `network_strategy` set.
|
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial/#fallback_delay) for details.
|
See [Dial Fields](/configuration/shared/dial/#fallback_delay) for details.
|
||||||
|
|
||||||
#### udp_disable_domain_unmapping
|
#### udp_disable_domain_unmapping
|
||||||
|
|
|
@ -12,6 +12,8 @@ icon: material/new-box
|
||||||
"outbound": "",
|
"outbound": "",
|
||||||
"network_strategy": "",
|
"network_strategy": "",
|
||||||
"fallback_delay": "",
|
"fallback_delay": "",
|
||||||
|
"network_type": [],
|
||||||
|
"fallback_network_type": [],
|
||||||
"udp_disable_domain_unmapping": false,
|
"udp_disable_domain_unmapping": false,
|
||||||
"udp_connect": false
|
"udp_connect": false
|
||||||
}
|
}
|
||||||
|
@ -27,23 +29,21 @@ icon: material/new-box
|
||||||
|
|
||||||
#### network_strategy
|
#### network_strategy
|
||||||
|
|
||||||
!!! quote ""
|
详情参阅 [拨号字段](/configuration/shared/dial/#network_strategy)。
|
||||||
|
|
||||||
仅在 Android 与 Apple 平台图形客户端中支持,并且需要 `auto_detect_interface`。
|
|
||||||
|
|
||||||
选择网络接口的策略。
|
|
||||||
|
|
||||||
仅当出站为 `direct` 且 `outbound.bind_interface`, `outbound.inet4_bind_address`
|
仅当出站为 `direct` 且 `outbound.bind_interface`, `outbound.inet4_bind_address`
|
||||||
且 `outbound.inet6_bind_address` 未设置时生效。
|
且 `outbound.inet6_bind_address` 未设置时生效。
|
||||||
|
|
||||||
可用值参阅 [拨号字段](/configuration/shared/dial/#network_strategy)。
|
#### network_type
|
||||||
|
|
||||||
|
详情参阅 [拨号字段](/configuration/shared/dial/#network_type)。
|
||||||
|
|
||||||
|
#### fallback_network_type
|
||||||
|
|
||||||
|
详情参阅 [拨号字段](/configuration/shared/dial/#fallback_network_type)。
|
||||||
|
|
||||||
#### fallback_delay
|
#### fallback_delay
|
||||||
|
|
||||||
!!! quote ""
|
|
||||||
|
|
||||||
仅在 Android 与 Apple 平台图形客户端中支持,并且需要 `auto_detect_interface` 且 `network_strategy` 已设置。
|
|
||||||
|
|
||||||
详情参阅 [拨号字段](/configuration/shared/dial/#fallback_delay)。
|
详情参阅 [拨号字段](/configuration/shared/dial/#fallback_delay)。
|
||||||
|
|
||||||
#### udp_disable_domain_unmapping
|
#### udp_disable_domain_unmapping
|
||||||
|
@ -68,6 +68,10 @@ icon: material/new-box
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! note ""
|
||||||
|
|
||||||
|
当内容只有一项时,可以忽略 JSON 数组 [] 标签
|
||||||
|
|
||||||
`route-options` 为路由设置选项。
|
`route-options` 为路由设置选项。
|
||||||
|
|
||||||
### reject
|
### reject
|
||||||
|
|
|
@ -5,7 +5,9 @@ icon: material/new-box
|
||||||
!!! quote "Changes in sing-box 1.11.0"
|
!!! quote "Changes in sing-box 1.11.0"
|
||||||
|
|
||||||
:material-plus: [network_strategy](#network_strategy)
|
:material-plus: [network_strategy](#network_strategy)
|
||||||
:material-alert: [fallback_delay](#fallback_delay)
|
:material-alert: [fallback_delay](#fallback_delay)
|
||||||
|
:material-alert: [network_type](#network_type)
|
||||||
|
:material-alert: [fallback_network_type](#fallback_network_type)
|
||||||
|
|
||||||
### Structure
|
### Structure
|
||||||
|
|
||||||
|
@ -23,10 +25,16 @@ icon: material/new-box
|
||||||
"udp_fragment": false,
|
"udp_fragment": false,
|
||||||
"domain_strategy": "prefer_ipv6",
|
"domain_strategy": "prefer_ipv6",
|
||||||
"network_strategy": "default",
|
"network_strategy": "default",
|
||||||
|
"network_type": [],
|
||||||
|
"fallback_network_type": [],
|
||||||
"fallback_delay": "300ms"
|
"fallback_delay": "300ms"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! note ""
|
||||||
|
|
||||||
|
You can ignore the JSON Array [] tag when the content is only one item
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
#### detour
|
#### detour
|
||||||
|
@ -101,30 +109,57 @@ If set, the requested domain name will be resolved to IP before connect.
|
||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
Only supported in graphical clients on Android and iOS with `auto_detect_interface` enabled.
|
Only supported in graphical clients on Android and Apple platforms with `auto_detect_interface` enabled.
|
||||||
|
|
||||||
Strategy for selecting network interfaces.
|
Strategy for selecting network interfaces.
|
||||||
|
|
||||||
Available values:
|
Available values:
|
||||||
|
|
||||||
- `default` (default): Connect to the default interface.
|
- `default` (default): Connect to default network or networks specified in `network_type` sequentially.
|
||||||
- `fallback`: Try all other interfaces when timeout.
|
- `hybrid`: Connect to all networks or networks specified in `network_type` concurrently.
|
||||||
- `hybrid`: Connect to all interfaces concurrently and choose the fastest one.
|
- `fallback`: Connect to default network or preferred networks specified in `network_type` concurrently, and try fallback networks when unavailable or timeout.
|
||||||
- `wifi`: Prioritize WIFI, but try all other interfaces when unavailable or timeout.
|
|
||||||
- `cellular`: Prioritize Cellular, but try all other interfaces when unavailable or timeout.
|
|
||||||
- `ethernet`: Prioritize Ethernet, but try all other interfaces when unavailable or timeout.
|
|
||||||
- `wifi_only`: Connect to WIFI only.
|
|
||||||
- `cellular_only`: Connect to Cellular only.
|
|
||||||
- `ethernet_only`: Connect to Ethernet only.
|
|
||||||
|
|
||||||
For fallback strategies, when preferred interfaces fails or times out,
|
For fallback, when preferred interfaces fails or times out,
|
||||||
it will enter a 15s fast fallback state (upgraded to `hybrid`),
|
it will enter a 15s fast fallback state (Connect to all preferred and fallback networks concurrently),
|
||||||
and exit immediately if recovers.
|
and exit immediately if preferred networks recover.
|
||||||
|
|
||||||
Conflicts with `bind_interface`, `inet4_bind_address` and `inet6_bind_address`.
|
Conflicts with `bind_interface`, `inet4_bind_address` and `inet6_bind_address`.
|
||||||
|
|
||||||
|
#### network_type
|
||||||
|
|
||||||
|
!!! question "Since sing-box 1.11.0"
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
Only supported in graphical clients on Android and Apple platforms with `auto_detect_interface` enabled.
|
||||||
|
|
||||||
|
Network types to use when using `default` or `hybrid` network strategy or
|
||||||
|
preferred network types to use when using `fallback` network strategy.
|
||||||
|
|
||||||
|
Available values: `wifi`, `cellular`, `ethernet`, `other`.
|
||||||
|
|
||||||
|
Device's default network is used by default.
|
||||||
|
|
||||||
|
#### fallback_network_type
|
||||||
|
|
||||||
|
!!! question "Since sing-box 1.11.0"
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
Only supported in graphical clients on Android and Apple platforms with `auto_detect_interface` enabled.
|
||||||
|
|
||||||
|
Fallback network types when preferred networks are unavailable or timeout when using `fallback` network strategy.
|
||||||
|
|
||||||
|
All other networks expect preferred are used by default.
|
||||||
|
|
||||||
#### fallback_delay
|
#### fallback_delay
|
||||||
|
|
||||||
|
!!! question "Since sing-box 1.11.0"
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
Only supported in graphical clients on Android and Apple platforms with `auto_detect_interface` enabled.
|
||||||
|
|
||||||
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
|
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
|
||||||
|
|
||||||
For `domain_strategy`, is the amount of time to wait for connection to succeed before assuming
|
For `domain_strategy`, is the amount of time to wait for connection to succeed before assuming
|
||||||
|
|
|
@ -5,7 +5,9 @@ icon: material/new-box
|
||||||
!!! quote "sing-box 1.11.0 中的更改"
|
!!! quote "sing-box 1.11.0 中的更改"
|
||||||
|
|
||||||
:material-plus: [network_strategy](#network_strategy)
|
:material-plus: [network_strategy](#network_strategy)
|
||||||
:material-alert: [fallback_delay](#fallback_delay)
|
:material-alert: [fallback_delay](#fallback_delay)
|
||||||
|
:material-alert: [network_type](#network_type)
|
||||||
|
:material-alert: [fallback_network_type](#fallback_network_type)
|
||||||
|
|
||||||
### 结构
|
### 结构
|
||||||
|
|
||||||
|
@ -23,10 +25,16 @@ icon: material/new-box
|
||||||
"udp_fragment": false,
|
"udp_fragment": false,
|
||||||
"domain_strategy": "prefer_ipv6",
|
"domain_strategy": "prefer_ipv6",
|
||||||
"network_strategy": "",
|
"network_strategy": "",
|
||||||
|
"network_type": [],
|
||||||
|
"fallback_network_type": [],
|
||||||
"fallback_delay": "300ms"
|
"fallback_delay": "300ms"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! note ""
|
||||||
|
|
||||||
|
当内容只有一项时,可以忽略 JSON 数组 [] 标签
|
||||||
|
|
||||||
### 字段
|
### 字段
|
||||||
|
|
||||||
#### detour
|
#### detour
|
||||||
|
@ -99,26 +107,48 @@ icon: material/new-box
|
||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
仅在 Android 与 iOS 平台图形客户端中支持。
|
仅在 Android 与 iOS 平台图形客户端中支持,并且需要 `route.auto_detect_interface`。
|
||||||
|
|
||||||
用于选择网络接口的策略。
|
用于选择网络接口的策略。
|
||||||
|
|
||||||
可用值:
|
可用值:
|
||||||
|
|
||||||
- `default` (默认): 连接到默认接口,
|
- `default`(默认值):按顺序连接默认网络或 `network_type` 中指定的网络。
|
||||||
- `fallback`: 如果超时,尝试所有剩余接口。
|
- `hybrid`:同时连接所有网络或 `network_type` 中指定的网络。
|
||||||
- `hybrid`: 同时尝试所有接口,选择最快的一个。
|
- `fallback`:同时连接默认网络或 `network_type` 中指定的首选网络,当不可用或超时时尝试回退网络。
|
||||||
- `wifi`: 优先使用 WIFI,但在不可用或超时时尝试所有其他接口。
|
|
||||||
- `cellular`: 优先使用蜂窝数据,但在不可用或超时时尝试所有其他接口。
|
|
||||||
- `ethernet`: 优先使用以太网,但在不可用或超时时尝试所有其他接口。
|
|
||||||
- `wifi_only`: 仅连接到 WIFI。
|
|
||||||
- `cellular_only`: 仅连接到蜂窝数据。
|
|
||||||
- `ethernet_only`: 仅连接到以太网。
|
|
||||||
|
|
||||||
对于回退策略, 当优先使用的接口发生故障或超时时, 将进入 15 秒的快速回退状态(升级为 `hybrid`), 且恢复后立即退出。
|
对于回退模式,当首选接口失败或超时时,
|
||||||
|
将进入15秒的快速回退状态(同时连接所有首选和回退网络),
|
||||||
|
如果首选网络恢复,则立即退出。
|
||||||
|
|
||||||
与 `bind_interface`, `bind_inet4_address` 和 `bind_inet6_address` 冲突。
|
与 `bind_interface`, `bind_inet4_address` 和 `bind_inet6_address` 冲突。
|
||||||
|
|
||||||
|
#### network_type
|
||||||
|
|
||||||
|
!!! question "自 sing-box 1.11.0 起"
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
仅在 Android 与 iOS 平台图形客户端中支持,并且需要 `route.auto_detect_interface`。
|
||||||
|
|
||||||
|
当使用 `default` 或 `hybrid` 网络策略时要使用的网络类型,或当使用 `fallback` 网络策略时要使用的首选网络类型。
|
||||||
|
|
||||||
|
可用值:`wifi`, `cellular`, `ethernet`, `other`。
|
||||||
|
|
||||||
|
默认使用设备默认网络。
|
||||||
|
|
||||||
|
#### fallback_network_type
|
||||||
|
|
||||||
|
!!! question "自 sing-box 1.11.0 起"
|
||||||
|
|
||||||
|
!!! quote ""
|
||||||
|
|
||||||
|
仅在 Android 与 iOS 平台图形客户端中支持,并且需要 `route.auto_detect_interface`。
|
||||||
|
|
||||||
|
当使用 `fallback` 网络策略时,在首选网络不可用或超时的情况下要使用的回退网络类型。
|
||||||
|
|
||||||
|
默认使用除首选网络外的所有其他网络。
|
||||||
|
|
||||||
#### fallback_delay
|
#### fallback_delay
|
||||||
|
|
||||||
在生成 RFC 6555 快速回退连接之前等待的时间长度。
|
在生成 RFC 6555 快速回退连接之前等待的时间长度。
|
||||||
|
|
Loading…
Reference in a new issue