udp

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 14 Imported by: 2

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 Conn

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

func NewListener

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

func (*Conn) GetRecvBuffer

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

func (*Conn) GetSendBuffer

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

func (*Conn) ListenOut

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

func (*Conn) LocalAddr

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

func (*Conn) PrepareRawMessages

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

func (*Conn) ReadMulti

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

func (*Conn) ReadSingle

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

func (*Conn) Rebind

func (u *Conn) Rebind() error

func (*Conn) ReloadConfig

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

func (*Conn) SetRecvBuffer

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

func (*Conn) SetSendBuffer

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

func (*Conn) WriteTo

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

type EncReader

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

type EncWriter

type EncWriter interface {
	SendVia(via interface{},
		relay interface{},
		ad,
		nb,
		out []byte,
		nocopy bool,
	)
	SendMessageToVpnIp(t header.MessageType, st header.MessageSubType, vpnIp iputil.VpnIp, p, nb, out []byte)
	Handshake(vpnIp iputil.VpnIp)
}

type LightHouseHandlerFunc

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

Jump to

Keyboard shortcuts

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