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 ¶
View Source
var ErrAddAddrUnsupported = errors.New("this platform doesn't support interface configuration yet")
ErrAddAddrUnsupported is returned from Interface.AddAddr on platforms where a network interface configuration API is not yet supported
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
Directories ¶
Path | Synopsis |
---|---|
Package darwin provides an implementation of networking.Environment for the host darwin (macOS) system, leveraging the Go native package, and then filling in the gaps by exececuting command line tools such as ifconfig.
|
Package darwin provides an implementation of networking.Environment for the host darwin (macOS) system, leveraging the Go native package, and then filling in the gaps by exececuting command line tools such as ifconfig. |
Package host provides a generic accessor factory to create the appropriate platform-specific interface to the host networking APIs.
|
Package host provides a generic accessor factory to create the appropriate platform-specific interface to the host networking APIs. |
Package linux provides an implementation of networking.Environment for the host Linux system, leveraging the Go native package, and then filling in the gaps using netlink APIs.
|
Package linux provides an implementation of networking.Environment for the host Linux system, leveraging the Go native package, and then filling in the gaps using netlink APIs. |
Package mocks provides mock implementations of the networking apis, for the testify mock library, generated via go generate and mockery.
|
Package mocks provides mock implementations of the networking apis, for the testify mock library, generated via go generate and mockery. |
Package native provdies common base implementations of the networking.Environment and related interfaces, or at least the portions that can be implemented using common native Go APIs.
|
Package native provdies common base implementations of the networking.Environment and related interfaces, or at least the portions that can be implemented using common native Go APIs. |
Package vnet provides a virtual (as opposed to mocked) implementation of the abstracted UDP networking stack.
|
Package vnet provides a virtual (as opposed to mocked) implementation of the abstracted UDP networking stack. |
Click to show internal directories.
Click to hide internal directories.