Documentation
¶
Overview ¶
Package networking provides abstraction layers for accessing networking resources both across platform specific details, and for virtual / mock configurations for testing
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment interface { io.Closer // Interfaces is typically a wrapper for net.Interfaces() Interfaces() ([]Interface, error) // InterfaceByName looks up an interface by its name InterfaceByName(string) (Interface, error) // ListenUDP abstracts net.ListenUDP ListenUDP(network string, laddr *net.UDPAddr) (UDPConn, error) // NewWgClient creates a wireguard client interface for the host NewWgClient() (internal.WgClient, error) }
Environment represents the top level abstraction of the system's networking environment.
type Interface ¶
type Interface interface { Name() string IsUp() bool Addrs() ([]net.IPNet, error) AddAddr(net.IPNet) error }
Interface represents a single network interface
type UDPConn ¶ added in v0.9.1
type UDPConn interface { io.Closer SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error) WriteToUDP(p []byte, addr *net.UDPAddr) (n int, err error) // ReadPackets reads packets from the connection until it is either closed, // or the passed context is cancelled. // Packets or errors (other than the connection being closed) will be sent // to the output channel, which will be closed when this routine finishes. // Closing the connection is always the responsibility of the caller. ReadPackets( ctx context.Context, maxSize int, output chan<- *UDPPacket, ) error }
UDPConn abstracts net.UDPConn
Click to show internal directories.
Click to hide internal directories.