addr

package
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIPNotFound no IP address found, and explicit IP not provided.
	ErrIPNotFound = errors.New("no IP address found, and explicit IP not provided")
)

Functions

func Extract

func Extract(addr string) (string, error)

Extract returns a valid IP address. If the address provided is a valid address, it will be returned directly. Otherwise the available interfaces be itterated over to find an IP address, prefferably private.

func IPs

func IPs() []string

IPs returns all available interface IP addresses.

func IsLocal

func IsLocal(addr string) bool

IsLocal checks whether an IP belongs to one of the device's interfaces.

Types

This section is empty.

Jump to

Keyboard shortcuts

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