netutil

package
v0.0.0-...-2f8c95c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 6 Imported by: 48

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFirstAddressOf

func GetFirstAddressOf(names []string, logger log.Logger, enableInet6 bool) (string, error)

GetFirstAddressOf returns the first IPv4/IPV6 address of the supplied interface names, omitting any link-local addresses.

func PrivateNetworkInterfaces

func PrivateNetworkInterfaces(logger log.Logger) []string

PrivateNetworkInterfaces lists network interfaces and returns those having an address conformant to RFC1918

func PrivateNetworkInterfacesWithFallback

func PrivateNetworkInterfacesWithFallback(fallback []string, logger log.Logger) []string

Types

type NetworkInterfaceAddressGetter

type NetworkInterfaceAddressGetter func(name string) ([]netip.Addr, error)

NetworkInterfaceAddressGetter matches the signature of net.InterfaceByName() to allow for test mocks.

Jump to

Keyboard shortcuts

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