Documentation
¶
Overview ¶
Package inet defines semantics for IP stacks.
Index ¶
- type Interface
- type InterfaceAddr
- type Stack
- type TCPBufferSize
- type TestStack
- func (s *TestStack) InterfaceAddrs() map[int32][]InterfaceAddr
- func (s *TestStack) Interfaces() map[int32]Interface
- func (s *TestStack) SetTCPReceiveBufferSize(size TCPBufferSize) error
- func (s *TestStack) SetTCPSACKEnabled(enabled bool) error
- func (s *TestStack) SetTCPSendBufferSize(size TCPBufferSize) error
- func (s *TestStack) SupportsIPv6() bool
- func (s *TestStack) TCPReceiveBufferSize() (TCPBufferSize, error)
- func (s *TestStack) TCPSACKEnabled() (bool, error)
- func (s *TestStack) TCPSendBufferSize() (TCPBufferSize, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface struct {
// DeviceType is the device type, a Linux ARPHRD_* constant.
DeviceType uint16
// Flags is the device flags; see netdevice(7), under "Ioctls",
// "SIOCGIFFLAGS, SIOCSIFFLAGS".
Flags uint32
// Name is the device name.
Name string
// Addr is the hardware device address.
Addr []byte
}
Interface contains information about a network interface.
type InterfaceAddr ¶
type InterfaceAddr struct {
// Family is the address family, a Linux AF_* constant.
Family uint8
// PrefixLen is the address prefix length.
PrefixLen uint8
// Flags is the address flags.
Flags uint8
// Addr is the actual address.
Addr []byte
}
InterfaceAddr contains information about a network interface address.
type Stack ¶
type Stack interface {
// Interfaces returns all network interfaces as a mapping from interface
// indexes to interface properties. Interface indices are strictly positive
// integers.
Interfaces() map[int32]Interface
// InterfaceAddrs returns all network interface addresses as a mapping from
// interface indexes to a slice of associated interface address properties.
InterfaceAddrs() map[int32][]InterfaceAddr
// SupportsIPv6 returns true if the stack supports IPv6 connectivity.
SupportsIPv6() bool
// TCPReceiveBufferSize returns TCP receive buffer size settings.
TCPReceiveBufferSize() (TCPBufferSize, error)
// SetTCPReceiveBufferSize attempts to change TCP receive buffer size
// settings.
SetTCPReceiveBufferSize(size TCPBufferSize) error
// TCPSendBufferSize returns TCP send buffer size settings.
TCPSendBufferSize() (TCPBufferSize, error)
// SetTCPSendBufferSize attempts to change TCP send buffer size settings.
SetTCPSendBufferSize(size TCPBufferSize) error
// TCPSACKEnabled returns true if RFC 2018 TCP Selective Acknowledgements
// are enabled.
TCPSACKEnabled() (bool, error)
// SetTCPSACKEnabled attempts to change TCP selective acknowledgement
// settings.
SetTCPSACKEnabled(enabled bool) error
}
Stack represents a TCP/IP stack.
type TCPBufferSize ¶
type TCPBufferSize struct {
// Min is the minimum size.
Min int
// Default is the default size.
Default int
// Max is the maximum size.
Max int
}
TCPBufferSize contains settings controlling TCP buffer sizing.
type TestStack ¶
type TestStack struct {
InterfacesMap map[int32]Interface
InterfaceAddrsMap map[int32][]InterfaceAddr
SupportsIPv6Flag bool
TCPRecvBufSize TCPBufferSize
TCPSendBufSize TCPBufferSize
TCPSACKFlag bool
}
TestStack is a dummy implementation of Stack for tests.
func NewTestStack ¶
func NewTestStack() *TestStack
NewTestStack returns a TestStack with no network interfaces. The value of all other options is unspecified; tests that rely on specific values must set them explicitly.
func (*TestStack) InterfaceAddrs ¶
func (s *TestStack) InterfaceAddrs() map[int32][]InterfaceAddr
InterfaceAddrs implements Stack.InterfaceAddrs.
func (*TestStack) Interfaces ¶
Interfaces implements Stack.Interfaces.
func (*TestStack) SetTCPReceiveBufferSize ¶
func (s *TestStack) SetTCPReceiveBufferSize(size TCPBufferSize) error
SetTCPReceiveBufferSize implements Stack.SetTCPReceiveBufferSize.
func (*TestStack) SetTCPSACKEnabled ¶
SetTCPSACKEnabled implements Stack.SetTCPSACKEnabled.
func (*TestStack) SetTCPSendBufferSize ¶
func (s *TestStack) SetTCPSendBufferSize(size TCPBufferSize) error
SetTCPSendBufferSize implements Stack.SetTCPSendBufferSize.
func (*TestStack) SupportsIPv6 ¶
SupportsIPv6 implements Stack.SupportsIPv6.
func (*TestStack) TCPReceiveBufferSize ¶
func (s *TestStack) TCPReceiveBufferSize() (TCPBufferSize, error)
TCPReceiveBufferSize implements Stack.TCPReceiveBufferSize.
func (*TestStack) TCPSACKEnabled ¶
TCPSACKEnabled implements Stack.TCPSACKEnabled.
func (*TestStack) TCPSendBufferSize ¶
func (s *TestStack) TCPSendBufferSize() (TCPBufferSize, error)
TCPSendBufferSize implements Stack.TCPSendBufferSize.