Add route documentation

This commit is contained in:
世界 2022-07-08 20:15:45 +08:00
parent eeaee94e5e
commit 0cb9d79044
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
6 changed files with 250 additions and 1 deletions

View File

@ -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

View 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.

View 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.

View 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.

View 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.

View File

@ -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