mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-07-23 06:24:08 +08:00
documentation: Update client configuration manual
This commit is contained in:
parent
50eadb00c7
commit
80f8ea6849
@ -94,18 +94,13 @@ flowchart TB
|
|||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"tag": "google",
|
"tag": "google",
|
||||||
"address": "tls://8.8.8.8"
|
"type": "tls",
|
||||||
|
"server": "8.8.8.8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "local",
|
"tag": "local",
|
||||||
"address": "223.5.5.5",
|
"type": "udp",
|
||||||
"detour": "direct"
|
"server": "223.5.5.5"
|
||||||
}
|
|
||||||
],
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"outbound": "any",
|
|
||||||
"server": "local"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"strategy": "ipv4_only"
|
"strategy": "ipv4_only"
|
||||||
@ -115,7 +110,8 @@ flowchart TB
|
|||||||
"type": "tun",
|
"type": "tun",
|
||||||
"inet4_address": "172.19.0.1/30",
|
"inet4_address": "172.19.0.1/30",
|
||||||
"auto_route": true,
|
"auto_route": true,
|
||||||
"strict_route": false
|
// "auto_redirect": true, // On linux
|
||||||
|
"strict_route": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outbounds": [
|
"outbounds": [
|
||||||
@ -123,25 +119,23 @@ flowchart TB
|
|||||||
{
|
{
|
||||||
"type": "direct",
|
"type": "direct",
|
||||||
"tag": "direct"
|
"tag": "direct"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "dns",
|
|
||||||
"tag": "dns-out"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"route": {
|
"route": {
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"protocol": "dns",
|
"action": "sniff"
|
||||||
"outbound": "dns-out"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"geoip": [
|
"protocol": "dns",
|
||||||
"private"
|
"action": "hijack-dns"
|
||||||
],
|
},
|
||||||
|
{
|
||||||
|
"ip_is_private": true,
|
||||||
"outbound": "direct"
|
"outbound": "direct"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"default_domain_resolver": "local",
|
||||||
"auto_detect_interface": true
|
"auto_detect_interface": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,18 +149,13 @@ flowchart TB
|
|||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"tag": "google",
|
"tag": "google",
|
||||||
"address": "tls://8.8.8.8"
|
"type": "tls",
|
||||||
|
"server": "8.8.8.8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "local",
|
"tag": "local",
|
||||||
"address": "223.5.5.5",
|
"type": "udp",
|
||||||
"detour": "direct"
|
"server": "223.5.5.5"
|
||||||
}
|
|
||||||
],
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"outbound": "any",
|
|
||||||
"server": "local"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -176,7 +165,8 @@ flowchart TB
|
|||||||
"inet4_address": "172.19.0.1/30",
|
"inet4_address": "172.19.0.1/30",
|
||||||
"inet6_address": "fdfe:dcba:9876::1/126",
|
"inet6_address": "fdfe:dcba:9876::1/126",
|
||||||
"auto_route": true,
|
"auto_route": true,
|
||||||
"strict_route": false
|
// "auto_redirect": true, // On linux
|
||||||
|
"strict_route": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outbounds": [
|
"outbounds": [
|
||||||
@ -184,25 +174,23 @@ flowchart TB
|
|||||||
{
|
{
|
||||||
"type": "direct",
|
"type": "direct",
|
||||||
"tag": "direct"
|
"tag": "direct"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "dns",
|
|
||||||
"tag": "dns-out"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"route": {
|
"route": {
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"protocol": "dns",
|
"action": "sniff"
|
||||||
"outbound": "dns-out"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"geoip": [
|
"protocol": "dns",
|
||||||
"private"
|
"action": "hijack-dns"
|
||||||
],
|
},
|
||||||
|
{
|
||||||
|
"ip_is_private": true,
|
||||||
"outbound": "direct"
|
"outbound": "direct"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"default_domain_resolver": "local",
|
||||||
"auto_detect_interface": true
|
"auto_detect_interface": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,23 +204,22 @@ flowchart TB
|
|||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"tag": "google",
|
"tag": "google",
|
||||||
"address": "tls://8.8.8.8"
|
"type": "tls",
|
||||||
|
"server": "8.8.8.8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "local",
|
"tag": "local",
|
||||||
"address": "223.5.5.5",
|
"type": "udp",
|
||||||
"detour": "direct"
|
"server": "223.5.5.5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "remote",
|
"tag": "remote",
|
||||||
"address": "fakeip"
|
"type": "fakeip",
|
||||||
|
"inet4_range": "198.18.0.0/15",
|
||||||
|
"inet6_range": "fc00::/18"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
|
||||||
"outbound": "any",
|
|
||||||
"server": "local"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"query_type": [
|
"query_type": [
|
||||||
"A",
|
"A",
|
||||||
@ -241,11 +228,6 @@ flowchart TB
|
|||||||
"server": "remote"
|
"server": "remote"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fakeip": {
|
|
||||||
"enabled": true,
|
|
||||||
"inet4_range": "198.18.0.0/15",
|
|
||||||
"inet6_range": "fc00::/18"
|
|
||||||
},
|
|
||||||
"independent_cache": true
|
"independent_cache": true
|
||||||
},
|
},
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
@ -254,6 +236,7 @@ flowchart TB
|
|||||||
"inet4_address": "172.19.0.1/30",
|
"inet4_address": "172.19.0.1/30",
|
||||||
"inet6_address": "fdfe:dcba:9876::1/126",
|
"inet6_address": "fdfe:dcba:9876::1/126",
|
||||||
"auto_route": true,
|
"auto_route": true,
|
||||||
|
// "auto_redirect": true, // On linux
|
||||||
"strict_route": true
|
"strict_route": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -262,25 +245,23 @@ flowchart TB
|
|||||||
{
|
{
|
||||||
"type": "direct",
|
"type": "direct",
|
||||||
"tag": "direct"
|
"tag": "direct"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "dns",
|
|
||||||
"tag": "dns-out"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"route": {
|
"route": {
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"protocol": "dns",
|
"action": "sniff"
|
||||||
"outbound": "dns-out"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"geoip": [
|
"protocol": "dns",
|
||||||
"private"
|
"action": "hijack-dns"
|
||||||
],
|
},
|
||||||
|
{
|
||||||
|
"ip_is_private": true,
|
||||||
"outbound": "direct"
|
"outbound": "direct"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"default_domain_resolver": "local",
|
||||||
"auto_detect_interface": true
|
"auto_detect_interface": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,54 +271,6 @@ flowchart TB
|
|||||||
|
|
||||||
=== ":material-dns: DNS rules"
|
=== ":material-dns: DNS rules"
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"dns": {
|
|
||||||
"servers": [
|
|
||||||
{
|
|
||||||
"tag": "google",
|
|
||||||
"address": "tls://8.8.8.8"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tag": "local",
|
|
||||||
"address": "223.5.5.5",
|
|
||||||
"detour": "direct"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"outbound": "any",
|
|
||||||
"server": "local"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"clash_mode": "Direct",
|
|
||||||
"server": "local"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"clash_mode": "Global",
|
|
||||||
"server": "google"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule_set": "geosite-geolocation-cn",
|
|
||||||
"server": "local"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"route": {
|
|
||||||
"rule_set": [
|
|
||||||
{
|
|
||||||
"type": "remote",
|
|
||||||
"tag": "geosite-geolocation-cn",
|
|
||||||
"format": "binary",
|
|
||||||
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-cn.srs"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
=== ":material-dns: DNS rules (Enhanced, but slower) (1.9.0+)"
|
|
||||||
|
|
||||||
=== ":material-shield-off: With DNS leaks"
|
=== ":material-shield-off: With DNS leaks"
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -346,35 +279,20 @@ flowchart TB
|
|||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"tag": "google",
|
"tag": "google",
|
||||||
"address": "tls://8.8.8.8"
|
"type": "tls",
|
||||||
|
"server": "8.8.8.8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "local",
|
"tag": "local",
|
||||||
"address": "https://223.5.5.5/dns-query",
|
"type": "https",
|
||||||
"detour": "direct"
|
"server": "223.5.5.5"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
|
||||||
"outbound": "any",
|
|
||||||
"server": "local"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"clash_mode": "Direct",
|
|
||||||
"server": "local"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"clash_mode": "Global",
|
|
||||||
"server": "google"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"rule_set": "geosite-geolocation-cn",
|
"rule_set": "geosite-geolocation-cn",
|
||||||
"server": "local"
|
"server": "local"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"clash_mode": "Default",
|
|
||||||
"server": "google"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "logical",
|
"type": "logical",
|
||||||
"mode": "and",
|
"mode": "and",
|
||||||
@ -392,6 +310,7 @@ flowchart TB
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"route": {
|
"route": {
|
||||||
|
"default_domain_resolver": "local",
|
||||||
"rule_set": [
|
"rule_set": [
|
||||||
{
|
{
|
||||||
"type": "remote",
|
"type": "remote",
|
||||||
@ -425,35 +344,24 @@ flowchart TB
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
=== ":material-security: Without DNS leaks, but slower (1.9.0-alpha.2+)"
|
=== ":material-security: Without DNS leaks, but slower"
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"dns": {
|
"dns": {
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"tag": "google",
|
"tag": "google",
|
||||||
"address": "tls://8.8.8.8"
|
"type": "tls",
|
||||||
|
"server": "8.8.8.8"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "local",
|
"tag": "local",
|
||||||
"address": "https://223.5.5.5/dns-query",
|
"type": "https",
|
||||||
"detour": "direct"
|
"server": "223.5.5.5"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
|
||||||
"outbound": "any",
|
|
||||||
"server": "local"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"clash_mode": "Direct",
|
|
||||||
"server": "local"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"clash_mode": "Global",
|
|
||||||
"server": "google"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"rule_set": "geosite-geolocation-cn",
|
"rule_set": "geosite-geolocation-cn",
|
||||||
"server": "local"
|
"server": "local"
|
||||||
@ -476,6 +384,7 @@ flowchart TB
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"route": {
|
"route": {
|
||||||
|
"default_domain_resolver": "local",
|
||||||
"rule_set": [
|
"rule_set": [
|
||||||
{
|
{
|
||||||
"type": "remote",
|
"type": "remote",
|
||||||
@ -517,14 +426,13 @@ flowchart TB
|
|||||||
{
|
{
|
||||||
"type": "direct",
|
"type": "direct",
|
||||||
"tag": "direct"
|
"tag": "direct"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "block",
|
|
||||||
"tag": "block"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"route": {
|
"route": {
|
||||||
"rules": [
|
"rules": [
|
||||||
|
{
|
||||||
|
"action": "sniff"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "logical",
|
"type": "logical",
|
||||||
"mode": "or",
|
"mode": "or",
|
||||||
@ -536,20 +444,12 @@ flowchart TB
|
|||||||
"port": 53
|
"port": 53
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outbound": "dns"
|
"action": "hijack-dns"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ip_is_private": true,
|
"ip_is_private": true,
|
||||||
"outbound": "direct"
|
"outbound": "direct"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"clash_mode": "Direct",
|
|
||||||
"outbound": "direct"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"clash_mode": "Global",
|
|
||||||
"outbound": "default"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "logical",
|
"type": "logical",
|
||||||
"mode": "or",
|
"mode": "or",
|
||||||
@ -565,12 +465,23 @@ flowchart TB
|
|||||||
"protocol": "stun"
|
"protocol": "stun"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outbound": "block"
|
"action": "reject"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"rule_set": [
|
"rule_set": "geosite-geolocation-cn",
|
||||||
"geoip-cn",
|
"outbound": "direct"
|
||||||
"geosite-geolocation-cn"
|
},
|
||||||
|
{
|
||||||
|
"type": "logical",
|
||||||
|
"mode": "and",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"rule_set": "geoip-cn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule_set": "geosite-geolocation-!cn",
|
||||||
|
"invert": true
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"outbound": "direct"
|
"outbound": "direct"
|
||||||
}
|
}
|
||||||
@ -591,4 +502,4 @@ flowchart TB
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user