Files
sing-box-extended-mirror/protocol/tailscale/protect_android.go
T

19 lines
408 B
Go
Raw Normal View History

//go:build with_gvisor
2025-04-06 19:14:41 +08:00
package tailscale
import (
"github.com/sagernet/sing-box/adapter"
2025-04-06 19:14:41 +08:00
"github.com/sagernet/tailscale/net/netns"
)
func setAndroidProtectFunc(platformInterface adapter.PlatformInterface) {
2025-04-06 19:14:41 +08:00
if platformInterface != nil {
netns.SetAndroidProtectFunc(func(fd int) error {
return platformInterface.AutoDetectInterfaceControl(fd)
})
} else {
netns.SetAndroidProtectFunc(nil)
}
}