Add listen_port option to Tailscale endpoint

This commit is contained in:
世界
2026-08-30 17:41:45 +08:00
parent b3a45e0839
commit 24d1f271bf
5 changed files with 27 additions and 0 deletions
+10
View File
@@ -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"
@@ -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 起"
+5
View File
@@ -4534,6 +4534,11 @@
}
]
},
"listen_port": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"relay_server_port": {
"type": "integer",
"minimum": 0,
+1
View File
@@ -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"`
+1
View File
@@ -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) {