package
0.0.0-20240720002214-37b2b8227b91
Repository: https://github.com/progrium/go-netstack.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
Package checksum provides the implementation of the encoding and decoding of network protocol headers.
Package faketime provides a fake clock that implements tcpip.Clock interface.
No description provided by the author
Package header provides the implementation of the encoding and decoding of network protocol headers.
No description provided by the author
No description provided by the author
Package ports provides PortManager that manages allocating, reserving and releasing ports.
Package seqnum defines the types and methods for TCP sequence numbers such that they fit in 32-bit words and work properly when overflows occur.
Package stack provides the glue between networking protocols and the consumers of the networking stack.
Package transport supports transport protocols.

# Functions

AddDanglingEndpoint adds a dangling endpoint.
AddrFrom16 converts addr to an Address.
AddrFrom16Slice converts addr to an Address.
AddrFrom4 converts addr to an Address.
AddrFrom4Slice converts addr to an Address.
AddrFromSlice converts addr to an Address.
DeleteDanglingEndpoint removes a dangling endpoint.
GetDanglingEndpoints returns all dangling endpoints.
GetStackReceiveBufferLimits is used to get default, min and max send buffer size.
GetStackSendBufferLimits is used to get default, min and max send buffer size.
InitStatCounters initializes v's fields with nil StatCounter fields to new StatCounters.
MaskFrom returns a Mask based on str.
MaskFromBytes returns a Mask based on bs.
MonotonicTimeInfinite returns the monotonic timestamp as far away in the future as possible.
NewJob returns a new Job that can be used to schedule f to run in its own gorountine.
NewStdClock returns an instance of a clock that uses the time package.
NewStdTimer returns a Timer implemented with the time package.
NewSubnet creates a new Subnet, checking that the address and mask are the same length.
ParseMACAddress parses an IEEE 802 address.
ReleaseDanglingEndpoints clears out all all reference counted objects held by dangling endpoints.

# Constants

Disorder indicates the sender either received some SACK blocks or dupACK's.
FastRecovery indicates that the sender has entered FastRecovery based on receiving nDupAck's.
IPv4TOSOption is used by SetSockOptInt/GetSockOptInt to specify TOS for all subsequent outgoing IPv4 packets from the endpoint.
IPv4TTLOption is used by SetSockOptInt/GetSockOptInt to control the default TTL value for unicast messages.
IPv6Checksum is used to request the stack to populate and validate the IPv6 checksum for transport level headers.
IPv6HopLimitOption is used by SetSockOptInt/GetSockOptInt to control the default hop limit value for unicast messages.
IPv6TrafficClassOption is used by SetSockOptInt/GetSockOptInt to specify TOS for all subsequent outgoing IPv6 packets from the endpoint.
KeepaliveCountOption is used by SetSockOptInt/GetSockOptInt to specify the number of un-ACKed TCP keepalives that will be sent before the connection is closed.
MaxSegOption is used by SetSockOptInt/GetSockOptInt to set/get the current Maximum Segment Size(MSS) value as specified using the TCP_MAXSEG option.
MTUDiscoverOption is used to set/get the path MTU discovery setting.
MulticastTTLOption is used by SetSockOptInt/GetSockOptInt to control the default TTL value for multicast messages.
Open indicates that the sender is receiving acks in order and no loss or dupACK's etc have been detected.
PacketBroadcast indicates a link layer broadcast packet.
PacketHost indicates a packet addressed to the local host.
PacketMulticast indicates a link layer multicast packet.
PacketOtherHost indicates an outgoing packet addressed to another host caught by a NIC in promiscuous mode.
PacketOutgoing for a packet originating from the local host that is looped back to a packet socket.
PMTUDiscoveryDo is a setting of the MTUDiscoverOption to always do path MTU discovery.
PMTUDiscoveryDont is a setting of the MTUDiscoverOption to disable path MTU discovery.
PMTUDiscoveryProbe is a setting of the MTUDiscoverOption to set DF but ignore path MTU.
PMTUDiscoveryWant is a setting of the MTUDiscoverOption to use per-route settings.
ReceiveQueueSizeOption is used in GetSockOptInt to specify that the number of unread bytes in the input buffer should be returned.
RTORecovery indicates that an RTO has occurred and the sender has entered an RTO based recovery phase.
SACKRecovery indicates that the sender has entered SACK based recovery.
SendQueueSizeOption is used in GetSockOptInt to specify that the number of unread bytes in the output buffer should be returned.
Values of the flags that can be passed to the Shutdown() method.
Values of the flags that can be passed to the Shutdown() method.
SockExtErrorOriginICMP indicates an IPv4 ICMP error.
SockExtErrorOriginICMP6 indicates an IPv6 ICMP error.
SockExtErrorOriginLocal indicates a local error.
SockExtErrorOriginNone represents an unknown error origin.
TCPRACKLossDetection indicates RACK is used for loss detection and recovery.
TCPRACKNoDupTh indicates RACK should not consider the classic three duplicate acknowledgements rule to mark the segments as lost.
TCPRACKStaticReoWnd indicates the reordering window should not be adjusted when DSACK is received.
TCPSynCountOption is used by SetSockOptInt/GetSockOptInt to specify the number of SYN retransmits that TCP should send before aborting the attempt to connect.
TCPTimeWaitReuseDisabled indicates reuse of port bound by endponts in TIME-WAIT cannot be reused for new connections.
TCPTimeWaitReuseGlobal indicates reuse of port bound by endponts in TIME-WAIT can be reused for new connections irrespective of the src/dest addresses.
TCPTimeWaitReuseLoopbackOnly indicates reuse of port bound by endpoint in TIME-WAIT can only be reused if the connection was a connection over loopback.
TCPWindowClampOption is used by SetSockOptInt/GetSockOptInt to bound the size of the advertised window to this value.
UseDefaultIPv4TTL is the IPv4TTLOption value that configures an endpoint to use the default ttl currently configured by the IPv4 protocol (see DefaultTTLOption).
UseDefaultIPv6HopLimit is the IPv6HopLimitOption value that configures an endpoint to use the default hop limit currently configured by the IPv6 protocol (see DefaultTTLOption).

