mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 10:01:30 +00:00
Update documentation
This commit is contained in:
parent
4067e0f25c
commit
55d9a0ef2f
3
docs/changelog.md
Normal file
3
docs/changelog.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#### 2022/08/08
|
||||||
|
|
||||||
|
No changelog before.
|
|
@ -21,6 +21,7 @@
|
||||||
| `http` | [HTTP](./http) |
|
| `http` | [HTTP](./http) |
|
||||||
| `shadowsocks` | [Shadowsocks](./shadowsocks) |
|
| `shadowsocks` | [Shadowsocks](./shadowsocks) |
|
||||||
| `vmess` | [VMess](./vmess) |
|
| `vmess` | [VMess](./vmess) |
|
||||||
|
| `trojan` | [Trojan](./trojan) |
|
||||||
| `tun` | [Tun](./tun) |
|
| `tun` | [Tun](./tun) |
|
||||||
| `redirect` | [Redirect](./redirect) |
|
| `redirect` | [Redirect](./redirect) |
|
||||||
| `tproxy` | [TProxy](./tproxy) |
|
| `tproxy` | [TProxy](./tproxy) |
|
||||||
|
|
75
docs/configuration/inbound/trojan.md
Normal file
75
docs/configuration/inbound/trojan.md
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
### Structure
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"type": "trojan",
|
||||||
|
"tag": "trojan-in",
|
||||||
|
|
||||||
|
"listen": "::",
|
||||||
|
"listen_port": 2080,
|
||||||
|
"tcp_fast_open": false,
|
||||||
|
"sniff": false,
|
||||||
|
"sniff_override_destination": false,
|
||||||
|
"domain_strategy": "prefer_ipv6",
|
||||||
|
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"name": "sekai",
|
||||||
|
"password": "8JCsPssfgS8tiRwiMlhARg=="
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tls": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Listen Fields
|
||||||
|
|
||||||
|
#### listen
|
||||||
|
|
||||||
|
==Required==
|
||||||
|
|
||||||
|
Listen address.
|
||||||
|
|
||||||
|
#### listen_port
|
||||||
|
|
||||||
|
==Required==
|
||||||
|
|
||||||
|
Listen port.
|
||||||
|
|
||||||
|
#### tcp_fast_open
|
||||||
|
|
||||||
|
Enable tcp fast open for listener.
|
||||||
|
|
||||||
|
#### sniff
|
||||||
|
|
||||||
|
Enable sniffing.
|
||||||
|
|
||||||
|
See [Sniff](/configuration/route/sniff/) for details.
|
||||||
|
|
||||||
|
#### sniff_override_destination
|
||||||
|
|
||||||
|
Override the connection destination address with the sniffed domain.
|
||||||
|
|
||||||
|
If the domain name is invalid (like tor), this will not work.
|
||||||
|
|
||||||
|
#### 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.
|
||||||
|
|
||||||
|
If `sniff_override_destination` is in effect, its value will be taken as a fallback.
|
||||||
|
|
||||||
|
### Trojan Fields
|
||||||
|
|
||||||
|
#### users
|
||||||
|
|
||||||
|
Trojan users.
|
||||||
|
|
||||||
|
#### tls
|
||||||
|
|
||||||
|
TLS configuration, see [TLS inbound structure](/configuration/shared/tls/#inbound-structure).
|
|
@ -10,13 +10,15 @@
|
||||||
{
|
{
|
||||||
"type": "tun",
|
"type": "tun",
|
||||||
"tag": "tun-in",
|
"tag": "tun-in",
|
||||||
|
|
||||||
|
"interface_name": "tun0",
|
||||||
"inet4_address": "172.19.0.1/30",
|
"inet4_address": "172.19.0.1/30",
|
||||||
"inet6_address": "fdfe:dcba:9876::1/128",
|
"inet6_address": "fdfe:dcba:9876::1/128",
|
||||||
"mtu": 1500,
|
"mtu": 1500,
|
||||||
"auto_route": true,
|
"auto_route": true,
|
||||||
"endpoint_independent_nat": false,
|
"endpoint_independent_nat": false,
|
||||||
"udp_timeout": 300,
|
"udp_timeout": 300,
|
||||||
|
"stack": "gvisor",
|
||||||
|
|
||||||
"sniff": true,
|
"sniff": true,
|
||||||
"sniff_override_destination": false,
|
"sniff_override_destination": false,
|
||||||
|
@ -26,8 +28,16 @@
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! warning ""
|
||||||
|
|
||||||
|
If tun is running in non-privileged mode, the address and MTU will not be configured automatically, please make sure the settings are accurate.
|
||||||
|
|
||||||
### Tun Fields
|
### Tun Fields
|
||||||
|
|
||||||
|
#### interface_name
|
||||||
|
|
||||||
|
Virtual device name, automatically selected if empty.
|
||||||
|
|
||||||
#### inet4_address
|
#### inet4_address
|
||||||
|
|
||||||
==Required==
|
==Required==
|
||||||
|
@ -60,6 +70,19 @@ Performance may degrade slightly, so it is not recommended to enable on when it
|
||||||
|
|
||||||
UDP NAT expiration time in seconds, default is 300 (5 minutes).
|
UDP NAT expiration time in seconds, default is 300 (5 minutes).
|
||||||
|
|
||||||
|
#### stack
|
||||||
|
|
||||||
|
TCP/IP stack.
|
||||||
|
|
||||||
|
| Stack | Upstream | Status |
|
||||||
|
|------------------|-----------------------------------------------------------------------|-------------------|
|
||||||
|
| gVisor (default) | [google/gvisor](https://github.com/google/gvisor) | recommended |
|
||||||
|
| LWIP | [eycorsican/go-tun2socks](https://github.com/eycorsican/go-tun2socks) | upstream archived |
|
||||||
|
|
||||||
|
!!! warning ""
|
||||||
|
|
||||||
|
The LWIP stack is not included by default, see [Installation](/#Installation).
|
||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
#### sniff
|
#### sniff
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
| `http` | [HTTP](./http) |
|
| `http` | [HTTP](./http) |
|
||||||
| `shadowsocks` | [Shadowsocks](./shadowsocks) |
|
| `shadowsocks` | [Shadowsocks](./shadowsocks) |
|
||||||
| `vmess` | [VMess](./vmess) |
|
| `vmess` | [VMess](./vmess) |
|
||||||
|
| `trojan` | [Trojan](./trojan) |
|
||||||
| `dns` | [DNS](./dns) |
|
| `dns` | [DNS](./dns) |
|
||||||
| `selector` | [Selector](./selector) |
|
| `selector` | [Selector](./selector) |
|
||||||
|
|
||||||
|
|
114
docs/configuration/outbound/trojan.md
Normal file
114
docs/configuration/outbound/trojan.md
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
### Structure
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"type": "trojan",
|
||||||
|
"tag": "trojan-out",
|
||||||
|
|
||||||
|
"server": "127.0.0.1",
|
||||||
|
"server_port": 1080,
|
||||||
|
"password": "8JCsPssfgS8tiRwiMlhARg==",
|
||||||
|
"network": "tcp",
|
||||||
|
"tls": {},
|
||||||
|
"multiplex": {},
|
||||||
|
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Trojan Fields
|
||||||
|
|
||||||
|
#### server
|
||||||
|
|
||||||
|
==Required==
|
||||||
|
|
||||||
|
The server address.
|
||||||
|
|
||||||
|
#### server_port
|
||||||
|
|
||||||
|
==Required==
|
||||||
|
|
||||||
|
The server port.
|
||||||
|
|
||||||
|
#### password
|
||||||
|
|
||||||
|
==Required==
|
||||||
|
|
||||||
|
The Trojan password.
|
||||||
|
|
||||||
|
#### network
|
||||||
|
|
||||||
|
Enabled network
|
||||||
|
|
||||||
|
One of `tcp` `udp`.
|
||||||
|
|
||||||
|
Both is enabled by default.
|
||||||
|
|
||||||
|
#### tls
|
||||||
|
|
||||||
|
TLS configuration, see [TLS outbound structure](/configuration/shared/tls/#outbound-structure).
|
||||||
|
|
||||||
|
#### multiplex
|
||||||
|
|
||||||
|
Multiplex configuration, see [Multiplex structure](/configuration/shared/multiplex).
|
||||||
|
|
||||||
|
### 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
|
||||||
|
|
||||||
|
!!! error ""
|
||||||
|
|
||||||
|
Linux only
|
||||||
|
|
||||||
|
The iptables routing mark.
|
||||||
|
|
||||||
|
#### 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`.
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Configuration examples for sing-box.
|
Configuration examples for sing-box.
|
||||||
|
|
||||||
* [Linux Server Install](./linux-server-install)
|
* [Linux Server Installation](./linux-server-installation)
|
||||||
* [Shadowsocks Server](./ss-server)
|
* [Shadowsocks Server](./ss-server)
|
||||||
* [Shadowsocks Client](./ss-client)
|
* [Shadowsocks Client](./ss-client)
|
||||||
* [Shadowsocks Tun](./ss-tun)
|
* [Shadowsocks Tun](./ss-tun)
|
||||||
|
|
|
@ -6,7 +6,7 @@ The universal proxy platform.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
sing-box requires Golang 1.18 or a higher version.
|
sing-box requires Golang **1.18.5** or a higher version.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go install -v github.com/sagernet/sing-box/cmd/sing-box@latest
|
go install -v github.com/sagernet/sing-box/cmd/sing-box@latest
|
||||||
|
@ -15,14 +15,15 @@ go install -v github.com/sagernet/sing-box/cmd/sing-box@latest
|
||||||
Install with options:
|
Install with options:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go install -v -tags "with_clash_api,no_gvisor" github.com/sagernet/sing-box/cmd/sing-box@latest
|
go install -v -tags with_clash_api github.com/sagernet/sing-box/cmd/sing-box@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
| Build Tag | Description |
|
| Build Tag | Description |
|
||||||
|------------------|---------------------------------------------------------------------------------------------------------|
|
|----------------------------|--------------------------------------------------------------------------------------------------|
|
||||||
| `with_quic` | Build with quic support, which required by [QUIC and HTTP3](./configuration/dns/server) dns transports. |
|
| `with_quic` | Build with QUIC support, see [QUIC and HTTP3](./configuration/dns/server) dns transports. |
|
||||||
| `with_clash_api` | Build with clash api support, see [Experimental](./configuration/experimental#clash-api-fields). |
|
| `with_clash_api` | Build with Clash api support, see [Experimental](./configuration/experimental#clash-api-fields). |
|
||||||
| `no_gvisor` | Build without gVisor, which required by the [Tun](./configuration/inbound/tun) inbound. |
|
| `no_gvisor` | Build without gVisor tun stack support, see [Tun](./configuration/inbound/tun#stack). |
|
||||||
|
| `with_lwip` (CGO required) | Build with LWIP tun stack support, see [Tun](./configuration/inbound/tun#stack). |
|
||||||
|
|
||||||
The binary is built under $GOPATH/bin
|
The binary is built under $GOPATH/bin
|
||||||
|
|
||||||
|
@ -30,6 +31,8 @@ The binary is built under $GOPATH/bin
|
||||||
sing-box version
|
sing-box version
|
||||||
```
|
```
|
||||||
|
|
||||||
|
It is also recommended to use systemd to manage sing-box service, see [Linux server installation example](./examples/linux-server-installation).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -30,7 +30,9 @@ theme:
|
||||||
- navigation.sections
|
- navigation.sections
|
||||||
- header.autohide
|
- header.autohide
|
||||||
nav:
|
nav:
|
||||||
- Getting Started: index.md
|
- Getting Started:
|
||||||
|
- index.md
|
||||||
|
- Change Log: changelog.md
|
||||||
- Configuration:
|
- Configuration:
|
||||||
- configuration/index.md
|
- configuration/index.md
|
||||||
- Log: configuration/log.md
|
- Log: configuration/log.md
|
||||||
|
@ -46,6 +48,7 @@ nav:
|
||||||
- HTTP: configuration/inbound/http.md
|
- HTTP: configuration/inbound/http.md
|
||||||
- Shadowsocks: configuration/inbound/shadowsocks.md
|
- Shadowsocks: configuration/inbound/shadowsocks.md
|
||||||
- VMess: configuration/inbound/vmess.md
|
- VMess: configuration/inbound/vmess.md
|
||||||
|
- Trojan: configuration/inbound/trojan.md
|
||||||
- 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
|
||||||
|
@ -57,6 +60,7 @@ nav:
|
||||||
- HTTP: configuration/outbound/http.md
|
- HTTP: configuration/outbound/http.md
|
||||||
- Shadowsocks: configuration/outbound/shadowsocks.md
|
- Shadowsocks: configuration/outbound/shadowsocks.md
|
||||||
- VMess: configuration/outbound/vmess.md
|
- VMess: configuration/outbound/vmess.md
|
||||||
|
- Trojan: configuration/outbound/trojan.md
|
||||||
- DNS: configuration/outbound/dns.md
|
- DNS: configuration/outbound/dns.md
|
||||||
- Selector: configuration/outbound/selector.md
|
- Selector: configuration/outbound/selector.md
|
||||||
- Route:
|
- Route:
|
||||||
|
@ -71,7 +75,7 @@ nav:
|
||||||
- Multiplex: configuration/shared/multiplex.md
|
- Multiplex: configuration/shared/multiplex.md
|
||||||
- Examples:
|
- Examples:
|
||||||
- examples/index.md
|
- examples/index.md
|
||||||
- Linux Server Install: examples/linux-server-install.md
|
- Linux Server Installation: examples/linux-server-installation.md
|
||||||
- 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
|
||||||
|
|
Loading…
Reference in a new issue