浏览代码

Update documentations

世界 3 年之前
父节点
当前提交
187de6c738

+ 0 - 44
docs/configuration/inbound/dns.md

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

+ 0 - 1
docs/configuration/inbound/index.md

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

+ 0 - 5
docs/configuration/inbound/tun.md

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

+ 22 - 0
docs/configuration/outbound/dns.md

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

+ 1 - 0
docs/configuration/outbound/index.md

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

+ 7 - 6
docs/configuration/route/sniff.md

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

+ 67 - 0
docs/examples/dns-hijack.md

@@ -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
+  }
+}
+```

+ 2 - 1
docs/examples/index.md

@@ -4,4 +4,5 @@ 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)

+ 8 - 1
docs/examples/ss-tun.md

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

+ 2 - 1
mkdocs.yml

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