Documentation ¶
Overview ¶
Package conn implements overlay sockets with additional metadata on reads.
Index ¶
Constants ¶
View Source
const ReceiveBufferSize = 1 << 20
ReceiveBufferSize is the default size, in bytes, of receive buffers for opened sockets.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.4.0
type Config struct { // ReceiveBufferSize is the size of the operating system receive buffer, in // bytes. If 0, the package constant is used instead. ReceiveBufferSize int }
Config customizes the behavior of an overlay socket.
type Conn ¶
type Conn interface { Read(common.RawBytes) (int, *ReadMeta, error) ReadBatch(Messages, []ReadMeta) (int, error) Write(common.RawBytes) (int, error) WriteTo(common.RawBytes, *overlay.OverlayAddr) (int, error) WriteBatch(Messages) (int, error) LocalAddr() *overlay.OverlayAddr RemoteAddr() *overlay.OverlayAddr SetReadDeadline(time.Time) error SetWriteDeadline(time.Time) error SetDeadline(time.Time) error Close() error }
Conn describes the API for an overlay socket with additional metadata on reads.
type Messages ¶ added in v0.4.0
Messages is a list of ipX.Messages. It is necessary to hide the type alias between ipv4.Message, ipv6.Message and socket.Message.
func NewReadMessages ¶
NewReadMessages allocates memory for reading IPv4 Linux network stack messages.
func NewWriteMessages ¶
NewWriteMessages allocates memory for writing IPv4 Linux network stack messages.
type ReadMeta ¶
type ReadMeta struct { // Src is the remote address from which the datagram was received Src *overlay.OverlayAddr // Local is the address on which the datagram was received Local *overlay.OverlayAddr // RcvOvfl is the total number of packets that were dropped by the OS due // to the receive buffers being full. RcvOvfl uint32 // Recvd is the timestamp when the kernel placed the packet in the socket's // receive buffer. Recvd time.Time // ReadDelay is the time elapsed between the kernel adding a packet to the // socket's receive buffer, and the application reading it from the Go // network stack (i.e., kernel to application latency). ReadDelay time.Duration }
ReadMeta contains extra information about socket reads.
Click to show internal directories.
Click to hide internal directories.