# Variables

AsyncLoading is the global barrier for asynchronous endpoint loading activities.

# Structs

Address is a byte slice cast as a string that represents the address of a network node.
AddressMask is a bitmask for an address.
AddressWithPrefix is an address with its subnet prefix length.
ARPStats collects ARP-specific stats.
DefaultSocketOptionsHandler is an embeddable type that implements no-op implementations for SocketOptionsHandler methods.
ErrAborted indicates the operation was aborted.
ErrAddressFamilyNotSupported indicates the operation does not support the given address family.
ErrAlreadyBound indicates the endpoint is already bound.
ErrAlreadyConnected indicates the endpoint is already connected.
ErrAlreadyConnecting indicates the endpoint is already connecting.
ErrBadAddress indicates a bad address was provided.
ErrBadBuffer indicates a bad buffer was provided.
ErrBadLocalAddress indicates a bad local address was provided.
ErrBroadcastDisabled indicates broadcast is not enabled on the endpoint.
ErrClosedForReceive indicates the endpoint is closed for incoming data.
ErrClosedForSend indicates the endpoint is closed for outgoing data.
ErrConnectionAborted indicates the connection was aborted.
ErrConnectionRefused indicates the connection was refused.
ErrConnectionReset indicates the connection was reset.
ErrConnectStarted indicates the endpoint is connecting asynchronously.
ErrDestinationRequired indicates the operation requires a destination address, and one was not provided.
ErrDuplicateAddress indicates the operation encountered a duplicate address.
ErrDuplicateNICID indicates the operation encountered a duplicate NIC ID.
ErrHostDown indicates that a destination host is down.
ErrHostUnreachable indicates that a destination host could not be reached.
ErrInvalidEndpointState indicates the endpoint is in an invalid state.
ErrInvalidOptionValue indicates an invalid option value was provided.
ErrInvalidPortRange indicates an attempt to set an invalid port range.
ErrMalformedHeader indicates the operation encountered a malformed header.
ErrMessageTooLong indicates the operation encountered a message whose length exceeds the maximum permitted.
ErrMissingRequiredFields indicates that a required field is missing.
ErrMulticastInputCannotBeOutput indicates that an input interface matches an output interface in the same multicast route.
ErrNetworkUnreachable indicates the operation is not able to reach the destination network.
ErrNoBufferSpace indicates no buffer space is available.
ErrNoNet indicates that the host is not on the network.
ErrNoPortAvailable indicates no port could be allocated for the operation.
ErrNoSuchFile is used to indicate that ENOENT should be returned the to calling application.
ErrNotConnected indicates the endpoint is not connected.
ErrNotPermitted indicates the operation is not permitted.
ErrNotSupported indicates the operation is not supported.
ErrPortInUse indicates the provided port is in use.
ErrQueueSizeNotSupported indicates the endpoint does not allow queue size operation.
ErrSaveRejection indicates a failed save due to unsupported networking state.
ErrTimeout indicates the operation timed out.
ErrUnknownDevice indicates an unknown device identifier was provided.
ErrUnknownNICID indicates an unknown NIC ID was provided.
ErrUnknownProtocol indicates an unknown protocol was requested.
ErrUnknownProtocolOption indicates an unknown protocol option was provided.
ErrWouldBlock indicates the operation would block.
FullAddress represents a full transport node address, as required by the Connect() and Bind() methods.
ICMPStats collects ICMP-specific stats (both v4 and v6).
ICMPv4PacketStats enumerates counts for all ICMPv4 packet types.
ICMPv4ReceivedPacketStats collects inbound ICMPv4-specific stats.
ICMPv4SentPacketStats collects outbound ICMPv4-specific stats.
ICMPv4Stats collects ICMPv4-specific stats.
ICMPv6Filter specifes a filter for ICMPv6 types.
ICMPv6PacketStats enumerates counts for all ICMPv6 packet types.
ICMPv6ReceivedPacketStats collects inbound ICMPv6-specific stats.
ICMPv6SentPacketStats collects outbound ICMPv6-specific stats.
ICMPv6Stats collects ICMPv6-specific stats.
IGMPPacketStats enumerates counts for all IGMP packet types.
IGMPReceivedPacketStats collects inbound IGMP-specific stats.
IGMPSentPacketStats collects outbound IGMP-specific stats.
IGMPStats collects IGMP-specific stats.
IntegralStatCounterMap holds a map associating integral keys with StatCounters.
IPForwardingStats collects stats related to IP forwarding (both v4 and v6).
IPPacketInfo is the message structure for IP_PKTINFO.
IPStats collects IP-specific stats (both v4 and v6).
IPv6PacketInfo is the message structure for IPV6_PKTINFO.
Job represents some work that can be scheduled for execution.
A LimitedWriter writes to W but limits the amount of data copied to just N bytes.
LingerOption is used by SetSockOpt/GetSockOpt to set/get the duration for which a socket lingers before returning from Close.
LinkPacketInfo holds Link layer information for a received packet.
LocalSockError is a socket error that originated from the local host.
MembershipOption is used to identify a multicast membership on an interface.
MonotonicTime is a monotonic clock reading.
MulticastInterfaceOption is used by SetSockOpt/GetSockOpt to specify a default interface for multicast.
A MultiCounterStat keeps track of two counters at once.
A MultiIntegralStatCounterMap keeps track of two integral counter maps at once.
NICNeighborStats holds metrics for the neighbor table.
NICPacketStats holds basic packet statistics.
NICStats holds NIC statistics.
ProtocolAddress is an address and the network protocol it is associated with.
ReadErrors collects segment read errors from an endpoint read call.
ReadOptions contains options for Endpoint.Read.
ReadResult represents result for a successful Endpoint.Read.
ReceivableControlMessages contains socket control messages that can be received.
ReceiveBufferSizeOption is used by stack.(Stack*).Option/SetOption to get/set the default, min and max receive buffer sizes.
ReceiveErrors collects packet receive errors within transport endpoint.
Route is a row in the routing table.
SendableControlMessages contains socket control messages that can be written.
SendBufferSizeOption is used by stack.(Stack*).Option/SetOption to get/set the default, min and max send buffer sizes.
SendErrors collects packet send errors within the transport layer for an endpoint.
SockError represents a queue entry in the per-socket error queue.
SocketOptions contains all the variables which store values for SOL_SOCKET, SOL_IP, SOL_IPV6 and SOL_TCP level options.
A StatCounter keeps track of a statistic.
Stats holds statistics about the networking stack.
Subnet is a subnet defined by its address and mask.
TCPInfoOption is used by GetSockOpt to expose TCP statistics.
TCPReceiveBufferSizeRangeOption is the receive buffer size range for TCP.
TCPSendBufferSizeRangeOption is the send buffer size range for TCP.
TCPStats collects TCP-specific stats.
TransportEndpointStats collects statistics about the endpoint.
UDPStats collects UDP-specific stats.
WriteErrors collects packet write errors from an endpoint write call.
WriteOptions contains options for Endpoint.Write.

