mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-09-02 15:28:49 +08:00
Compare commits
74 Commits
0be2233795
...
1c36072120
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1c36072120 | ||
![]() |
6e9258bede | ||
![]() |
b0f4008071 | ||
![]() |
3f26b7b4e9 | ||
![]() |
dbab3a2178 | ||
![]() |
dbf17cca71 | ||
![]() |
4a0fe88217 | ||
![]() |
4a62401f9e | ||
![]() |
09edc643cb | ||
![]() |
4be4220f20 | ||
![]() |
d1b0c967aa | ||
![]() |
7608266ea7 | ||
![]() |
081dad8f57 | ||
![]() |
3ff990a6a3 | ||
![]() |
9ff3da2bdb | ||
![]() |
92c20a545d | ||
![]() |
2e75cb3c22 | ||
![]() |
4414dc6bee | ||
![]() |
7d11245a90 | ||
![]() |
744e9b4577 | ||
![]() |
153a262f35 | ||
![]() |
39d2fb5467 | ||
![]() |
85a2a5c169 | ||
![]() |
575b5dfb10 | ||
![]() |
f19c500b4f | ||
![]() |
8e5958a7e4 | ||
![]() |
dc5e6ed488 | ||
![]() |
049c18377c | ||
![]() |
870f76a91e | ||
![]() |
d1a945f180 | ||
![]() |
6d56bc1528 | ||
![]() |
25e2d670e7 | ||
![]() |
be8419fa84 | ||
![]() |
27acc99c35 | ||
![]() |
6053a3bad1 | ||
![]() |
c63a58c0fb | ||
![]() |
cc4354b18a | ||
![]() |
8344653443 | ||
![]() |
26f185aa7c | ||
![]() |
a69007f1a2 | ||
![]() |
20729defd6 | ||
![]() |
ff751f8504 | ||
![]() |
689c229fe6 | ||
![]() |
c4cdb68d10 | ||
![]() |
dd99a45df6 | ||
![]() |
cbe077eaa9 | ||
![]() |
47fd88f450 | ||
![]() |
5fdfba6816 | ||
![]() |
e38de3bd8f | ||
![]() |
6f9d507ab3 | ||
![]() |
567de6aa88 | ||
![]() |
5fd7fba75f | ||
![]() |
d80f81157c | ||
![]() |
133e57e85f | ||
![]() |
f854586ac8 | ||
![]() |
a3a54b6e91 | ||
![]() |
fa5dbfcca8 | ||
![]() |
35d5a1f6a6 | ||
![]() |
9f26fea1fc | ||
![]() |
5c71baa23c | ||
![]() |
a75772d01e | ||
![]() |
ae263e2da3 | ||
![]() |
031b6de8b5 | ||
![]() |
6aef4ec1c6 | ||
![]() |
61b7666fd5 | ||
![]() |
ea5339285e | ||
![]() |
d38d58ff6e | ||
![]() |
60570b966b | ||
![]() |
195e859bf7 | ||
![]() |
0ce1f21794 | ||
![]() |
ec5eba1d25 | ||
![]() |
682a95c55e | ||
![]() |
34283f914a | ||
![]() |
fcce280a50 |
@ -4,8 +4,18 @@ icon: material/alert-decagram
|
||||
|
||||
#### 1.12.0-beta.13
|
||||
|
||||
* Add TLS record fragment route options **1**
|
||||
* Add missing `accept_routes` option for Tailscale **2**
|
||||
* Fixes and improvements
|
||||
|
||||
**1**:
|
||||
|
||||
See [Route Action](/configuration/route/rule_action/#tls_record_fragment).
|
||||
|
||||
**2**:
|
||||
|
||||
See [Tailscale](/configuration/endpoint/tailscale/#accept_routes).
|
||||
|
||||
#### 1.12.0-beta.10
|
||||
|
||||
* Add control options for listeners **1**
|
||||
|
@ -15,6 +15,7 @@ icon: material/new-box
|
||||
"control_url": "",
|
||||
"ephemeral": false,
|
||||
"hostname": "",
|
||||
"accept_routes": false,
|
||||
"exit_node": "",
|
||||
"exit_node_allow_lan_access": false,
|
||||
"advertise_routes": [],
|
||||
@ -62,6 +63,10 @@ System hostname is used by default.
|
||||
|
||||
Example: `localhost`
|
||||
|
||||
#### accept_routes
|
||||
|
||||
Indicates whether the node should accept routes advertised by other nodes.
|
||||
|
||||
#### exit_node
|
||||
|
||||
The exit node name or IP address to use.
|
||||
|
@ -6,6 +6,7 @@ icon: material/new-box
|
||||
|
||||
:material-plus: [tls_fragment](#tls_fragment)
|
||||
:material-plus: [tls_fragment_fallback_delay](#tls_fragment_fallback_delay)
|
||||
:material-plus: [tls_record_fragment](#tls_record_fragment)
|
||||
:material-plus: [resolve.disable_cache](#disable_cache)
|
||||
:material-plus: [resolve.rewrite_ttl](#rewrite_ttl)
|
||||
:material-plus: [resolve.client_subnet](#client_subnet)
|
||||
@ -91,7 +92,8 @@ Not available when `method` is set to drop.
|
||||
"udp_connect": false,
|
||||
"udp_timeout": "",
|
||||
"tls_fragment": false,
|
||||
"tls_fragment_fallback_delay": ""
|
||||
"tls_fragment_fallback_delay": "",
|
||||
"tls_record_fragment": ""
|
||||
}
|
||||
```
|
||||
|
||||
@ -164,13 +166,19 @@ If no protocol is sniffed, the following ports will be recognized as protocols b
|
||||
|
||||
Fragment TLS handshakes to bypass firewalls.
|
||||
|
||||
This feature is intended to circumvent simple firewalls based on **plaintext packet matching**, and should not be used to circumvent real censorship.
|
||||
This feature is intended to circumvent simple firewalls based on **plaintext packet matching**,
|
||||
and should not be used to circumvent real censorship.
|
||||
|
||||
Since it is not designed for performance, it should not be applied to all connections, but only to server names that are known to be blocked.
|
||||
Due to poor performance, try `tls_record_fragment` first, and only apply to server names known to be blocked.
|
||||
|
||||
On Linux, Apple platforms, (administrator privileges required) Windows, the wait time can be automatically detected, otherwise it will fall back to waiting for a fixed time specified by `tls_fragment_fallback_delay`.
|
||||
On Linux, Apple platforms, (administrator privileges required) Windows,
|
||||
the wait time can be automatically detected, otherwise it will fall back to
|
||||
waiting for a fixed time specified by `tls_fragment_fallback_delay`.
|
||||
|
||||
In addition, if the actual wait time is less than 20ms, it will also fall back to waiting for a fixed time, because the target is considered to be local or behind a transparent proxy.
|
||||
In addition, if the actual wait time is less than 20ms, it will also fall back to waiting for a fixed time,
|
||||
because the target is considered to be local or behind a transparent proxy.
|
||||
|
||||
Conflict with `tls_record_fragment`.
|
||||
|
||||
#### tls_fragment_fallback_delay
|
||||
|
||||
@ -180,6 +188,17 @@ The fallback value used when TLS segmentation cannot automatically determine the
|
||||
|
||||
`500ms` is used by default.
|
||||
|
||||
#### tls_record_fragment
|
||||
|
||||
!!! question "Since sing-box 1.12.0"
|
||||
|
||||
Fragment TLS handshake into multiple TLS records to bypass firewalls.
|
||||
|
||||
This feature is intended to circumvent simple firewalls based on **plaintext packet matching**,
|
||||
and should not be used to circumvent real censorship.
|
||||
|
||||
Conflict with `tls_fragment`.
|
||||
|
||||
### sniff
|
||||
|
||||
```json
|
||||
|
@ -5,7 +5,11 @@ icon: material/new-box
|
||||
!!! quote "sing-box 1.12.0 中的更改"
|
||||
|
||||
:material-plus: [tls_fragment](#tls_fragment)
|
||||
:material-plus: [tls_fragment_fallback_delay](#tls_fragment_fallback_delay)
|
||||
:material-plus: [tls_fragment_fallback_delay](#tls_fragment_fallback_delay)
|
||||
:material-plus: [tls_record_fragment](#tls_record_fragment)
|
||||
:material-plus: [resolve.disable_cache](#disable_cache)
|
||||
:material-plus: [resolve.rewrite_ttl](#rewrite_ttl)
|
||||
:material-plus: [resolve.client_subnet](#client_subnet)
|
||||
|
||||
## 最终动作
|
||||
|
||||
@ -159,12 +163,15 @@ UDP 连接超时时间。
|
||||
|
||||
此功能旨在规避基于**明文数据包匹配**的简单防火墙,不应该用于规避真的审查。
|
||||
|
||||
由于它不是为性能设计的,不应被应用于所有连接,而仅应用于已知被阻止的服务器名称。
|
||||
由于性能不佳,请首先尝试 `tls_record_fragment`,且仅应用于已知被阻止的服务器名称。
|
||||
|
||||
在 Linux、Apple 平台和需要管理员权限的 Windows 系统上,可自动检测等待时间。若无法自动检测,将回退使用 `tls_fragment_fallback_delay` 指定的固定等待时间。
|
||||
在 Linux、Apple 平台和需要管理员权限的 Windows 系统上,可自动检测等待时间。
|
||||
若无法自动检测,将回退使用 `tls_fragment_fallback_delay` 指定的固定等待时间。
|
||||
|
||||
此外,若实际等待时间小于 20 毫秒,同样会回退至固定等待时间模式,因为此时判定目标处于本地或透明代理之后。
|
||||
|
||||
与 `tls_record_fragment` 冲突。
|
||||
|
||||
#### tls_fragment_fallback_delay
|
||||
|
||||
!!! question "自 sing-box 1.12.0 起"
|
||||
@ -173,6 +180,16 @@ UDP 连接超时时间。
|
||||
|
||||
默认使用 `500ms`。
|
||||
|
||||
#### tls_record_fragment
|
||||
|
||||
!!! question "自 sing-box 1.12.0 起"
|
||||
|
||||
通过分段 TLS 握手数据包到多个 TLS 记录来绕过防火墙检测。
|
||||
|
||||
此功能旨在规避基于**明文数据包匹配**的简单防火墙,不应该用于规避真的审查。
|
||||
|
||||
与 `tls_fragment` 冲突。
|
||||
|
||||
### sniff
|
||||
|
||||
```json
|
||||
|
3
go.mod
3
go.mod
@ -35,7 +35,8 @@ require (
|
||||
github.com/sagernet/sing-tun v0.6.6-0.20250428031943-0686f8c4f210
|
||||
github.com/sagernet/sing-vmess v0.2.2-0.20250503051933-9b4cf17393f8
|
||||
github.com/sagernet/smux v1.5.34-mod.2
|
||||
github.com/sagernet/tailscale v1.80.3-mod.4
|
||||
github.com/sagernet/tailscale v1.80.3-mod.5
|
||||
github.com/sagernet/utls v1.6.7
|
||||
github.com/sagernet/wireguard-go v0.0.1-beta.7
|
||||
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854
|
||||
github.com/spf13/cobra v1.9.1
|
||||
|
6
go.sum
6
go.sum
@ -186,8 +186,10 @@ github.com/sagernet/sing-vmess v0.2.2-0.20250503051933-9b4cf17393f8 h1:zW+zAOCxU
|
||||
github.com/sagernet/sing-vmess v0.2.2-0.20250503051933-9b4cf17393f8/go.mod h1:IL8Rr+EGwuqijszZkNrEFTQDKhilEpkqFqOlvdpS6/w=
|
||||
github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2WkltRQ4=
|
||||
github.com/sagernet/smux v1.5.34-mod.2/go.mod h1:0KW0+R+ycvA2INW4gbsd7BNyg+HEfLIAxa5N02/28Zc=
|
||||
github.com/sagernet/tailscale v1.80.3-mod.4 h1:9UgYq8m9mwX5dbTbueVxbRh+bq7AayxemJGM2PkJQnE=
|
||||
github.com/sagernet/tailscale v1.80.3-mod.4/go.mod h1:EBxXsWu4OH2ELbQLq32WoBeIubG8KgDrg4/Oaxjs6lI=
|
||||
github.com/sagernet/tailscale v1.80.3-mod.4.0.20250512093633-e1bc1888c814 h1:B6ejgOuM1BrX4TzWvm1h/LQAOZW1T1jP4PSZe8b/49o=
|
||||
github.com/sagernet/tailscale v1.80.3-mod.4.0.20250512093633-e1bc1888c814/go.mod h1:EBxXsWu4OH2ELbQLq32WoBeIubG8KgDrg4/Oaxjs6lI=
|
||||
github.com/sagernet/tailscale v1.80.3-mod.5 h1:7V7z+p2C//TGtff20pPnDCt3qP6uFyY62peJoKF9z/A=
|
||||
github.com/sagernet/tailscale v1.80.3-mod.5/go.mod h1:EBxXsWu4OH2ELbQLq32WoBeIubG8KgDrg4/Oaxjs6lI=
|
||||
github.com/sagernet/wireguard-go v0.0.1-beta.7 h1:ltgBwYHfr+9Wz1eG59NiWnHrYEkDKHG7otNZvu85DXI=
|
||||
github.com/sagernet/wireguard-go v0.0.1-beta.7/go.mod h1:jGXij2Gn2wbrWuYNUmmNhf1dwcZtvyAvQoe8Xd8MbUo=
|
||||
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 h1:6uUiZcDRnZSAegryaUGwPC/Fj13JSHwiTftrXhMmYOc=
|
||||
|
@ -11,6 +11,7 @@ type TailscaleEndpointOptions struct {
|
||||
ControlURL string `json:"control_url,omitempty"`
|
||||
Ephemeral bool `json:"ephemeral,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
AcceptRoutes bool `json:"accept_routes,omitempty"`
|
||||
ExitNode string `json:"exit_node,omitempty"`
|
||||
ExitNodeAllowLANAccess bool `json:"exit_node_allow_lan_access,omitempty"`
|
||||
AdvertiseRoutes []netip.Prefix `json:"advertise_routes,omitempty"`
|
||||
|
@ -72,6 +72,7 @@ type Endpoint struct {
|
||||
filter *atomic.Pointer[filter.Filter]
|
||||
onReconfig wgengine.ReconfigListener
|
||||
|
||||
acceptRoutes bool
|
||||
exitNode string
|
||||
exitNodeAllowLANAccess bool
|
||||
advertiseRoutes []netip.Prefix
|
||||
@ -170,6 +171,7 @@ func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextL
|
||||
network: service.FromContext[adapter.NetworkManager](ctx),
|
||||
platformInterface: service.FromContext[platform.Interface](ctx),
|
||||
server: server,
|
||||
acceptRoutes: options.AcceptRoutes,
|
||||
exitNode: options.ExitNode,
|
||||
exitNodeAllowLANAccess: options.ExitNodeAllowLANAccess,
|
||||
advertiseRoutes: options.AdvertiseRoutes,
|
||||
@ -226,6 +228,10 @@ func (t *Endpoint) Start(stage adapter.StartStage) error {
|
||||
|
||||
localBackend := t.server.ExportLocalBackend()
|
||||
perfs := &ipn.MaskedPrefs{
|
||||
Prefs: ipn.Prefs{
|
||||
RouteAll: t.acceptRoutes,
|
||||
},
|
||||
RouteAllSet: true,
|
||||
ExitNodeIPSet: true,
|
||||
AdvertiseRoutesSet: true,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user