nettool

package
v18.0.0-rc42 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IP2Addr

func IP2Addr(ip net.IP) (netip.Addr, 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

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

type ListenerMetrics

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

func (*ListenerMetrics) RunGC

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

func (*ListenerMetrics) Wrap

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 MultiURL

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

MultiURL is an immutable URL that has scheme, port, and one or more IP addresses or a host. TLS host can also be supplied.

func MultiURLFromURL

func MultiURLFromURL(u *url.URL, tlsHost string) (MultiURL, error)

MultiURLFromURL turns a URL into a MultiURL. The provided URL must: - not be opaque. - have a scheme. - host must be an IP address or a domain. - have a port. - hostname for TLS can be specified.

func NewMultiURLForAddresses

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

func NewMultiURLForHost

func NewMultiURLForHost(scheme, host, tlsHost string, port uint16) MultiURL

func ParseMultiURL

func ParseMultiURL(addr string) (MultiURL, error)

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

func ParseURL

func ParseURL(addr, tlsHost string) (MultiURL, error)

ParseURL turns a URL into a MultiURL. See MultiURLFromURL.

func (MultiURL) Addresses

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

func (MultiURL) Host

func (u MultiURL) Host() string

func (MultiURL) HostPort

func (u MultiURL) HostPort() string

func (MultiURL) Port

func (u MultiURL) Port() uint16

func (MultiURL) Scheme

func (u MultiURL) Scheme() string

func (MultiURL) String

func (u MultiURL) String() string

func (MultiURL) TLSHost

func (u MultiURL) TLSHost() string

type NewConnectionSet

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

type OnceCloseListener

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

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

func (*OnceCloseListener) Close

func (oc *OnceCloseListener) Close() error

Jump to

Keyboard shortcuts

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