udp

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const MTU = 9001

Variables

This section is empty.

Functions

func NewListenConfig

func NewListenConfig(multi bool) net.ListenConfig

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

func NewGenericListener(l *logrus.Logger, ip net.IP, port int, multi bool, batch int) (Conn, 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 GenericConn added in v1.8.0

type GenericConn struct {
	*net.UDPConn
	// contains filtered or unexported fields
}

func (*GenericConn) ListenOut added in v1.8.0

func (*GenericConn) LocalAddr added in v1.8.0

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

func (*GenericConn) Rebind added in v1.8.0

func (u *GenericConn) Rebind() error

func (*GenericConn) ReloadConfig added in v1.8.0

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

func (*GenericConn) WriteTo added in v1.8.0

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

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

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

func NewRIOListener added in v1.8.0

func NewRIOListener(l *logrus.Logger, ip net.IP, port int) (*RIOConn, error)

func (*RIOConn) Close added in v1.8.0

func (u *RIOConn) Close() error

func (*RIOConn) ListenOut added in v1.8.0

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

func (*RIOConn) LocalAddr added in v1.8.0

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

func (*RIOConn) Rebind added in v1.8.0

func (u *RIOConn) Rebind() error

func (*RIOConn) ReloadConfig added in v1.8.0

func (u *RIOConn) ReloadConfig(*config.C)

func (*RIOConn) WriteTo added in v1.8.0

func (u *RIOConn) WriteTo(buf []byte, addr *Addr) error

Jump to

Keyboard shortcuts

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