diff --git a/docs/configuration/endpoint/tailscale.md b/docs/configuration/endpoint/tailscale.md index ac34518a..1556367b 100644 --- a/docs/configuration/endpoint/tailscale.md +++ b/docs/configuration/endpoint/tailscale.md @@ -4,6 +4,7 @@ icon: material/new-box !!! quote "Changes in sing-box 1.14.0" + :material-plus: [listen_port](#listen_port) :material-plus: [ssh_server](#ssh_server) !!! quote "Changes in sing-box 1.13.0" @@ -34,6 +35,7 @@ icon: material/new-box "advertise_routes": [], "advertise_exit_node": false, "advertise_tags": [], + "listen_port": 0, "relay_server_port": 0, "relay_server_static_endpoints": [], "system_interface": false, @@ -121,6 +123,14 @@ Tags to advertise for this node, for ACL enforcement purposes. Example: `["tag:server"]` +#### listen_port + +!!! question "Since sing-box 1.14.0" + +The UDP port to listen on for WireGuard and peer-to-peer traffic. + +A port is automatically selected by default. + #### relay_server_port !!! question "Since sing-box 1.13.0" diff --git a/docs/configuration/endpoint/tailscale.zh.md b/docs/configuration/endpoint/tailscale.zh.md index a12db096..52af1aef 100644 --- a/docs/configuration/endpoint/tailscale.zh.md +++ b/docs/configuration/endpoint/tailscale.zh.md @@ -4,6 +4,7 @@ icon: material/new-box !!! quote "sing-box 1.14.0 中的更改" + :material-plus: [listen_port](#listen_port) :material-plus: [ssh_server](#ssh_server) !!! quote "sing-box 1.13.0 中的更改" @@ -34,6 +35,7 @@ icon: material/new-box "advertise_routes": [], "advertise_exit_node": false, "advertise_tags": [], + "listen_port": 0, "relay_server_port": 0, "relay_server_static_endpoints": [], "system_interface": false, @@ -120,6 +122,14 @@ icon: material/new-box 示例:`["tag:server"]` +#### listen_port + +!!! question "自 sing-box 1.14.0 起" + +监听 WireGuard 和点对点流量的 UDP 端口。 + +默认自动选择端口。 + #### relay_server_port !!! question "自 sing-box 1.13.0 起" diff --git a/docs/schema.json b/docs/schema.json index a831eafc..d5b95eea 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -4534,6 +4534,11 @@ } ] }, + "listen_port": { + "type": "integer", + "minimum": 0, + "maximum": 65535 + }, "relay_server_port": { "type": "integer", "minimum": 0, diff --git a/option/tailscale.go b/option/tailscale.go index a470ee30..e0b9e8fd 100644 --- a/option/tailscale.go +++ b/option/tailscale.go @@ -25,6 +25,7 @@ type TailscaleEndpointOptions struct { AdvertiseRoutes []netip.Prefix `json:"advertise_routes,omitempty"` AdvertiseExitNode bool `json:"advertise_exit_node,omitempty"` AdvertiseTags badoption.Listable[string] `json:"advertise_tags,omitempty"` + ListenPort uint16 `json:"listen_port,omitempty"` RelayServerPort *uint16 `json:"relay_server_port,omitempty"` RelayServerStaticEndpoints []netip.AddrPort `json:"relay_server_static_endpoints,omitempty"` SystemInterface bool `json:"system_interface,omitempty"` diff --git a/protocol/tailscale/endpoint.go b/protocol/tailscale/endpoint.go index b7cce6f4..31628ff4 100644 --- a/protocol/tailscale/endpoint.go +++ b/protocol/tailscale/endpoint.go @@ -202,6 +202,7 @@ func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextL Ephemeral: options.Ephemeral, AuthKey: options.AuthKey, ControlURL: options.ControlURL, + Port: options.ListenPort, AdvertiseTags: options.AdvertiseTags, Dialer: &endpointDialer{Dialer: outboundDialer, logger: logger}, LookupHook: func(ctx context.Context, host string) ([]netip.Addr, error) {