Documentation
¶
Overview ¶
Package physnet keeps sockets that a VPN client opens for itself off the TUN it serves.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenControl ¶
ListenControl returns a net.ListenConfig.Control function that force-binds newly-created sockets to the platform's default physical interface. When no NetworkManager is registered on ctx (tests, standalone sing-box without the tunnel wrapper), it's a no-op — the socket follows the routing table like a plain net.ListenUDP.
Implementation-wise we borrow the same ProtectFunc / AutoDetectInterfaceFunc hooks sing-box's default dialer uses, but we apply them UNCONDITIONALLY whenever a NetworkManager is present — not gated on networkManager.AutoDetectInterface() the way sing-box/common/dialer/default.go:NewDefault is. This is intentional: pion's ICE host-candidate gathering fails if sockets aren't kept off the TUN we're serving, even when the user hasn't explicitly set auto_detect_interface on the outbound. Gating on AutoDetectInterface() would reintroduce the "NAT failure, aborting!" regression the unbounded outbound's ListenUDP override exists to fix.
Types ¶
This section is empty.