udpmux

package
v1.0.2-0...-0a9ac6a Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMTU uint32 = 8192

Variables

View Source
var (
	ErrConnAlreadyExists = errors.New("connection already exists")
	ErrConnNotFound      = errors.New("connection not found")
)

Functions

This section is empty.

Types

type Conn

type Conn interface {
	net.Conn
	Done() <-chan struct{}
}

type Params

type Params struct {
	Conn           net.PacketConn
	MTU            uint32
	Log            logger.Logger
	ReadChanSize   int
	ReadBufferSize int
}

type UDPMux

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

func New

func New(params Params) *UDPMux

func (*UDPMux) AcceptConn

func (m *UDPMux) AcceptConn() (Conn, error)

AcceptConn reads from Conns channel. It returns io.ErrClosedPipe when the channel is closed. Users should use either AcceptConn or Conns, but never both.

func (*UDPMux) Close

func (m *UDPMux) Close() error

func (*UDPMux) Conns

func (m *UDPMux) Conns() <-chan Conn

Conns is the channel with incoming connections. Users should use either AcceptConn or Conns, but never both.

func (*UDPMux) Done

func (m *UDPMux) Done() <-chan struct{}

func (*UDPMux) GetConn

func (m *UDPMux) GetConn(raddr net.Addr) (Conn, error)

func (*UDPMux) LocalAddr

func (m *UDPMux) LocalAddr() net.Addr

Jump to

Keyboard shortcuts

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