Files
portmaster/service/netenv/interfaces_default.go
T
Alexandr Stelnykovych 52a3b9256a netenv: enhance interface detection with physical adapter selection
- Refactor GetInterface* functions to return InterfaceInfo with IPv4/IPv6
  addresses instead of just net.Interface
- Add pre-caching of first routable IPv4/IPv6 per interface to avoid repeated
  address list scans
- Skip loopback interfaces in cache refresh
- Add GetBestPhysicalDefaultInterfaces() to detect which physical adapters
  carry the default route per IP family, excluding VPNs/tunnels
- Implement platform-specific physical interface detection:
  * Linux: reads /proc/net/route and /proc/net/ipv6_route, uses
    /sys/class/net/*/device to identify real hardware
  * Windows: uses GetAdaptersAddresses with IfType filtering
  * Other platforms: returns not-supported error
- Add helper functions: buildInterfaceInfo, interfaceToInfo, buildInterfaceInfoDirect,
  hasRoutableIPv4, hasRoutableIPv6
- Update tests to work with new InterfaceInfo return type and add coverage
  for new features
2026-04-24 17:55:32 +03:00

11 lines
274 B
Go

//go:build !linux && !windows
package netenv
import "net"
// selectPhysicalDefaultInterfaces is not implemented on this platform.
func selectPhysicalDefaultInterfaces() (*net.Interface, *net.Interface, error) {
return nil, nil, errNoPhysicalDefaultInterface
}