mirror of
https://github.com/tailscale/tailscale.git
synced 2026-09-15 07:20:36 -04:00
WIP EXPERIMENT
This commit is contained in:
2 files changed
+25
No files matched your search
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build android
|
||||
|
||||
package resolver
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"tailscale.com/net/netns"
|
||||
"tailscale.com/types/nettype"
|
||||
)
|
||||
|
||||
func init() {
|
||||
lc := &net.ListenConfig{Control: netns.ControlFuncForDNS()}
|
||||
stdNetPacketListener = nettype.MakePacketListenerWithNetIP(lc)
|
||||
}
|
||||
@@ -106,3 +106,10 @@ func controlC(network, address string, c syscall.RawConn) error {
|
||||
}
|
||||
return sockErr
|
||||
}
|
||||
|
||||
// ControlFuncForDNS returns the Android-specific socket control function that
|
||||
// calls VpnService.protect() and bindSocketToNetwork(). This must be used for
|
||||
// DNS forwarder sockets to prevent them from being routed through the VPN.
|
||||
func ControlFuncForDNS() func(network, address string, c syscall.RawConn) error {
|
||||
return controlC
|
||||
}
|
||||
Reference in new issue
Block a user