mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
Previously, a valid interfaces map is only meaningful on Windows and Darwin, where ctrld needs to set DNS for all physical interfaces. With new network monitor, the valid interfaces is used for checking new changes, thus we have to implement the valid interfaces map for all systems. - On Linux, just retrieving all non-virtual interfaces. - On others, fallback to use default route interface only.
23 lines
549 B
Go
23 lines
549 B
Go
//go:build !darwin && !windows && !linux
|
|
|
|
package cli
|
|
|
|
import (
|
|
"net"
|
|
|
|
"tailscale.com/net/netmon"
|
|
)
|
|
|
|
func patchNetIfaceName(iface *net.Interface) (bool, error) { return true, nil }
|
|
|
|
func validInterface(iface *net.Interface, validIfacesMap map[string]struct{}) bool { return true }
|
|
|
|
// validInterfacesMap returns a set containing only default route interfaces.
|
|
func validInterfacesMap() map[string]struct{} {
|
|
defaultRoute, err := netmon.DefaultRoute()
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
return map[string]struct{}{defaultRoute.InterfaceName: {}}
|
|
}
|