1
0
Эх сурвалжийг харах

Add outbound documentation

世界 3 жил өмнө
parent
commit
eeaee94e5e

+ 1 - 1
docs/configuration/dns/server.md

@@ -49,7 +49,7 @@ The domain strategy for resolving the domain name in the address.
 
 One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
 
-`dns.strategy` will be used if `address_strategy` is empty.
+`dns.strategy` will be used if empty.
 
 #### detour
 

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

@@ -15,10 +15,10 @@
 
 | Type          | Format                       |
 |---------------|------------------------------|
+| `direct`      | [Direct](./direct)           |
 | `mixed`       | [Mixed](./mixed)             |
 | `socks`       | [Socks](./socks)             |
 | `http`        | [HTTP](./http)               |
-| `direct`      | [Direct](./direct)           |
 | `shadowsocks` | [Shadowsocks](./shadowsocks) |
 
 #### tag

+ 2 - 0
docs/configuration/inbound/shadowsocks.md

@@ -101,6 +101,7 @@ Both if empty.
 {
   "inbounds": [
     {
+      "type": "shadowsocks",
       "method": "2022-blake3-aes-128-gcm",
       "password": "8JCsPssfgS8tiRwiMlhARg==",
       "users": [
@@ -120,6 +121,7 @@ Both if empty.
 {
   "inbounds": [
     {
+      "type": "shadowsocks",
       "method": "2022-blake3-aes-128-gcm",
       "password": "8JCsPssfgS8tiRwiMlhARg==",
       "destinations": [

+ 18 - 0
docs/configuration/outbound/block.md

@@ -0,0 +1,18 @@
+`block` outbound closes all incoming requests.
+
+### Structure
+
+```json
+{
+  "outbounds": [
+    {
+      "type": "block",
+      "tag": "block"
+    }
+  ]
+}
+```
+
+### Fields
+
+No fields.

+ 84 - 0
docs/configuration/outbound/direct.md

@@ -0,0 +1,84 @@
+`direct` outbound send requests directly.
+
+### Structure
+
+```json
+{
+  "outbounds": [
+    {
+      "type": "direct",
+      "tag": "direct-out",
+      
+      "override_address": "1.0.0.1",
+      "override_port": 53,
+
+      "detour": "upstream-out",
+      "bind_interface": "en0",
+      "routing_mark": 1234,
+      "reuse_addr": false,
+      "connect_timeout": "5s",
+      "tcp_fast_open": false,
+      "domain_strategy": "prefer_ipv6",
+      "fallback_delay": "300ms"
+    }
+  ]
+}
+```
+
+### Direct Fields
+
+#### override_address
+
+Override the connection destination address.
+
+#### override_port
+
+Override the connection destination port.
+
+### Dial Fields
+
+#### detour
+
+The tag of the upstream outbound.
+
+Other dial fields will be ignored when enabled.
+
+#### bind_interface
+
+The network interface to bind to.
+
+#### routing_mark
+
+The iptables routing mark.
+
+Only available in linux.
+
+#### reuse_addr
+
+Reuse listener address.
+
+#### connect_timeout
+
+Connect timeout, in golang's Duration format.
+
+A duration string is a possibly signed sequence of
+decimal numbers, each with optional fraction and a unit suffix,
+such as "300ms", "-1.5h" or "2h45m".
+Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
+
+#### domain_strategy
+
+One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
+
+If set, the requested domain name will be resolved to IP before routing.
+
+`dns.strategy` will be used if empty.
+
+#### fallback_delay
+
+The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
+That is, is the amount of time to wait for IPv6 to succeed before assuming
+that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
+If zero, a default delay of 300ms is used.
+
+Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

+ 94 - 0
docs/configuration/outbound/http.md

@@ -0,0 +1,94 @@
+`http` outbound is a HTTP Connect client.
+
+### Structure
+
+```json
+{
+  "outbounds": [
+    {
+      "type": "http",
+      "tag": "http-out",
+      
+      "server": "127.0.0.1",
+      "server_port": 1080,
+      "username": "sekai",
+      "password": "admin",
+      
+      "detour": "upstream-out",
+      "bind_interface": "en0",
+      "routing_mark": 1234,
+      "reuse_addr": false,
+      "connect_timeout": "5s",
+      "tcp_fast_open": false,
+      "domain_strategy": "prefer_ipv6",
+      "fallback_delay": "300ms"
+    }
+  ]
+}
+```
+
+### HTTP Fields
+
+#### server
+
+The server address.
+
+#### server_port
+
+The server port.
+
+#### username
+
+Basic authorization username.
+
+#### password
+
+Basic authorization password.
+
+### Dial Fields
+
+#### detour
+
+The tag of the upstream outbound.
+
+Other dial fields will be ignored when enabled.
+
+#### bind_interface
+
+The network interface to bind to.
+
+#### routing_mark
+
+The iptables routing mark.
+
+Only available in linux.
+
+#### reuse_addr
+
+Reuse listener address.
+
+#### connect_timeout
+
+Connect timeout, in golang's Duration format.
+
+A duration string is a possibly signed sequence of
+decimal numbers, each with optional fraction and a unit suffix,
+such as "300ms", "-1.5h" or "2h45m".
+Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
+
+#### domain_strategy
+
+One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
+
+If set, the server domain name will be resolved to IP before connecting.
+
+`dns.strategy` will be used if empty.
+
+#### fallback_delay
+
+The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
+That is, is the amount of time to wait for IPv6 to succeed before assuming
+that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
+If zero, a default delay of 300ms is used.
+
+Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

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

@@ -0,0 +1,26 @@
+### Structure
+
+```json
+{
+  "outbounds": [
+    {
+      "type": "",
+      "tag": ""
+    }
+  ]
+}
+```
+
+### Fields
+
+| Type          | Format                       |
+|---------------|------------------------------|
+| `direct`      | [Direct](./direct)           |
+| `block`       | [Block](./block)             |
+| `socks`       | [Socks](./socks)             |
+| `http`        | [HTTP](./http)               |
+| `shadowsocks` | [Shadowsocks](./shadowsocks) |
+
+#### tag
+
+The tag of the outbound.

+ 125 - 0
docs/configuration/outbound/shadowsocks.md

@@ -0,0 +1,125 @@
+`socks` outbound is a socks4/socks4a/socks5 client.
+
+### Structure
+
+```json
+{
+  "outbounds": [
+    {
+      "type": "shadowsocks",
+      "tag": "ss-out",
+      
+      "server": "127.0.0.1",
+      "server_port": 1080,
+      "method": "2022-blake3-aes-128-gcm",
+      "password": "8JCsPssfgS8tiRwiMlhARg==",
+      "network": "udp",
+      
+      "detour": "upstream-out",
+      "bind_interface": "en0",
+      "routing_mark": 1234,
+      "reuse_addr": false,
+      "connect_timeout": "5s",
+      "tcp_fast_open": false,
+      "domain_strategy": "prefer_ipv6",
+      "fallback_delay": "300ms"
+    }
+  ]
+}
+```
+
+### Shadowsocks Fields
+
+#### server
+
+The server address.
+
+#### server_port
+
+The server port.
+
+#### method
+
+Encryption methods:
+
+* `2022-blake3-aes-128-gcm`
+* `2022-blake3-aes-256-gcm`
+* `2022-blake3-chacha20-poly1305`
+* `none`
+* `aes-128-gcm`
+* `aes-192-gcm`
+* `aes-256-gcm`
+* `chacha20-ietf-poly1305`
+* `xchacha20-ietf-poly1305`
+
+Legacy encryption methods:
+
+* `aes-128-ctr`
+* `aes-192-ctr`
+* `aes-256-ctr`
+* `aes-128-cfb`
+* `aes-192-cfb`
+* `aes-256-cfb`
+* `rc4-md5`
+* `chacha20-ietf`
+* `xchacha20`
+
+#### password
+
+The shadowsocks password.
+
+#### network
+
+Enabled network
+
+One of `tcp` `udp`.
+
+Both is enabled by default.
+
+### Dial Fields
+
+#### detour
+
+The tag of the upstream outbound.
+
+Other dial fields will be ignored when enabled.
+
+#### bind_interface
+
+The network interface to bind to.
+
+#### routing_mark
+
+The iptables routing mark.
+
+Only available in linux.
+
+#### reuse_addr
+
+Reuse listener address.
+
+#### connect_timeout
+
+Connect timeout, in golang's Duration format.
+
+A duration string is a possibly signed sequence of
+decimal numbers, each with optional fraction and a unit suffix,
+such as "300ms", "-1.5h" or "2h45m".
+Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
+
+#### domain_strategy
+
+One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
+
+If set, the server domain name will be resolved to IP before connecting.
+
+`dns.strategy` will be used if empty.
+
+#### fallback_delay
+
+The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
+That is, is the amount of time to wait for IPv6 to succeed before assuming
+that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
+If zero, a default delay of 300ms is used.
+
+Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

+ 110 - 0
docs/configuration/outbound/socks.md

@@ -0,0 +1,110 @@
+`socks` outbound is a socks4/socks4a/socks5 client.
+
+### Structure
+
+```json
+{
+  "outbounds": [
+    {
+      "type": "socks",
+      "tag": "socks-out",
+
+      "server": "127.0.0.1",
+      "server_port": 1080,
+      "version": "5",
+      "username": "sekai",
+      "password": "admin",
+      "network": "udp",
+      
+      "detour": "upstream-out",
+      "bind_interface": "en0",
+      "routing_mark": 1234,
+      "reuse_addr": false,
+      "connect_timeout": "5s",
+      "tcp_fast_open": false,
+      "domain_strategy": "prefer_ipv6",
+      "fallback_delay": "300ms"
+    }
+  ]
+}
+```
+
+### Socks Fields
+
+#### server
+
+The server address.
+
+#### server_port
+
+The server port.
+
+#### version
+
+The Socks version, one of `4` `4a` `5`.
+
+Socks5 used by default.
+
+#### username
+
+Socks username.
+
+#### password
+
+Socks5 password.
+
+#### network
+
+Enabled network
+
+One of `tcp` `udp`.
+
+Both is enabled by default.
+
+### Dial Fields
+
+#### detour
+
+The tag of the upstream outbound.
+
+Other dial fields will be ignored when enabled.
+
+#### bind_interface
+
+The network interface to bind to.
+
+#### routing_mark
+
+The iptables routing mark.
+
+Only available in linux.
+
+#### reuse_addr
+
+Reuse listener address.
+
+#### connect_timeout
+
+Connect timeout, in golang's Duration format.
+
+A duration string is a possibly signed sequence of
+decimal numbers, each with optional fraction and a unit suffix,
+such as "300ms", "-1.5h" or "2h45m".
+Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
+
+#### domain_strategy
+
+One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
+
+If set, the server domain name will be resolved to IP before connecting.
+
+`dns.strategy` will be used if empty.
+
+#### fallback_delay
+
+The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
+That is, is the amount of time to wait for IPv6 to succeed before assuming
+that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
+If zero, a default delay of 300ms is used.
+
+Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

+ 1 - 1
docs/index.md

@@ -9,7 +9,7 @@ The universal proxy platform.
 sing-box requires Golang 1.18 or a higher version.
 
 ```bash
-$ go install github.com/sagernet/sing-box@latest
+$ go install github.com/sagernet/sing-box/cmd/sing-box@latest
 ```
 
 The binary is built under $GOPATH/bin

+ 15 - 5
mkdocs.yml

@@ -38,24 +38,34 @@ nav:
           - DNS Rule: configuration/dns/rule.md
       - Inbound:
           - configuration/inbound/index.md
+          - Direct: configuration/inbound/direct.md
           - Mixed: configuration/inbound/mixed.md
           - Socks: configuration/inbound/socks.md
           - HTTP: configuration/inbound/http.md
-          - Direct: configuration/inbound/direct.md
           - Shadowsocks: configuration/inbound/shadowsocks.md
+      - Outbound:
+          - configuration/outbound/index.md
+          - Direct: configuration/outbound/direct.md
+          - Block: configuration/outbound/block.md
+          - Socks: configuration/outbound/socks.md
+          - HTTP: configuration/outbound/http.md
+          - Shadowsocks: configuration/outbound/shadowsocks.md
 markdown_extensions:
-  - pymdownx.highlight:
-      anchor_linenums: true
   - pymdownx.inlinehilite
   - pymdownx.snippets
   - pymdownx.superfences
-  - pymdownx.tabbed:
-      alternate_style: true
   - admonition
   - pymdownx.details
   - attr_list
   - md_in_html
   - footnotes
+  - def_list
+  - pymdownx.highlight:
+      anchor_linenums: true
+  - pymdownx.tabbed:
+      alternate_style: true
+  - pymdownx.tasklist:
+      custom_checkbox: true
 extra:
   social:
     - icon: fontawesome/brands/github