netopus

package
v0.0.0-...-d773db1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = fmt.Errorf("not implemented")
View Source
var ErrPortInUse = fmt.Errorf("port in use")
View Source
var ErrTimeout = fmt.Errorf("timeout")

Functions

func DialOOB

func DialOOB(ctx context.Context, raddr proto.OOBAddr, pc *OOBPacketConn) (net.Conn, error)

func LeastMTU

func LeastMTU(node config.Node, defaultMTU uint16) uint16

LeastMTU gives the smallest MTU of any backend defined on a node. If there are no backends, defaultMTU is returned.

func ListenOOB

func ListenOOB(ctx context.Context, pc *OOBPacketConn) (net.Listener, error)

func New

func New(ctx context.Context, addr proto.IP, name string, opts ...func(*npOpts)) (proto.Netopus, error)

New constructs and returns a new network node on a given address

func WithMTU

func WithMTU(mtu uint16) func(*npOpts)

func WithNewConfigFunc

func WithNewConfigFunc(ncf func([]byte, []byte)) func(*npOpts)

Types

type OOBCloseFunc

type OOBCloseFunc func() error

type OOBConn

type OOBConn struct {
	*kcp.UDPSession
	// contains filtered or unexported fields
}

type OOBListener

type OOBListener struct {
	*kcp.Listener
	// contains filtered or unexported fields
}

func (*OOBListener) Accept

func (l *OOBListener) Accept() (net.Conn, error)

type OOBOutboundFunc

type OOBOutboundFunc func(message *proto.OOBMessage) error

type OOBPacketConn

type OOBPacketConn struct {
	// contains filtered or unexported fields
}

func NewPacketConn

func NewPacketConn(ctx context.Context, sendFunc OOBOutboundFunc, closeFunc OOBCloseFunc, sourceAddr proto.IP, sourcePort uint16) (*OOBPacketConn, error)

func (*OOBPacketConn) Close

func (c *OOBPacketConn) Close() error

func (*OOBPacketConn) IncomingPacket

func (c *OOBPacketConn) IncomingPacket(msg *proto.OOBMessage) error

func (*OOBPacketConn) LocalAddr

func (c *OOBPacketConn) LocalAddr() net.Addr

func (*OOBPacketConn) ReadFrom

func (c *OOBPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*OOBPacketConn) SetDeadline

func (c *OOBPacketConn) SetDeadline(t time.Time) error

func (*OOBPacketConn) SetReadDeadline

func (c *OOBPacketConn) SetReadDeadline(t time.Time) error

func (*OOBPacketConn) SetWriteDeadline

func (c *OOBPacketConn) SetWriteDeadline(_ time.Time) error

func (*OOBPacketConn) WriteTo

func (c *OOBPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

Jump to

Keyboard shortcuts

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