2022-08-24 08:23:21 +00:00
|
|
|
# 路由
|
|
|
|
|
2023-12-01 05:24:18 +00:00
|
|
|
!!! quote "sing-box 1.8.0 中的更改"
|
|
|
|
|
|
|
|
:material-plus: [rule_set](#rule_set)
|
|
|
|
:material-delete-clock: [geoip](#geoip)
|
|
|
|
:material-delete-clock: [geosite](#geosite)
|
|
|
|
|
2022-08-24 08:23:21 +00:00
|
|
|
### 结构
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"route": {
|
|
|
|
"geoip": {},
|
|
|
|
"geosite": {},
|
|
|
|
"rules": [],
|
2023-12-01 05:24:18 +00:00
|
|
|
"rule_set": [],
|
2022-08-24 08:23:21 +00:00
|
|
|
"final": "",
|
|
|
|
"auto_detect_interface": false,
|
2022-09-09 07:40:35 +00:00
|
|
|
"override_android_vpn": false,
|
2022-08-24 08:23:21 +00:00
|
|
|
"default_interface": "en0",
|
|
|
|
"default_mark": 233
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
### 字段
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2023-12-14 14:23:52 +00:00
|
|
|
| 键 | 格式 |
|
|
|
|
|-----------|-----------------------|
|
|
|
|
| `geoip` | [GeoIP](./geoip/) |
|
2023-12-01 05:24:18 +00:00
|
|
|
| `geosite` | [Geosite](./geosite/) |
|
|
|
|
|
|
|
|
#### rule
|
|
|
|
|
|
|
|
一组 [路由规则](./rule/) 。
|
|
|
|
|
|
|
|
#### rule_set
|
|
|
|
|
|
|
|
!!! question "自 sing-box 1.8.0 起"
|
|
|
|
|
|
|
|
一组 [规则集](/configuration/rule-set/)。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
#### final
|
|
|
|
|
2023-11-15 17:11:28 +00:00
|
|
|
默认出站标签。如果为空,将使用第一个可用于对应协议的出站。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
#### auto_detect_interface
|
|
|
|
|
2023-11-09 09:04:08 +00:00
|
|
|
!!! quote ""
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
仅支持 Linux、Windows 和 macOS。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-09-09 07:40:35 +00:00
|
|
|
默认将出站连接绑定到默认网卡,以防止在 tun 下出现路由环路。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
如果设置了 `outbound.bind_interface` 设置,则不生效。
|
|
|
|
|
2022-09-09 07:40:35 +00:00
|
|
|
#### override_android_vpn
|
|
|
|
|
2023-11-09 09:04:08 +00:00
|
|
|
!!! quote ""
|
2022-09-09 07:40:35 +00:00
|
|
|
|
|
|
|
仅支持 Android。
|
|
|
|
|
|
|
|
启用 `auto_detect_interface` 时接受 Android VPN 作为上游网卡。
|
|
|
|
|
2022-08-24 08:23:21 +00:00
|
|
|
#### default_interface
|
|
|
|
|
2023-11-09 09:04:08 +00:00
|
|
|
!!! quote ""
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
仅支持 Linux、Windows 和 macOS。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-09-09 07:40:35 +00:00
|
|
|
默认将出站连接绑定到指定网卡,以防止在 tun 下出现路由环路。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
如果设置了 `auto_detect_interface` 设置,则不生效。
|
|
|
|
|
|
|
|
#### default_mark
|
|
|
|
|
2023-11-09 09:04:08 +00:00
|
|
|
!!! quote ""
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
仅支持 Linux。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
默认为出站连接设置路由标记。
|
|
|
|
|
2023-11-15 17:11:28 +00:00
|
|
|
如果设置了 `outbound.routing_mark` 设置,则不生效。
|