mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-08 09:32:06 +08:00
Add missing accept_routes
option for Tailscale
This commit is contained in:
parent
7e883f67f6
commit
3e7569fff3
@ -15,6 +15,7 @@ icon: material/new-box
|
|||||||
"control_url": "",
|
"control_url": "",
|
||||||
"ephemeral": false,
|
"ephemeral": false,
|
||||||
"hostname": "",
|
"hostname": "",
|
||||||
|
"accept_routes": false,
|
||||||
"exit_node": "",
|
"exit_node": "",
|
||||||
"exit_node_allow_lan_access": false,
|
"exit_node_allow_lan_access": false,
|
||||||
"advertise_routes": [],
|
"advertise_routes": [],
|
||||||
@ -62,6 +63,10 @@ System hostname is used by default.
|
|||||||
|
|
||||||
Example: `localhost`
|
Example: `localhost`
|
||||||
|
|
||||||
|
#### accept_routes
|
||||||
|
|
||||||
|
Indicates whether the node should accept routes advertised by other nodes.
|
||||||
|
|
||||||
#### exit_node
|
#### exit_node
|
||||||
|
|
||||||
The exit node name or IP address to use.
|
The exit node name or IP address to use.
|
||||||
|
@ -11,6 +11,7 @@ type TailscaleEndpointOptions struct {
|
|||||||
ControlURL string `json:"control_url,omitempty"`
|
ControlURL string `json:"control_url,omitempty"`
|
||||||
Ephemeral bool `json:"ephemeral,omitempty"`
|
Ephemeral bool `json:"ephemeral,omitempty"`
|
||||||
Hostname string `json:"hostname,omitempty"`
|
Hostname string `json:"hostname,omitempty"`
|
||||||
|
AcceptRoutes bool `json:"accept_routes,omitempty"`
|
||||||
ExitNode string `json:"exit_node,omitempty"`
|
ExitNode string `json:"exit_node,omitempty"`
|
||||||
ExitNodeAllowLANAccess bool `json:"exit_node_allow_lan_access,omitempty"`
|
ExitNodeAllowLANAccess bool `json:"exit_node_allow_lan_access,omitempty"`
|
||||||
AdvertiseRoutes []netip.Prefix `json:"advertise_routes,omitempty"`
|
AdvertiseRoutes []netip.Prefix `json:"advertise_routes,omitempty"`
|
||||||
|
@ -72,6 +72,7 @@ type Endpoint struct {
|
|||||||
filter *atomic.Pointer[filter.Filter]
|
filter *atomic.Pointer[filter.Filter]
|
||||||
onReconfig wgengine.ReconfigListener
|
onReconfig wgengine.ReconfigListener
|
||||||
|
|
||||||
|
acceptRoutes bool
|
||||||
exitNode string
|
exitNode string
|
||||||
exitNodeAllowLANAccess bool
|
exitNodeAllowLANAccess bool
|
||||||
advertiseRoutes []netip.Prefix
|
advertiseRoutes []netip.Prefix
|
||||||
@ -170,6 +171,7 @@ func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextL
|
|||||||
network: service.FromContext[adapter.NetworkManager](ctx),
|
network: service.FromContext[adapter.NetworkManager](ctx),
|
||||||
platformInterface: service.FromContext[platform.Interface](ctx),
|
platformInterface: service.FromContext[platform.Interface](ctx),
|
||||||
server: server,
|
server: server,
|
||||||
|
acceptRoutes: options.AcceptRoutes,
|
||||||
exitNode: options.ExitNode,
|
exitNode: options.ExitNode,
|
||||||
exitNodeAllowLANAccess: options.ExitNodeAllowLANAccess,
|
exitNodeAllowLANAccess: options.ExitNodeAllowLANAccess,
|
||||||
advertiseRoutes: options.AdvertiseRoutes,
|
advertiseRoutes: options.AdvertiseRoutes,
|
||||||
@ -226,6 +228,10 @@ func (t *Endpoint) Start(stage adapter.StartStage) error {
|
|||||||
|
|
||||||
localBackend := t.server.ExportLocalBackend()
|
localBackend := t.server.ExportLocalBackend()
|
||||||
perfs := &ipn.MaskedPrefs{
|
perfs := &ipn.MaskedPrefs{
|
||||||
|
Prefs: ipn.Prefs{
|
||||||
|
RouteAll: t.acceptRoutes,
|
||||||
|
},
|
||||||
|
RouteAllSet: true,
|
||||||
ExitNodeIPSet: true,
|
ExitNodeIPSet: true,
|
||||||
AdvertiseRoutesSet: true,
|
AdvertiseRoutesSet: true,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user