# Interfaces

A Clock provides the current time and schedules work for execution.
Endpoint is the interface implemented by transport protocols (e.g., tcp, udp) that exposes functionality like read, write, connect, etc.
EndpointInfo is the interface implemented by each endpoint info struct.
EndpointStats is the interface implemented by each endpoint stats struct.
EndpointWithPreflight is the interface implemented by endpoints that need to expose the `Preflight` method for preparing the endpoint prior to calling `Write`.
Error represents an error in the netstack error space.
GettableNetworkProtocolOption is a marker interface for network protocol options that may be queried.
GettableSocketOption is a marker interface for socket options that may be queried.
GettableTransportProtocolOption is a marker interface for transport protocol options that may be queried.
PacketOwner is used to get UID and GID of the packet.
Payloader is an interface that provides data.
SettableNetworkProtocolOption is a marker interface for network protocol options that may be set.
SettableSocketOption is a marker interface for socket options that may be configured.
SettableTransportProtocolOption is a marker interface for transport protocol options that may be set.
SockErrorCause is the cause of a socket error.
SocketOptionsHandler holds methods that help define endpoint specific behavior for socket level socket options.
StackHandler holds methods to access the stack options.
Timer represents a single event.

# Type aliases

AddMembershipOption identifies a multicast group to join on some interface.
CongestionControlOption is used by SetSockOpt/GetSockOpt to set/get the current congestion control algorithm.
CongestionControlState indicates the current congestion control state for TCP sender.
DefaultTTLOption is used by stack.(*Stack).NetworkProtocolOption to specify a default TTL.
EndpointState represents the state of an endpoint.
GetReceiveBufferLimits is used to get the send buffer size limits.
GetSendBufferLimits is used to get the send buffer size limits.
KeepaliveIdleOption is used by SetSockOpt/GetSockOpt to specify the time a connection must remain idle before the first TCP keepalive packet is sent.
KeepaliveIntervalOption is used by SetSockOpt/GetSockOpt to specify the interval between sending TCP keepalive packets.
LinkAddress is a byte slice cast as a string that represents a link address.
NetworkProtocolNumber is the EtherType of a network protocol in an Ethernet frame.
NICID is a number that uniquely identifies a NIC.
OriginalDestinationOption is used to get the original destination address and port of a redirected packet.
PacketType is used to indicate the destination of the packet.
RemoveMembershipOption identifies a multicast group to leave on some interface.
ShutdownFlags represents flags that can be passed to the Shutdown() method of the Endpoint interface.
SliceWriter implements io.Writer for slices.
SockErrOrigin represents the constants for error origin.
SocketDetachFilterOption is used by SetSockOpt to detach a previously attached classic BPF filter on a given endpoint.
SockOptInt represents socket options which values have the int type.
TCPAlwaysUseSynCookies indicates unconditional usage of syncookies.
TCPAvailableCongestionControlOption is the supported congestion control algorithms for TCP.
TCPDeferAcceptOption is used by SetSockOpt/GetSockOpt to allow a accept to return a completed connection only when there is data to be read.
TCPDelayEnabled enables/disables Nagle's algorithm in TCP.
TCPLingerTimeoutOption is used by SetSockOpt/GetSockOpt to set/get the maximum duration for which a socket lingers in the TCP_FIN_WAIT_2 state before being marked closed.
TCPMaxRetriesOption is used by SetSockOpt/GetSockOpt to set/get the maximum number of retransmits after which we time out the connection.
TCPMaxRTOOption is use by SetSockOpt/GetSockOpt to allow overriding default MaxRTO used by the Stack.
TCPMinRTOOption is use by SetSockOpt/GetSockOpt to allow overriding default MinRTO used by the Stack.
TCPModerateReceiveBufferOption enables/disables receive buffer moderation for TCP.
TCPRecovery is the loss deteoction algorithm used by TCP.
TCPSACKEnabled the SACK option for TCP.
TCPSynRetriesOption is used by SetSockOpt/GetSockOpt to specify stack-wide default for number of times SYN is retransmitted before aborting a connect.
TCPTimeWaitReuseOption is used stack.(*Stack).TransportProtocolOption to specify if the stack can reuse the port bound by an endpoint in TIME-WAIT for new connections when it is safe from protocol viewpoint.
TCPTimeWaitTimeoutOption is used by SetSockOpt/GetSockOpt to set/get the maximum duration for which a socket lingers in the TIME_WAIT state before being marked closed.
TCPUserTimeoutOption is used by SetSockOpt/GetSockOpt to specify a user specified timeout for a given TCP connection.
TransportProtocolNumber is the number of a transport protocol.