util

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPktBuf = 65536
)

Variables

This section is empty.

Functions

func AllowAllFunc

func AllowAllFunc(_ net.Addr) bool

func AllowByRatelimit

func AllowByRatelimit(z rlzone.Ratelimiter[netip.Addr]) func(net.Addr) bool

func FixedTimeLimitFunc

func FixedTimeLimitFunc(d time.Duration) func() time.Duration

func GenPSK

func GenPSK(length int) ([]byte, error)

func GenPSKHex

func GenPSKHex(length int) (string, error)

func NetAddrToNetipAddrPort

func NetAddrToNetipAddrPort(a net.Addr) netip.AddrPort

func PSKFromHex

func PSKFromHex(input string) ([]byte, error)

func PairConn

func PairConn(ctx context.Context, left, right net.Conn, idleTimeout time.Duration, staleMode StaleMode)

func TimeLimitFunc

func TimeLimitFunc(low, high time.Duration) func() time.Duration

Types

type DynDialer

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

func NewDynDialer

func NewDynDialer(ep func() string) DynDialer

func (DynDialer) DialContext

func (d DynDialer) DialContext(ctx context.Context) (net.PacketConn, net.Addr, error)

type StaleMode

type StaleMode int
const (
	BothStale StaleMode = iota
	EitherStale
	LeftStale
	RightStale
)

func (*StaleMode) Set

func (m *StaleMode) Set(val string) error

func (*StaleMode) String

func (m *StaleMode) String() string

Jump to

Keyboard shortcuts

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