udp

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MTU               = 65535
	BasicLen          = 32
	DefaultNatTimeout = 3 * time.Minute
	DnsQueryTimeout   = 17 * time.Second // RFC 5452
)

Variables

View Source
var AuthFailedErr = fmt.Errorf("auth failed")

Functions

func IPToBin added in v0.1.2

func IPToBin(ip net.IP) string

func New

func New(g *config.Group) (d dispatcher.Dispatcher)

Types

type IPMTUTrie added in v0.1.2

type IPMTUTrie struct {
	// contains filtered or unexported fields
}
var MTUTrie *IPMTUTrie

func NewIPMTUTrieFromInterfaces added in v0.1.2

func NewIPMTUTrieFromInterfaces() (*IPMTUTrie, error)

func (*IPMTUTrie) GetMTU added in v0.1.2

func (t *IPMTUTrie) GetMTU(ip net.IP) int

type UDP added in v0.1.3

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

func (*UDP) Auth added in v0.1.3

func (d *UDP) Auth(buf []byte, data []byte, userContext *config.UserContext) (hit *config.Server, content []byte)

func (*UDP) Close added in v0.1.3

func (d *UDP) Close() (err error)

func (*UDP) GetOrBuildUCPConn added in v0.1.3

func (d *UDP) GetOrBuildUCPConn(laddr net.Addr, data []byte) (rc *net.UDPConn, err error)

connTimeout is the timeout of connection to build if not exists

func (*UDP) Listen added in v0.1.3

func (d *UDP) Listen() (err error)

func (*UDP) UpdateGroup added in v0.1.3

func (d *UDP) UpdateGroup(group *config.Group)

type UDPConn

type UDPConn struct {
	Establishing chan struct{}

	*net.UDPConn
	// contains filtered or unexported fields
}

func NewUDPConn

func NewUDPConn(conn *net.UDPConn) *UDPConn

type UDPConnMapping

type UDPConnMapping struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewUDPConnMapping

func NewUDPConnMapping() *UDPConnMapping

func (*UDPConnMapping) Get

func (m *UDPConnMapping) Get(key string) (conn *UDPConn, ok bool)

func (*UDPConnMapping) Insert

func (m *UDPConnMapping) Insert(key string, val *net.UDPConn) *UDPConn

pass val=nil for stating it is establishing

func (*UDPConnMapping) Remove

func (m *UDPConnMapping) Remove(key string)

Jump to

Keyboard shortcuts

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