netstack

package
v0.0.0-...-e07aa5a Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetStack

type NetStack interface {
	links.Link
	UserStack
}

NetStack represents an IPv6 network stack

func NewStackChannel

func NewStackChannel(ctx context.Context, addr net.IP, mtu uint16) (NetStack, error)

NewStackChannel creates a new network stack

func NewStackDefault

func NewStackDefault(ctx context.Context, addr net.IP, mtu uint16) (NetStack, error)

func NewStackFdbased

func NewStackFdbased(ctx context.Context, addr net.IP, mtu uint16) (NetStack, error)

NewStackFdbased creates a new fdbased network stack

type NetUserStack

type NetUserStack struct{}

NetUserStack provides a UserStack that is a thin wrapper around the Go net library. Used for testing.

func (*NetUserStack) DialContextTCP

func (nus *NetUserStack) DialContextTCP(ctx context.Context, addr net.IP, port uint16) (net.Conn, error)

func (*NetUserStack) DialTCP

func (nus *NetUserStack) DialTCP(addr net.IP, port uint16) (net.Conn, error)

func (*NetUserStack) DialUDP

func (nus *NetUserStack) DialUDP(lport uint16, addr net.IP, rport uint16) (UDPConn, error)

func (*NetUserStack) ListenTCP

func (nus *NetUserStack) ListenTCP(port uint16) (net.Listener, error)

type NewStackFunc

type NewStackFunc func(context.Context, net.IP, uint16) (NetStack, error)

NewStackFunc is the type of a function that creates a new stack

type UDPConn

type UDPConn interface {
	net.Conn
	net.PacketConn
}

UDPConn is functionally equivalent to net.UDPConn

type UserStack

type UserStack interface {
	// DialTCP dials a TCP connection over the network stack.
	DialTCP(addr net.IP, port uint16) (net.Conn, error)
	// DialContextTCP dials a TCP connection over the network stack, using a context.
	DialContextTCP(ctx context.Context, addr net.IP, port uint16) (net.Conn, error)
	// ListenTCP opens a TCP listener over the network stack.
	ListenTCP(port uint16) (net.Listener, error)
	// DialUDP opens a UDP sender or receiver over the network stack.  If addr is nil,
	// rport will be ignored and this socket will only listen on lport.
	DialUDP(lport uint16, addr net.IP, rport uint16) (UDPConn, error)
}

UserStack provides the methods that allow user apps to communicate over a network stack

Jump to

Keyboard shortcuts

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