ifbind

package
v0.39.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Control(iface string) func(network, address string, c syscall.RawConn) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL