mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-02-27 03:31:18 +00:00
17 lines
398 B
Go
17 lines
398 B
Go
|
package tailscale
|
||
|
|
||
|
import (
|
||
|
"github.com/sagernet/sing-box/experimental/libbox/platform"
|
||
|
"github.com/sagernet/tailscale/net/netns"
|
||
|
)
|
||
|
|
||
|
func setAndroidProtectFunc(platformInterface platform.Interface) {
|
||
|
if platformInterface != nil {
|
||
|
netns.SetAndroidProtectFunc(func(fd int) error {
|
||
|
return platformInterface.AutoDetectInterfaceControl(fd)
|
||
|
})
|
||
|
} else {
|
||
|
netns.SetAndroidProtectFunc(nil)
|
||
|
}
|
||
|
}
|