Documentation ¶
Overview ¶
Package system provides a portable interface to low-level system networking operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLinkChange = errors.New("link state change")
ErrLinkChange is a sentinel value which indicates a link state change.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface { ReadFrom() (ndp.Message, *ipv6.ControlMessage, net.IP, error) SetReadDeadline(t time.Time) error WriteTo(m ndp.Message, cm *ipv6.ControlMessage, dst net.IP) error }
A Conn abstracts IPv6 NDP socket operations for purposes of testing.
type DialContext ¶
type DialContext struct { Conn Conn Interface *net.Interface IP net.IP // contains filtered or unexported fields }
A DialContext stores data used in the context of a Dialer.Dial closure.
type Dialer ¶
type Dialer struct { // DialFunc specifies a function which will override the default dialing // logic to produce an arbitrary DialContext. DialFunc should only be // set in tests. DialFunc func() *DialContext // contains filtered or unexported fields }
A Dialer can create Conns which can be reinitialized on certain errors.
func (*Dialer) Dial ¶
func (d *Dialer) Dial(ctx context.Context, fn func(ctx context.Context, dctx *DialContext) error) error
Dial creates a Conn and invokes fn with a populated DialContext for the caller's use. If fn returns an error which is considered retryable, Dial will attempt to re-dial the Conn and invoke fn again.
type State ¶
type State interface { IPv6Autoconf(iface string) (bool, error) IPv6Forwarding(iface string) (bool, error) }
State is a type which can manipulate the low-level IPv6 parameters of a system.
type TestState ¶
type TestState struct { // Global settings for any interface name. Autoconf, Forwarding bool Error error // Alternatively, you may configure parameters individually on a // per-interface basis. Note that these configurations will override any // global configurations set above. Interfaces map[string]TestStateInterface }
A TestState is a State which is primarily useful in tests.
func (TestState) IPv6Autoconf ¶
IPv6Autoconf implements State.
type TestStateInterface ¶
type TestStateInterface struct {
Autoconf, Forwarding bool
}
A TestStateInterface sets the State configuration for a simulated network interface.