udp

package
v1.9.6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MTU = 9001

Variables

This section is empty.

Functions

func NewUDPStatsEmitter

func NewUDPStatsEmitter(udpConns []Conn) func()

Types

type Conn

type Conn interface {
	Rebind() error
	LocalAddr() (netip.AddrPort, error)
	ListenOut(r EncReader)
	WriteTo(b []byte, addr netip.AddrPort) error
	ReloadConfig(c *config.C)
	Close() error
}

func NewListener

func NewListener(l *logrus.Logger, ip netip.Addr, port int, multi bool, batch int) (Conn, error)

type EncReader

type EncReader func(
	addr netip.AddrPort,
	payload []byte,
)

type NoopConn

type NoopConn struct{}

func (NoopConn) Close

func (NoopConn) Close() error

func (NoopConn) ListenOut

func (NoopConn) ListenOut(_ EncReader)

func (NoopConn) LocalAddr

func (NoopConn) LocalAddr() (netip.AddrPort, error)

func (NoopConn) Rebind

func (NoopConn) Rebind() error

func (NoopConn) ReloadConfig

func (NoopConn) ReloadConfig(_ *config.C)

func (NoopConn) WriteTo

func (NoopConn) WriteTo(_ []byte, _ netip.AddrPort) error

type StdConn

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

func (*StdConn) Close

func (u *StdConn) Close() error

func (*StdConn) GetRecvBuffer

func (u *StdConn) GetRecvBuffer() (int, error)

func (*StdConn) GetSendBuffer

func (u *StdConn) GetSendBuffer() (int, error)

func (*StdConn) GetSoMark

func (u *StdConn) GetSoMark() (int, error)

func (*StdConn) ListenOut

func (u *StdConn) ListenOut(r EncReader)

func (*StdConn) LocalAddr

func (u *StdConn) LocalAddr() (netip.AddrPort, error)

func (*StdConn) PrepareRawMessages

func (u *StdConn) PrepareRawMessages(n int) ([]rawMessage, [][]byte, [][]byte)

func (*StdConn) ReadMulti

func (u *StdConn) ReadMulti(msgs []rawMessage) (int, error)

func (*StdConn) ReadSingle

func (u *StdConn) ReadSingle(msgs []rawMessage) (int, error)

func (*StdConn) Rebind

func (u *StdConn) Rebind() error

func (*StdConn) ReloadConfig

func (u *StdConn) ReloadConfig(c *config.C)

func (*StdConn) SetRecvBuffer

func (u *StdConn) SetRecvBuffer(n int) error

func (*StdConn) SetSendBuffer

func (u *StdConn) SetSendBuffer(n int) error

func (*StdConn) SetSoMark

func (u *StdConn) SetSoMark(mark int) error

func (*StdConn) WriteTo

func (u *StdConn) WriteTo(b []byte, ip netip.AddrPort) error

Jump to

Keyboard shortcuts

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