autodetection

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodFirst     = "first-found"
	MethodInterface = "interface="
	MethodCidr      = "cidr="
	MethodCanReach  = "can-reach="
)
View Source
const (
	IPv4 = 4
	IPv6 = 6
)

Variables

View Source
var DefaultInterfacesToExclude = []string{
	"docker.*", "cbr.*", "dummy.*",
	"virbr.*", "lxcbr.*", "veth.*", "lo",
	"vxlan.calico", "cali.*", "tunl.*", "flannel.*", "kube-ipvs.*", "cni.*",
}

DefaultInterfacesToExclude Default interfaces to exclude for any logic following the first-found autodetect IP method

Functions

func AutoDetectCIDR

func AutoDetectCIDR(method string, version int) (*net.IPNet, error)

AutoDetectCIDR auto-detects the IP and Network using the requested detection method.

func CheckCalicoMethod added in v1.3.2

func CheckCalicoMethod(method string) bool

func CheckMethod

func CheckMethod(method string) bool

Types

type Interface

type Interface struct {
	Name  string
	Cidrs []net.IPNet
}

Interface contains details about an interface on the host.

func FilteredEnumeration

func FilteredEnumeration(incl, excl []string, cidrs []net.IPNet, version int) (*Interface, *net.IPNet, error)

FilteredEnumeration performs basic IP and IPNetwork discovery by enumerating all interfaces and filtering in/out based on the supplied filter regex.

The incl and excl slice of regex strings may be nil.

func GetInterfaces

func GetInterfaces(includeRegexes []string, excludeRegexes []string, version int) ([]Interface, error)

GetInterfaces returns a list of all interfaces, skipping any interfaces whose name matches any of the exclusion list regexes, and including those on the inclusion list.

Jump to

Keyboard shortcuts

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