Documentation ¶
Overview ¶
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.
Index ¶
- type GoEnvironment
- func (e *GoEnvironment) Close() error
- func (e *GoEnvironment) InterfaceByName(name string) (networking.Interface, error)
- func (e *GoEnvironment) Interfaces() ([]networking.Interface, error)
- func (e *GoEnvironment) ListenUDP(network string, laddr *net.UDPAddr) (networking.UDPConn, error)
- func (e *GoEnvironment) NewWgClient() (internal.WgClient, error)
- type GoInterface
- type GoUDPConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoEnvironment ¶
type GoEnvironment struct{}
GoEnvironment is a partial implementation of Environment which provides the methods and types that the go runtime can answer
func (*GoEnvironment) Close ¶ added in v0.13.0
func (e *GoEnvironment) Close() error
Close implements Environment by doing nothing and returning nil
func (*GoEnvironment) InterfaceByName ¶
func (e *GoEnvironment) InterfaceByName(name string) (networking.Interface, error)
InterfaceByName implements Environment by wrapping net.InterfaceByName
func (*GoEnvironment) Interfaces ¶
func (e *GoEnvironment) Interfaces() ([]networking.Interface, error)
Interfaces implements Environment
func (*GoEnvironment) ListenUDP ¶ added in v0.9.1
func (e *GoEnvironment) ListenUDP(network string, laddr *net.UDPAddr) (networking.UDPConn, error)
ListenUDP implements Environment by wrapping net.ListenUDP
func (*GoEnvironment) NewWgClient ¶ added in v0.10.0
func (e *GoEnvironment) NewWgClient() (internal.WgClient, error)
NewWgClient implements Environment by wrapping wgctrl.New()
type GoInterface ¶
GoInterface provides as much of Interface as the go runtime can
func (*GoInterface) AddAddr ¶ added in v0.13.0
func (i *GoInterface) AddAddr(net.IPNet) error
AddAddr implements Interface, returns ErrAddAddrUnsupported
func (*GoInterface) Addrs ¶
func (i *GoInterface) Addrs() ([]net.IPNet, error)
Addrs implements Interface, looks up the IP addresses for the interface
func (*GoInterface) IsUp ¶
func (i *GoInterface) IsUp() bool
IsUp implements Interface, checks for FlagUp
func (*GoInterface) Name ¶
func (i *GoInterface) Name() string
Name implements Interface, gets its name
type GoUDPConn ¶ added in v0.9.1
GoUDPConn implements networking.UDPConn by wrapping net.UDPConn
func (*GoUDPConn) ReadPackets ¶ added in v0.9.1
func (c *GoUDPConn) ReadPackets( ctx context.Context, maxSize int, packets chan<- *networking.UDPPacket, ) error
ReadPackets implements networking.UDPConn. TODO: the cancellation context won't be obeyed very well. Methodology loosely adapted from: https://medium.com/@zombiezen/canceling-i-o-in-go-capn-proto-5ae8c09c5b29 via https://github.com/golang/go/issues/20280#issue-227074518 UDP makes this simpler however as partial reads are not a concern