util

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 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, 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, dial func(context.Context, string, string) (net.Conn, error)) DynDialer

func (DynDialer) DialContext

func (d DynDialer) DialContext(ctx context.Context, network string) (net.Conn, 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