mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 08:31:30 +00:00
Add route documentation
This commit is contained in:
parent
eeaee94e5e
commit
0cb9d79044
|
@ -23,7 +23,7 @@
|
|||
|
||||
#### final
|
||||
|
||||
Default dns server tag, the first one will be used if it is empty.
|
||||
Default dns server tag. the first server will be used if empty.
|
||||
|
||||
#### strategy
|
||||
|
||||
|
|
35
docs/configuration/route/geoip.md
Normal file
35
docs/configuration/route/geoip.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# geoip
|
||||
|
||||
### Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"route": {
|
||||
"geoip": {
|
||||
"path": "",
|
||||
"download_url": "",
|
||||
"download_detour": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Fields
|
||||
|
||||
#### path
|
||||
|
||||
The path to the sing-geoip database.
|
||||
|
||||
`geoip.db` will be used if empty.
|
||||
|
||||
#### download_url
|
||||
|
||||
The download URL of the sing-geoip database.
|
||||
|
||||
Default is `https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db`.
|
||||
|
||||
#### download_detour
|
||||
|
||||
The ag of the outbound to download the database.
|
||||
|
||||
Default outbound will be used if empty.
|
35
docs/configuration/route/geosite.md
Normal file
35
docs/configuration/route/geosite.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# geosite
|
||||
|
||||
### Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"route": {
|
||||
"geosite": {
|
||||
"path": "",
|
||||
"download_url": "",
|
||||
"download_detour": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Fields
|
||||
|
||||
#### path
|
||||
|
||||
The path to the sing-geosite database.
|
||||
|
||||
`geosite.db` will be used if empty.
|
||||
|
||||
#### download_url
|
||||
|
||||
The download URL of the sing-geoip database.
|
||||
|
||||
Default is `https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db`.
|
||||
|
||||
#### download_detour
|
||||
|
||||
The ag of the outbound to download the database.
|
||||
|
||||
Default outbound will be used if empty.
|
24
docs/configuration/route/index.md
Normal file
24
docs/configuration/route/index.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
### Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"route": {
|
||||
"geoip": {},
|
||||
"geosite": {},
|
||||
"rules": [],
|
||||
"final": ""
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Fields
|
||||
|
||||
| Key | Format |
|
||||
|-----------|------------------------------|
|
||||
| `geoip` | [GeoIP](./geoip) |
|
||||
| `geosite` | [Geosite](./geosite) |
|
||||
| `rules` | List of [Route Rule](./rule) |
|
||||
|
||||
#### final
|
||||
|
||||
Default outbound tag. the first outbound will be used if empty.
|
150
docs/configuration/route/rule.md
Normal file
150
docs/configuration/route/rule.md
Normal file
|
@ -0,0 +1,150 @@
|
|||
### Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"route": {
|
||||
"rules": [
|
||||
{
|
||||
"inbound": [
|
||||
"mixed-in"
|
||||
],
|
||||
"network": "tcp",
|
||||
"protocol": [
|
||||
"tls",
|
||||
"http",
|
||||
"quic"
|
||||
],
|
||||
"domain": [
|
||||
"test.com"
|
||||
],
|
||||
"domain_suffix": [
|
||||
".cn"
|
||||
],
|
||||
"domain_keyword": [
|
||||
"test"
|
||||
],
|
||||
"domain_regex": [
|
||||
"^stun\\..+"
|
||||
],
|
||||
"geosite": [
|
||||
"cn"
|
||||
],
|
||||
"source_geoip": [
|
||||
"private"
|
||||
],
|
||||
"geoip": [
|
||||
"cn"
|
||||
],
|
||||
"source_ip_cidr": [
|
||||
"10.0.0.0/24"
|
||||
],
|
||||
"ip_cidr": [
|
||||
"10.0.0.0/24"
|
||||
],
|
||||
"source_port": [
|
||||
12345
|
||||
],
|
||||
"port": [
|
||||
80,
|
||||
443
|
||||
],
|
||||
"outbound": "direct"
|
||||
},
|
||||
{
|
||||
"type": "logical",
|
||||
"mode": "and",
|
||||
"rules": [],
|
||||
"outbound": "direct"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
!!! note ""
|
||||
|
||||
You can ignore the JSON Array [] tag when the content is only one item
|
||||
|
||||
### Default Fields
|
||||
|
||||
!!! note ""
|
||||
|
||||
The default rule uses the following matching logic:
|
||||
(`domain` || `domain_suffix` || `domain_keyword` || `domain_regex` || `geosite` || `geoip` || `ip_cidr`) &&
|
||||
(`source_geoip` || `source_ip_cidr`) &&
|
||||
`other fields`
|
||||
|
||||
#### inbound
|
||||
|
||||
Tags of [inbound](../inbound).
|
||||
|
||||
#### network
|
||||
|
||||
`tcp` or `udp`.
|
||||
|
||||
#### domain
|
||||
|
||||
Match full domain.
|
||||
|
||||
#### domain_suffix
|
||||
|
||||
Match domain suffix.
|
||||
|
||||
#### domain_keyword
|
||||
|
||||
Match domain using keyword.
|
||||
|
||||
#### domain_regex
|
||||
|
||||
Match domain using regular expression.
|
||||
|
||||
#### geosite
|
||||
|
||||
Match geosite.
|
||||
|
||||
#### source_geoip
|
||||
|
||||
Match source geoip.
|
||||
|
||||
#### geoip
|
||||
|
||||
Match geoip.
|
||||
|
||||
#### source_ip_cidr
|
||||
|
||||
Match source ip cidr.
|
||||
|
||||
#### ip_cidr
|
||||
|
||||
Match ip cidr.
|
||||
|
||||
#### source_port
|
||||
|
||||
Match source port.
|
||||
|
||||
#### port
|
||||
|
||||
Match port.
|
||||
|
||||
#### outbound
|
||||
|
||||
Tag of the target outbound.
|
||||
|
||||
### Logical Fields
|
||||
|
||||
#### type
|
||||
|
||||
`logical`
|
||||
|
||||
#### mode
|
||||
|
||||
`and` or `or`
|
||||
|
||||
#### rules
|
||||
|
||||
Included default rules.
|
||||
|
||||
#### outbound
|
||||
|
||||
Tag of the target outbound.
|
|
@ -50,6 +50,11 @@ nav:
|
|||
- Socks: configuration/outbound/socks.md
|
||||
- HTTP: configuration/outbound/http.md
|
||||
- Shadowsocks: configuration/outbound/shadowsocks.md
|
||||
- Route:
|
||||
- configuration/route/index.md
|
||||
- GeoIP: configuration/route/geoip.md
|
||||
- Geosite: configuration/route/geosite.md
|
||||
- Route Rule: configuration/route/rule.md
|
||||
markdown_extensions:
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
|
|
Loading…
Reference in a new issue