net

package
v0.0.0-...-5613f3b Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InterfaceDownErr       = errors.New("interface down")
	LoopbackInterfaceErr   = errors.New("loopback interface")
	KnownLocalInterfaceErr = errors.New("known local interface")
	NotFoundErr            = errors.New("no IPV4 address found")
)

Functions

func HostIPs

func HostIPs() ([]string, []string, error)

HostIPs returns public and private IPs assigned to various interfaces on current host.

func IsPrivateIP

func IsPrivateIP(ip net.IP) bool

func NodeIP

func NodeIP(interfaceName ...string) (string, net.IP, error)

NodeIP returns a IPv4 address for a given set of interface names. It always prefers a private IP over a public IP. If no interface name is given, all interfaces are checked.

func RoutableIPs

func RoutableIPs() ([]string, []string, error)

RoutableIPs returns routable public and private IPs associated with current host. It will also use https://ipinfo.io/ip to detect public IP, if no public IP is assigned to a host interface.

Types

type IPRange

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

func NewIPRange

func NewIPRange(from string, to string) IPRange

Directories

Path Synopsis
Package httpclient provides a simple Golang Client for JSON Http Microservices Acknowledgement: - [DigitalOcean Go client](https://github.com/digitalocean/godo/blob/master/godo.go) - [OVH Go client](https://github.com/ovh/go-ovh/blob/master/ovh/ovh.go)
Package httpclient provides a simple Golang Client for JSON Http Microservices Acknowledgement: - [DigitalOcean Go client](https://github.com/digitalocean/godo/blob/master/godo.go) - [OVH Go client](https://github.com/ovh/go-ovh/blob/master/ovh/ovh.go)

Jump to

Keyboard shortcuts

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