udp

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 14 Imported by: 1

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 added in v1.7.0

type AddrSlice []*Addr

func (AddrSlice) Equal added in v1.7.0

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 added in v1.8.0

type NoopConn struct{}

func (NoopConn) Close added in v1.8.0

func (NoopConn) Close() error

func (NoopConn) ListenOut added in v1.8.0

func (NoopConn) LocalAddr added in v1.8.0

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

func (NoopConn) Rebind added in v1.8.0

func (NoopConn) Rebind() error

func (NoopConn) ReloadConfig added in v1.8.0

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

func (NoopConn) WriteTo added in v1.8.0

func (NoopConn) WriteTo(_ []byte, _ *Addr) error

type StdConn added in v1.8.0

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

func (*StdConn) Close added in v1.8.0

func (u *StdConn) Close() error

func (*StdConn) GetRecvBuffer added in v1.8.0

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

func (*StdConn) GetSendBuffer added in v1.8.0

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

func (*StdConn) ListenOut added in v1.8.0

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

func (*StdConn) LocalAddr added in v1.8.0

func (u *StdConn) LocalAddr() (*Addr, error)

func (*StdConn) PrepareRawMessages added in v1.8.0

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

func (*StdConn) ReadMulti added in v1.8.0

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

func (*StdConn) ReadSingle added in v1.8.0

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

func (*StdConn) Rebind added in v1.8.0

func (u *StdConn) Rebind() error

func (*StdConn) ReloadConfig added in v1.8.0

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

func (*StdConn) SetRecvBuffer added in v1.8.0

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

func (*StdConn) SetSendBuffer added in v1.8.0

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

func (*StdConn) WriteTo added in v1.8.0

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