netc

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinBackoff time.Duration = 10 * time.Millisecond
	MaxBackoff time.Duration = 15 * time.Second
)

Variables

This section is empty.

Functions

func GenServerName added in v0.7.0

func GenServerName(prefix string) string

func LocalAddrs

func LocalAddrs() ([]netip.Addr, error)

func NextBackoff

func NextBackoff(d time.Duration) time.Duration

func NextBackoffCustom

func NextBackoffCustom(d, jmin, jmax time.Duration) time.Duration

func ParseCIDR added in v0.5.0

func ParseCIDR(str string) (netip.Prefix, error)

func ParseCIDRs added in v0.5.0

func ParseCIDRs(strs []string) ([]netip.Prefix, error)

Types

type Joiner added in v0.7.0

type Joiner struct {
	Accept func(context.Context) (net.Conn, error)
	Dial   func(context.Context) (net.Conn, error)
	Join   func(ctx context.Context, acceptConn net.Conn, dialConn net.Conn)
}

func (*Joiner) Run added in v0.7.0

func (j *Joiner) Run(ctx context.Context) error

type SpinBackoff added in v0.7.0

type SpinBackoff struct {
	MinBackoff time.Duration
	MaxBackoff time.Duration
	// contains filtered or unexported fields
}

func (*SpinBackoff) Wait added in v0.7.0

func (s *SpinBackoff) Wait(ctx context.Context) error

Wait will block on backoff if called too often

Jump to

Keyboard shortcuts

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