Update documentations

This commit is contained in:
世界 2022-07-23 09:29:37 +08:00
parent 884c0cf595
commit 187de6c738
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
10 changed files with 109 additions and 59 deletions

View file

@ -1,44 +0,0 @@
`dns` inbound is a DNS server.
### Structure
```json
{
"inbounds": [
{
"type": "dns",
"tag": "dns-in",
"listen": "::",
"listen_port": 5353,
"network": "udp"
}
]
}
```
!!! note ""
There are no outbound connections by the DNS inbound, all requests are handled internally.
### Listen Fields
#### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
### DNS Fields
#### network
Listen network, one of `tcp` `udp`.
Both if empty.

View file

@ -23,7 +23,6 @@
| `tun` | [Tun](./tun) | | `tun` | [Tun](./tun) |
| `redirect` | [Redirect](./redirect) | | `redirect` | [Redirect](./redirect) |
| `tproxy` | [TProxy](./tproxy) | | `tproxy` | [TProxy](./tproxy) |
| `dns` | [DNS](./dns) |
#### tag #### tag

View file

@ -15,7 +15,6 @@
"inet6_address": "fdfe:dcba:9876::1/128", "inet6_address": "fdfe:dcba:9876::1/128",
"mtu": 1500, "mtu": 1500,
"auto_route": true, "auto_route": true,
"hijack_dns": true,
"sniff": true, "sniff": true,
"sniff_override_destination": false, "sniff_override_destination": false,
@ -49,10 +48,6 @@ Set the default route to the Tun.
To avoid traffic loopback, set `route.auto_detect_interface` or `route.default_interface` or `outbound.bind_interface` To avoid traffic loopback, set `route.auto_detect_interface` or `route.default_interface` or `outbound.bind_interface`
#### hijack_dns
Hijack TCP/UDP DNS requests to the built-in DNS adapter.
### Listen Fields ### Listen Fields
#### sniff #### sniff

View file

@ -0,0 +1,22 @@
`dns` outbound is a DNS server.
### Structure
```json
{
"outbounds": [
{
"type": "dns",
"tag": "dns-out"
}
]
}
```
!!! note ""
There are no outbound connections by the DNS outbound, all requests are handled internally.
### Fields
No fields.

View file

@ -20,6 +20,7 @@
| `socks` | [Socks](./socks) | | `socks` | [Socks](./socks) |
| `http` | [HTTP](./http) | | `http` | [HTTP](./http) |
| `shadowsocks` | [Shadowsocks](./shadowsocks) | | `shadowsocks` | [Shadowsocks](./shadowsocks) |
| `dns` | [DNS](./dns) |
| `selector` | [Selector](./selector) | | `selector` | [Selector](./selector) |
| `urltest` | [URLTest](./urltest) | | `urltest` | [URLTest](./urltest) |

View file

@ -3,8 +3,9 @@ If enabled in the inbound, the protocol and domain name (if present) of by the c
#### Supported Protocols #### Supported Protocols
| Network | Protocol | Domain Name | | Network | Protocol | Domain Name |
|:---------:|:----------:|:-------------:| |:-------:|:--------:|:-----------:|
| TCP | HTTP | Host | | TCP | HTTP | Host |
| TCP | TLS | Server Name | | TCP | TLS | Server Name |
| UDP | QUIC | Server Name | | UDP | QUIC | Server Name |
| UDP | STUN | / | | UDP | STUN | / |
| TCP/UDP | DNS | / |

View file

@ -0,0 +1,67 @@
# DNS Hijack
#### Sniff Mode
```json
{
"inbounds": [
{
"type": "tun",
"inet4_address": "172.19.0.1/30",
"auto_route": true,
"sniff": true // required
}
],
"outbounds": [
{
"type": "direct"
},
{
"type": "dns",
"tag": "dns-out"
}
],
"route": {
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
}
],
"auto_detect_interface": true
}
}
```
#### Port Mode
```json
{
"inbounds": [
{
"type": "tun",
"inet4_address": "172.19.0.1/30",
"auto_route": true,
"sniff": true // not required
}
],
"outbounds": [
{
"type": "direct"
},
{
"type": "dns",
"tag": "dns-out"
}
],
"route": {
"rules": [
{
"port": 53,
"outbound": "dns-out"
}
],
"auto_detect_interface": true
}
}
```

View file

@ -5,3 +5,4 @@ Configuration examples for sing-box.
* [Shadowsocks Server](./ss-server) * [Shadowsocks Server](./ss-server)
* [Shadowsocks Client](./ss-client) * [Shadowsocks Client](./ss-client)
* [Shadowsocks Tun](./ss-tun) * [Shadowsocks Tun](./ss-tun)
* [DNS Hijack](./dns-hijack.md)

View file

@ -26,7 +26,6 @@
"type": "tun", "type": "tun",
"inet4_address": "172.19.0.1/30", "inet4_address": "172.19.0.1/30",
"auto_route": true, "auto_route": true,
"hijack_dns": true,
"sniff": true "sniff": true
} }
], ],
@ -46,10 +45,18 @@
{ {
"type": "block", "type": "block",
"tag": "block" "tag": "block"
},
{
"type": "dns",
"tag": "dns-out"
} }
], ],
"route": { "route": {
"rules": [ "rules": [
{
"protocol": "dns",
"outbound": "dns-out"
},
{ {
"geosite": "category-ads-all", "geosite": "category-ads-all",
"outbound": "block" "outbound": "block"

View file

@ -48,7 +48,6 @@ nav:
- Tun: configuration/inbound/tun.md - Tun: configuration/inbound/tun.md
- Redirect: configuration/inbound/redirect.md - Redirect: configuration/inbound/redirect.md
- TProxy: configuration/inbound/tproxy.md - TProxy: configuration/inbound/tproxy.md
- DNS: configuration/inbound/dns.md
- Outbound: - Outbound:
- configuration/outbound/index.md - configuration/outbound/index.md
- Direct: configuration/outbound/direct.md - Direct: configuration/outbound/direct.md
@ -56,6 +55,7 @@ nav:
- Socks: configuration/outbound/socks.md - Socks: configuration/outbound/socks.md
- HTTP: configuration/outbound/http.md - HTTP: configuration/outbound/http.md
- Shadowsocks: configuration/outbound/shadowsocks.md - Shadowsocks: configuration/outbound/shadowsocks.md
- DNS: configuration/outbound/dns.md
- Selector: configuration/outbound/selector.md - Selector: configuration/outbound/selector.md
- URLTest: configuration/outbound/urltest.md - URLTest: configuration/outbound/urltest.md
- Route: - Route:
@ -70,6 +70,7 @@ nav:
- Shadowsocks Server: examples/ss-server.md - Shadowsocks Server: examples/ss-server.md
- Shadowsocks Client: examples/ss-client.md - Shadowsocks Client: examples/ss-client.md
- Shadowsocks Tun: examples/ss-tun.md - Shadowsocks Tun: examples/ss-tun.md
- DNS Hijack: examples/dns-hijack.md
- Benchmark: benchmark.md - Benchmark: benchmark.md
markdown_extensions: markdown_extensions:
- pymdownx.inlinehilite - pymdownx.inlinehilite