mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
6b95219e3a
... in prep for merging the net/interfaces package into net/netmon. This is a no-op change that updates a bunch of the API signatures ahead of a future change to actually move things (and remove the type alias) Updates tailscale/corp#10910 Updates tailscale/corp#18960 Updates #7967 Updates #3299 Change-Id: I477613388f09389214db0d77ccf24a65bff2199c Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
31 lines
757 B
Go
31 lines
757 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build ts_macext && (darwin || ios)
|
|
|
|
package ipnlocal
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
"net/netip"
|
|
|
|
"tailscale.com/net/netmon"
|
|
"tailscale.com/net/netns"
|
|
)
|
|
|
|
func init() {
|
|
initListenConfig = initListenConfigNetworkExtension
|
|
}
|
|
|
|
// initListenConfigNetworkExtension configures nc for listening on IP
|
|
// through the iOS/macOS Network/System Extension (Packet Tunnel
|
|
// Provider) sandbox.
|
|
func initListenConfigNetworkExtension(nc *net.ListenConfig, ip netip.Addr, st *netmon.State, tunIfName string) error {
|
|
tunIf, ok := st.Interface[tunIfName]
|
|
if !ok {
|
|
return fmt.Errorf("no interface with name %q", tunIfName)
|
|
}
|
|
return netns.SetListenConfigInterfaceIndex(nc, tunIf.Index)
|
|
}
|