network

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPrivateIP       = errors.New("cannot get private IP address")
	ErrLocalAddrNotUDP = errors.New("local address is not UDP")
)

Functions

This section is empty.

Types

type Interface added in v0.2.0

type Interface interface {
	OutboundIP(ctx context.Context) (ip string, err error)
	PublicIP(ctx context.Context) (ip string, err error)
	Check(ctx context.Context, urls []string) (errors []error)
}

type Network

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

func New

func New(resolver *net.Resolver) (n *Network, err error)

func (*Network) Check added in v0.2.0

func (n *Network) Check(ctx context.Context, urls []string) (errors []error)

func (*Network) OutboundIP added in v0.2.0

func (n *Network) OutboundIP(ctx context.Context) (ip string, err error)

OutboundIP obtains the preferred outbound ip of this machine. TODO find from routing table.

func (*Network) PublicIP added in v0.2.0

func (n *Network) PublicIP(ctx context.Context) (ip string, err error)

Jump to

Keyboard shortcuts

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