196 lines
4.7 KiB
Markdown
196 lines
4.7 KiB
Markdown
---
|
||
icon: material/alert-decagram
|
||
---
|
||
|
||
# 路由
|
||
|
||
!!! quote "sing-box 1.14.0 中的更改"
|
||
|
||
:material-plus: [default_http_client](#default_http_client)
|
||
:material-plus: [find_neighbor](#find_neighbor)
|
||
:material-plus: [dhcp_lease_files](#dhcp_lease_files)
|
||
|
||
!!! quote "sing-box 1.12.0 中的更改"
|
||
|
||
:material-plus: [default_domain_resolver](#default_domain_resolver)
|
||
:material-note-remove: [geoip](#geoip)
|
||
:material-note-remove: [geosite](#geosite)
|
||
|
||
!!! quote "sing-box 1.11.0 中的更改"
|
||
|
||
: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-plus: [default_fallback_delay](#default_fallback_delay)
|
||
|
||
!!! quote "sing-box 1.8.0 中的更改"
|
||
|
||
:material-plus: [rule_set](#rule_set)
|
||
:material-delete-clock: [geoip](#geoip)
|
||
:material-delete-clock: [geosite](#geosite)
|
||
|
||
### 结构
|
||
|
||
```json
|
||
{
|
||
"route": {
|
||
"geoip": {},
|
||
"geosite": {},
|
||
"rules": [],
|
||
"rule_set": [],
|
||
"final": "",
|
||
"auto_detect_interface": false,
|
||
"override_android_vpn": false,
|
||
"default_interface": "",
|
||
"default_mark": 0,
|
||
"find_process": false,
|
||
"find_neighbor": false,
|
||
"dhcp_lease_files": [],
|
||
"default_http_client": "",
|
||
"default_network_strategy": "",
|
||
"default_fallback_delay": ""
|
||
}
|
||
}
|
||
```
|
||
|
||
!!! note ""
|
||
|
||
当内容只有一项时,可以忽略 JSON 数组 [] 标签
|
||
|
||
### 字段
|
||
|
||
| 键 | 格式 |
|
||
|-----------|-----------------------|
|
||
| `geoip` | [GeoIP](./geoip/) |
|
||
| `geosite` | [Geosite](./geosite/) |
|
||
|
||
#### rule
|
||
|
||
一组 [路由规则](./rule/) 。
|
||
|
||
#### rule_set
|
||
|
||
!!! question "自 sing-box 1.8.0 起"
|
||
|
||
一组 [规则集](/zh/configuration/rule-set/)。
|
||
|
||
#### final
|
||
|
||
默认出站标签。如果为空,将使用第一个可用于对应协议的出站。
|
||
|
||
#### auto_detect_interface
|
||
|
||
!!! quote ""
|
||
|
||
仅支持 Linux、Windows 和 macOS。
|
||
|
||
默认将出站连接绑定到默认网卡,以防止在 tun 下出现路由环路。
|
||
|
||
如果设置了 `outbound.bind_interface` 设置,则不生效。
|
||
|
||
#### override_android_vpn
|
||
|
||
!!! quote ""
|
||
|
||
仅支持 Android。
|
||
|
||
启用 `auto_detect_interface` 时接受 Android VPN 作为上游网卡。
|
||
|
||
#### default_interface
|
||
|
||
!!! quote ""
|
||
|
||
仅支持 Linux、Windows 和 macOS。
|
||
|
||
默认将出站连接绑定到指定网卡,以防止在 tun 下出现路由环路。
|
||
|
||
如果设置了 `auto_detect_interface` 设置,则不生效。
|
||
|
||
#### default_mark
|
||
|
||
!!! quote ""
|
||
|
||
仅支持 Linux。
|
||
|
||
默认为出站连接设置路由标记。
|
||
|
||
如果设置了 `outbound.routing_mark` 设置,则不生效。
|
||
|
||
#### find_process
|
||
|
||
!!! quote ""
|
||
|
||
仅支持 Linux、Windows 和 macOS。
|
||
|
||
在没有 `process_name`、`process_path`、`package_name`、`user` 或 `user_id` 规则时启用进程搜索以输出日志。
|
||
|
||
#### find_neighbor
|
||
|
||
!!! question "自 sing-box 1.14.0 起"
|
||
|
||
!!! quote ""
|
||
|
||
仅支持 Linux 和 macOS。
|
||
|
||
在没有 `source_mac_address` 或 `source_hostname` 规则时启用邻居解析以输出日志。
|
||
|
||
参阅 [邻居解析](/configuration/shared/neighbor/) 了解设置方法。
|
||
|
||
#### dhcp_lease_files
|
||
|
||
!!! question "自 sing-box 1.14.0 起"
|
||
|
||
!!! quote ""
|
||
|
||
仅支持 Linux 和 macOS。
|
||
|
||
用于主机名和 MAC 地址解析的自定义 DHCP 租约文件路径。
|
||
|
||
为空时自动从常见 DHCP 服务器(dnsmasq、odhcpd、ISC dhcpd、Kea)检测。
|
||
|
||
#### default_http_client
|
||
|
||
!!! question "自 sing-box 1.14.0 起"
|
||
|
||
远程规则集使用的默认 [HTTP 客户端](/zh/configuration/shared/http-client/) 的标签。
|
||
|
||
如果为空且 `http_clients` 已定义,将使用第一个 HTTP 客户端。
|
||
|
||
#### default_domain_resolver
|
||
|
||
!!! question "自 sing-box 1.12.0 起"
|
||
|
||
详情参阅 [拨号字段](/zh/configuration/shared/dial/#domain_resolver)。
|
||
|
||
可以被 `outbound.domain_resolver` 覆盖。
|
||
|
||
#### network_strategy
|
||
|
||
!!! question "自 sing-box 1.11.0 起"
|
||
|
||
详情参阅 [拨号字段](/zh/configuration/shared/dial/#network_strategy)。
|
||
|
||
当 `outbound.bind_interface`, `outbound.inet4_bind_address` 或 `outbound.inet6_bind_address` 已设置时不生效。
|
||
|
||
可以被 `outbound.network_strategy` 覆盖。
|
||
|
||
与 `default_interface` 冲突。
|
||
|
||
#### default_network_type
|
||
|
||
!!! question "自 sing-box 1.11.0 起"
|
||
|
||
详情参阅 [拨号字段](/zh/configuration/shared/dial/#default_network_type)。
|
||
|
||
#### default_fallback_network_type
|
||
|
||
!!! question "自 sing-box 1.11.0 起"
|
||
|
||
详情参阅 [拨号字段](/zh/configuration/shared/dial/#default_fallback_network_type)。
|
||
|
||
#### default_fallback_delay
|
||
|
||
!!! question "自 sing-box 1.11.0 起"
|
||
|
||
详情参阅 [拨号字段](/zh/configuration/shared/dial/#fallback_delay)。
|