Provide default route to Tailscale

This commit is contained in:
世界
2026-10-23 19:57:06 +08:00
parent 9c1efcc186
commit 1cc885e040
3 changed files with 17 additions and 3 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ require (
github.com/sagernet/sing-usbip v0.0.0-20260817040617-28bd42667eca
github.com/sagernet/sing-vmess v0.2.9-0.20260929152519-9b95ab8c9478
github.com/sagernet/smux v1.5.50-sing-box-mod.1
github.com/sagernet/tailscale v1.102.1-sing-box-1.14-mod.5
github.com/sagernet/tailscale v1.102.1-sing-box-1.14-mod.5.0.20261019070639-79c1732442a9
github.com/sagernet/wireguard-go v0.0.8-0.20260929150556-6731c7387c81
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854
github.com/spf13/cobra v1.10.2
+2 -2
View File
@@ -346,8 +346,8 @@ github.com/sagernet/sing-vmess v0.2.9-0.20260929152519-9b95ab8c9478 h1:q2eQn4nq8
github.com/sagernet/sing-vmess v0.2.9-0.20260929152519-9b95ab8c9478/go.mod h1:P11scgTxMxVVQ8dlM27yNm3Cro40mD0+gHbnqrNGDuY=
github.com/sagernet/smux v1.5.50-sing-box-mod.1 h1:XkJcivBC9V4wBjiGXIXZ229aZCU1hzcbp6kSkkyQ478=
github.com/sagernet/smux v1.5.50-sing-box-mod.1/go.mod h1:NjhsCEWedJm7eFLyhuBgIEzwfhRmytrUoiLluxs5Sk8=
github.com/sagernet/tailscale v1.102.1-sing-box-1.14-mod.5 h1:mGLWVgj2Pl2NlgE1+sEUIDIMB42JdWEPwYmxTnVWg44=
github.com/sagernet/tailscale v1.102.1-sing-box-1.14-mod.5/go.mod h1:WLUSOPmTcf7VN9gLCe01qUSIvD+/cKC177neENyZPkI=
github.com/sagernet/tailscale v1.102.1-sing-box-1.14-mod.5.0.20261019070639-79c1732442a9 h1:Phb4IDqGdP2Wg8VDComdDy2uMg1ZN3gs0kpJHp6C8O8=
github.com/sagernet/tailscale v1.102.1-sing-box-1.14-mod.5.0.20261019070639-79c1732442a9/go.mod h1:WLUSOPmTcf7VN9gLCe01qUSIvD+/cKC177neENyZPkI=
github.com/sagernet/wireguard-go v0.0.8-0.20260929150556-6731c7387c81 h1:VsrjoaljEz7jQ1LWbrNyf/scQSQIkVVp7v4nSDrPJ+I=
github.com/sagernet/wireguard-go v0.0.8-0.20260929150556-6731c7387c81/go.mod h1:er10sELpmzLXq7S7Pbc1Zsbyapcr+/gxNAHKTo6fzVA=
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 h1:6uUiZcDRnZSAegryaUGwPC/Fj13JSHwiTftrXhMmYOc=
+14
View File
@@ -306,6 +306,20 @@ func (t *Endpoint) start(scope *adapter.Scope) error {
netmon.RegisterInterfaceGetter(nil)
return nil
})
netmon.SetDefaultRouteFunc(func() (netmon.DefaultRouteDetails, error) {
defaultInterface := t.network.InterfaceMonitor().DefaultInterface()
if defaultInterface == nil {
return netmon.DefaultRouteDetails{}, nil
}
return netmon.DefaultRouteDetails{
InterfaceName: defaultInterface.Name,
InterfaceIndex: defaultInterface.Index,
}, nil
})
scope.Add(func() error {
netmon.SetDefaultRouteFunc(nil)
return nil
})
}
if t.systemInterface {
mtu := t.systemInterfaceMTU