Documentation
¶
Overview ¶
Package ifbind binds a socket to a network interface. On Linux the kernel then hands the socket only what arrives on that interface. On macOS the binding confines what the socket sends to that interface and does not filter what it receives. The round-trip probe and the tcp session listener use it to bind their sockets to the mesh interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Control ¶
Control returns the net.ListenConfig control that binds a socket to iface: SO_BINDTODEVICE on Linux; on macOS IP_BOUND_IF, or IPV6_BOUND_IF when network ends in "6". It returns nil for an empty iface, and on every other system, so the socket is bound to its address alone.
An unknown iface or a refused option fails the listen with the kernel's error wrapped as "bind to interface <iface>: <error>". Since Linux 5.7 a socket that is not yet bound to a device needs no capability for SO_BINDTODEVICE; an older kernel asks for CAP_NET_RAW.
Types ¶
This section is empty.