ip

package
v2.929.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NetworkInterfaceToAddrsFunc

func NetworkInterfaceToAddrsFunc(interfaceName string) ([]gonet.Addr, error)

Types

type IPProtocol added in v2.758.0

type IPProtocol int
const (
	IPv4 IPProtocol = iota
	IPv6
)

func (IPProtocol) String added in v2.758.0

func (p IPProtocol) String() string

type InterfaceAddress

type InterfaceAddress interface {
	GetInterfaceName() string
	// GetIP gets the exposed internet protocol address of the above interface
	GetIP(ipProtocol IPProtocol) (string, error)
}

func NewResolvingInterfaceAddress

func NewResolvingInterfaceAddress(
	interfaceName string,
	ipResolver Resolver,
) InterfaceAddress

func NewSimpleInterfaceAddress

func NewSimpleInterfaceAddress(interfaceName string, ip string) InterfaceAddress

type InterfaceAddressesProvider

type InterfaceAddressesProvider interface {
	Get() ([]InterfaceAddress, error)
}

func NewSystemInterfaceAddressesProvider

func NewSystemInterfaceAddressesProvider() InterfaceAddressesProvider

type InterfaceAddressesValidator

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

func NewInterfaceAddressesValidator

func NewInterfaceAddressesValidator(interfaceAddrsProvider InterfaceAddressesProvider, desiredInterfaceAddresses []InterfaceAddress) InterfaceAddressesValidator

func (InterfaceAddressesValidator) Attempt

func (i InterfaceAddressesValidator) Attempt() (bool, error)

type InterfaceToAddrsFunc

type InterfaceToAddrsFunc func(string) ([]gonet.Addr, error)

type Resolver

type Resolver interface {
	// GetPrimaryIP always returns error unless IPNet is found for given interface
	GetPrimaryIP(interfaceName string, ipProtocol IPProtocol) (*gonet.IPNet, error)
}

func NewResolver

func NewResolver(ifaceToAddrsFunc InterfaceToAddrsFunc) Resolver

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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