util

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuitableAddress  = errors.New("no suitable address")
	ErrBadIPAddressLength = errors.New("bad IP address length")
	ErrUnknownNetwork     = errors.New("unknown network")
)

Functions

func CheckedUnmarshal

func CheckedUnmarshal(doc *yaml.Node, dst interface{}) error

func Max

func Max[T constraints.Ordered](x, y T) T

func Min

func Min[T constraints.Ordered](x, y T) T

func Must

func Must[V any](value V, err error) V

func ResolveInterface

func ResolveInterface(spec string) (*net.Interface, error)

func SplitAndResolveAddrSpec

func SplitAndResolveAddrSpec(spec string) (string, *net.Interface, error)

Types

type BoundDialer

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

func NewBoundDialer

func NewBoundDialer(defaultDialer BoundDialerDefaultSink, defaultHints string) *BoundDialer

func (*BoundDialer) Dial

func (d *BoundDialer) Dial(network, address string) (net.Conn, error)

func (*BoundDialer) DialContext

func (d *BoundDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type BoundDialerContextKey

type BoundDialerContextKey struct{}

type BoundDialerContextValue

type BoundDialerContextValue struct {
	Hints     *string
	LocalAddr string
}

type BoundDialerDefaultSink

type BoundDialerDefaultSink interface {
	DialContext(ctx context.Context, network, address string) (net.Conn, error)
}

type IPAddr

type IPAddr netip.Addr

func (*IPAddr) Addr

func (a *IPAddr) Addr() netip.Addr

func (*IPAddr) MarshalYAML

func (a *IPAddr) MarshalYAML() (interface{}, error)

func (*IPAddr) String

func (a *IPAddr) String() string

func (*IPAddr) UnmarshalYAML

func (a *IPAddr) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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