From eeaee94e5e354a2696ff3366653f33b7e1a06f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 8 Jul 2022 18:48:43 +0800 Subject: [PATCH] Add outbound documentation --- docs/configuration/dns/server.md | 2 +- docs/configuration/inbound/index.md | 2 +- docs/configuration/inbound/shadowsocks.md | 2 + docs/configuration/outbound/block.md | 18 +++ docs/configuration/outbound/direct.md | 84 ++++++++++++++ docs/configuration/outbound/http.md | 94 ++++++++++++++++ docs/configuration/outbound/index.md | 26 +++++ docs/configuration/outbound/shadowsocks.md | 125 +++++++++++++++++++++ docs/configuration/outbound/socks.md | 110 ++++++++++++++++++ docs/index.md | 2 +- mkdocs.yml | 20 +++- 11 files changed, 477 insertions(+), 8 deletions(-) create mode 100644 docs/configuration/outbound/block.md create mode 100644 docs/configuration/outbound/direct.md create mode 100644 docs/configuration/outbound/http.md create mode 100644 docs/configuration/outbound/index.md create mode 100644 docs/configuration/outbound/shadowsocks.md create mode 100644 docs/configuration/outbound/socks.md diff --git a/docs/configuration/dns/server.md b/docs/configuration/dns/server.md index 2f8fe2ca..31cf02c3 100644 --- a/docs/configuration/dns/server.md +++ b/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 diff --git a/docs/configuration/inbound/index.md b/docs/configuration/inbound/index.md index 1427f7c1..b2c1d6bb 100644 --- a/docs/configuration/inbound/index.md +++ b/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 diff --git a/docs/configuration/inbound/shadowsocks.md b/docs/configuration/inbound/shadowsocks.md index 1e75ebc6..f8cbf463 100644 --- a/docs/configuration/inbound/shadowsocks.md +++ b/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": [ diff --git a/docs/configuration/outbound/block.md b/docs/configuration/outbound/block.md new file mode 100644 index 00000000..77ae5351 --- /dev/null +++ b/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. \ No newline at end of file diff --git a/docs/configuration/outbound/direct.md b/docs/configuration/outbound/direct.md new file mode 100644 index 00000000..3c371c7a --- /dev/null +++ b/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`. \ No newline at end of file diff --git a/docs/configuration/outbound/http.md b/docs/configuration/outbound/http.md new file mode 100644 index 00000000..13fb06c4 --- /dev/null +++ b/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`. \ No newline at end of file diff --git a/docs/configuration/outbound/index.md b/docs/configuration/outbound/index.md new file mode 100644 index 00000000..0b915450 --- /dev/null +++ b/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. \ No newline at end of file diff --git a/docs/configuration/outbound/shadowsocks.md b/docs/configuration/outbound/shadowsocks.md new file mode 100644 index 00000000..06df08fd --- /dev/null +++ b/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`. \ No newline at end of file diff --git a/docs/configuration/outbound/socks.md b/docs/configuration/outbound/socks.md new file mode 100644 index 00000000..8a30d9d4 --- /dev/null +++ b/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`. diff --git a/docs/index.md b/docs/index.md index 655c2dd7..0003e36a 100644 --- a/docs/index.md +++ b/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 diff --git a/mkdocs.yml b/mkdocs.yml index 3ada803a..29f71eaa 100644 --- a/mkdocs.yml +++ b/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