nettool

package
v17.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IP2Addr added in v17.8.0

func IP2Addr(ip net.IP) (netip.Addr, bool)

func IsEqualMultiURL added in v17.8.0

func IsEqualMultiURL(a, b MultiURL) bool

func ListenConfigWithOSTCPKeepAlive

func ListenConfigWithOSTCPKeepAlive() *net.ListenConfig

ListenConfigWithOSTCPKeepAlive return a net.ListeConfig with OS-level KeepAlive settings.

func ListenWithOSTCPKeepAlive

func ListenWithOSTCPKeepAlive(network, address string) (net.Listener, error)

func TLSListenWithOSTCPKeepAlive

func TLSListenWithOSTCPKeepAlive(network, laddr string, config *tls.Config) (net.Listener, error)

Types

type ConnectionSet added in v17.5.0

type ConnectionSet interface {
	Set(connID int64) error
	Unset(connID int64) error
	GC(context.Context) error
}

type ListenerMetrics added in v17.5.0

type ListenerMetrics struct {
	Log      *slog.Logger
	NewSet   NewConnectionSet
	GCPeriod time.Duration
	ErrRep   errz.ErrReporter
	// contains filtered or unexported fields
}

func (*ListenerMetrics) RunGC added in v17.5.0

func (m *ListenerMetrics) RunGC(ctx context.Context)

func (*ListenerMetrics) Wrap added in v17.5.0

func (m *ListenerMetrics) Wrap(l net.Listener, name string, ttl time.Duration) (net.Listener, error)

Wrap wraps the provided listener. Can be called concurrently.

type LookupIPAddr added in v17.8.1

type LookupIPAddr func(ctx context.Context, host string) ([]net.IPAddr, error)

type MultiURL added in v17.8.0

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

MultiURL is an immutable URL that has scheme, port, and one or more IP addresses.

func MultiURLFromURL added in v17.8.0

func MultiURLFromURL(ctx context.Context, u *url.URL, resolve LookupIPAddr) (MultiURL, error)

MultiURLFromURL turns a URL into a MultiURL. The provided URL must: - not be an opaque. - have a scheme. - host must be an IP address or a domain to be resolved. - have a port. Context is used for DNS resolution when resolve is provided and the host is not an IP address.

func NewMultiURL added in v17.8.0

func NewMultiURL(scheme string, addresses []netip.Addr, port uint16) MultiURL

func ParseMultiURL added in v17.8.0

func ParseMultiURL(addr string) (MultiURL, error)

ParseMultiURL parses addr according to the following opaque URL schema: scheme:ip[,ip]|port

func ParseURL added in v17.8.0

func ParseURL(ctx context.Context, addr string, resolve LookupIPAddr) (MultiURL, error)

ParseURL turns a URL into a MultiURL. See MultiURLFromURL.

func (MultiURL) Addresses added in v17.8.0

func (u MultiURL) Addresses() []netip.Addr

func (MultiURL) Port added in v17.8.0

func (u MultiURL) Port() uint16

func (MultiURL) Scheme added in v17.8.0

func (u MultiURL) Scheme() string

func (MultiURL) String added in v17.8.0

func (u MultiURL) String() string

type NewConnectionSet added in v17.5.0

type NewConnectionSet func(name string, ttl time.Duration) (ConnectionSet, error)

type OnceCloseListener added in v17.5.0

type OnceCloseListener struct {
	net.Listener
	// contains filtered or unexported fields
}

OnceCloseListener wraps a net.Listener, protecting it from multiple Close calls.

func (*OnceCloseListener) Close added in v17.5.0

func (oc *OnceCloseListener) Close() error

Jump to

Keyboard shortcuts

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