udp

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MTU = 9001

Variables

This section is empty.

Functions

func NewUDPStatsEmitter

func NewUDPStatsEmitter(udpConns []Conn) func()

func ParseIPAndPort

func ParseIPAndPort(s string) (net.IP, uint16, error)

Types

type Addr

type Addr struct {
	IP   net.IP
	Port uint16
}

func NewAddr

func NewAddr(ip net.IP, port uint16) *Addr

func NewAddrFromString

func NewAddrFromString(s string) *Addr

func (*Addr) Copy

func (ua *Addr) Copy() *Addr

func (*Addr) Equals

func (ua *Addr) Equals(t *Addr) bool

func (*Addr) MarshalJSON

func (ua *Addr) MarshalJSON() ([]byte, error)

func (*Addr) String

func (ua *Addr) String() string

type AddrSlice

type AddrSlice []*Addr

func (AddrSlice) Equal

func (a AddrSlice) Equal(b AddrSlice) bool

type Conn

type Conn interface {
	Rebind() error
	LocalAddr() (*Addr, error)
	ListenOut(r EncReader, lhf LightHouseHandlerFunc, cache *firewall.ConntrackCacheTicker, q int)
	WriteTo(b []byte, addr *Addr) error
	ReloadConfig(c *config.C)
	Close() error
}

func NewListener

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

type EncReader

type EncReader func(
	addr *Addr,
	out []byte,
	packet []byte,
	header *header.H,
	fwPacket *firewall.Packet,
	lhh LightHouseHandlerFunc,
	nb []byte,
	q int,
	localCache firewall.ConntrackCache,
)

type LightHouseHandlerFunc

type LightHouseHandlerFunc func(rAddr *Addr, vpnIp iputil.VpnIp, p []byte)

type NoopConn

type NoopConn struct{}

func (NoopConn) Close

func (NoopConn) Close() error

func (NoopConn) ListenOut

func (NoopConn) LocalAddr

func (NoopConn) LocalAddr() (*Addr, error)

func (NoopConn) Rebind

func (NoopConn) Rebind() error

func (NoopConn) ReloadConfig

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

func (NoopConn) WriteTo

func (NoopConn) WriteTo(_ []byte, _ *Addr) 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) ListenOut

func (u *StdConn) ListenOut(r EncReader, lhf LightHouseHandlerFunc, cache *firewall.ConntrackCacheTicker, q int)

func (*StdConn) LocalAddr

func (u *StdConn) LocalAddr() (*Addr, 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) WriteTo

func (u *StdConn) WriteTo(b []byte, addr *Addr) error

Jump to

Keyboard shortcuts

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