mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 10:01:30 +00:00
Add outbound documentation
This commit is contained in:
parent
ddbdac7d97
commit
eeaee94e5e
|
@ -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`.
|
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
|
#### detour
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
|
|
||||||
| Type | Format |
|
| Type | Format |
|
||||||
|---------------|------------------------------|
|
|---------------|------------------------------|
|
||||||
|
| `direct` | [Direct](./direct) |
|
||||||
| `mixed` | [Mixed](./mixed) |
|
| `mixed` | [Mixed](./mixed) |
|
||||||
| `socks` | [Socks](./socks) |
|
| `socks` | [Socks](./socks) |
|
||||||
| `http` | [HTTP](./http) |
|
| `http` | [HTTP](./http) |
|
||||||
| `direct` | [Direct](./direct) |
|
|
||||||
| `shadowsocks` | [Shadowsocks](./shadowsocks) |
|
| `shadowsocks` | [Shadowsocks](./shadowsocks) |
|
||||||
|
|
||||||
#### tag
|
#### tag
|
||||||
|
|
|
@ -101,6 +101,7 @@ Both if empty.
|
||||||
{
|
{
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
{
|
{
|
||||||
|
"type": "shadowsocks",
|
||||||
"method": "2022-blake3-aes-128-gcm",
|
"method": "2022-blake3-aes-128-gcm",
|
||||||
"password": "8JCsPssfgS8tiRwiMlhARg==",
|
"password": "8JCsPssfgS8tiRwiMlhARg==",
|
||||||
"users": [
|
"users": [
|
||||||
|
@ -120,6 +121,7 @@ Both if empty.
|
||||||
{
|
{
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
{
|
{
|
||||||
|
"type": "shadowsocks",
|
||||||
"method": "2022-blake3-aes-128-gcm",
|
"method": "2022-blake3-aes-128-gcm",
|
||||||
"password": "8JCsPssfgS8tiRwiMlhARg==",
|
"password": "8JCsPssfgS8tiRwiMlhARg==",
|
||||||
"destinations": [
|
"destinations": [
|
||||||
|
|
18
docs/configuration/outbound/block.md
Normal file
18
docs/configuration/outbound/block.md
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
`block` outbound closes all incoming requests.
|
||||||
|
|
||||||
|
### Structure
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"type": "block",
|
||||||
|
"tag": "block"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fields
|
||||||
|
|
||||||
|
No fields.
|
84
docs/configuration/outbound/direct.md
Normal file
84
docs/configuration/outbound/direct.md
Normal file
|
@ -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
docs/configuration/outbound/http.md
Normal file
94
docs/configuration/outbound/http.md
Normal file
|
@ -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
docs/configuration/outbound/index.md
Normal file
26
docs/configuration/outbound/index.md
Normal file
|
@ -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
docs/configuration/outbound/shadowsocks.md
Normal file
125
docs/configuration/outbound/shadowsocks.md
Normal file
|
@ -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
docs/configuration/outbound/socks.md
Normal file
110
docs/configuration/outbound/socks.md
Normal file
|
@ -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`.
|
|
@ -9,7 +9,7 @@ The universal proxy platform.
|
||||||
sing-box requires Golang 1.18 or a higher version.
|
sing-box requires Golang 1.18 or a higher version.
|
||||||
|
|
||||||
```bash
|
```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
|
The binary is built under $GOPATH/bin
|
||||||
|
|
20
mkdocs.yml
20
mkdocs.yml
|
@ -38,24 +38,34 @@ nav:
|
||||||
- DNS Rule: configuration/dns/rule.md
|
- DNS Rule: configuration/dns/rule.md
|
||||||
- Inbound:
|
- Inbound:
|
||||||
- configuration/inbound/index.md
|
- configuration/inbound/index.md
|
||||||
|
- Direct: configuration/inbound/direct.md
|
||||||
- Mixed: configuration/inbound/mixed.md
|
- Mixed: configuration/inbound/mixed.md
|
||||||
- Socks: configuration/inbound/socks.md
|
- Socks: configuration/inbound/socks.md
|
||||||
- HTTP: configuration/inbound/http.md
|
- HTTP: configuration/inbound/http.md
|
||||||
- Direct: configuration/inbound/direct.md
|
|
||||||
- Shadowsocks: configuration/inbound/shadowsocks.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:
|
markdown_extensions:
|
||||||
- pymdownx.highlight:
|
|
||||||
anchor_linenums: true
|
|
||||||
- pymdownx.inlinehilite
|
- pymdownx.inlinehilite
|
||||||
- pymdownx.snippets
|
- pymdownx.snippets
|
||||||
- pymdownx.superfences
|
- pymdownx.superfences
|
||||||
- pymdownx.tabbed:
|
|
||||||
alternate_style: true
|
|
||||||
- admonition
|
- admonition
|
||||||
- pymdownx.details
|
- pymdownx.details
|
||||||
- attr_list
|
- attr_list
|
||||||
- md_in_html
|
- md_in_html
|
||||||
- footnotes
|
- footnotes
|
||||||
|
- def_list
|
||||||
|
- pymdownx.highlight:
|
||||||
|
anchor_linenums: true
|
||||||
|
- pymdownx.tabbed:
|
||||||
|
alternate_style: true
|
||||||
|
- pymdownx.tasklist:
|
||||||
|
custom_checkbox: true
|
||||||
extra:
|
extra:
|
||||||
social:
|
social:
|
||||||
- icon: fontawesome/brands/github
|
- icon: fontawesome/brands/github
|
||||||
|
|
Loading…
Reference in a new issue