conn

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package conn implements underlay sockets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ReceiveBufferSize is the size of the operating system receive buffer, in
	// bytes.
	ReceiveBufferSize int
}

Config customizes the behavior of an underlay socket.

type Conn

type Conn interface {
	ReadFrom([]byte) (int, *net.UDPAddr, error)
	ReadBatch(Messages) (int, error)
	Write([]byte) (int, error)
	WriteTo([]byte, *net.UDPAddr) (int, error)
	WriteBatch(Messages, int) (int, error)
	LocalAddr() *net.UDPAddr
	RemoteAddr() *net.UDPAddr
	SetReadDeadline(time.Time) error
	SetWriteDeadline(time.Time) error
	SetDeadline(time.Time) error
	Close() error
}

Conn describes the API for an underlay socket

func New

func New(listen, remote *net.UDPAddr, cfg *Config) (Conn, error)

New opens a new underlay socket on the specified addresses.

The config can be used to customize socket behavior.

type Messages

type Messages []ipv4.Message

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

func NewReadMessages(n int) Messages

NewReadMessages allocates memory for reading IPv4 Linux network stack messages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL