cidr

package
v1.90.8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 5 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// IPFamilyIPv4 is the IPv4 IP family.
	IPFamilyIPv4 string = "IPv4"
	// IPFamilyIPv6 is the IPv6 IP family.
	IPFamilyIPv6 string = "IPv6"
)

Variables

This section is empty.

Functions

func NetworksIntersect added in v0.34.0

func NetworksIntersect(cidr1, cidr2 string) bool

NetworksIntersect returns true if the given network CIDRs intersect.

func ValidateCIDRIPFamily added in v1.63.0

func ValidateCIDRIPFamily(cidrs []CIDR, ipFamily string) field.ErrorList

ValidateCIDRIPFamily validates that all the given CIDRs can be matched to the correct IP Family.

func ValidateCIDRIsCanonical

func ValidateCIDRIsCanonical(fldPath *field.Path, cidrToValidate string) field.ErrorList

ValidateCIDRIsCanonical validates that the provided CIDR is in canonical form.

func ValidateCIDROverlap

func ValidateCIDROverlap(paths []CIDR, overlap bool) field.ErrorList

ValidateCIDROverlap validates that the provided CIDRs do not overlap.

func ValidateCIDRParse

func ValidateCIDRParse(cidrPaths ...CIDR) (allErrs field.ErrorList)

ValidateCIDRParse validates that all the given CIDRs can be parsed successfully.

func ValidateNetworkDisjointedness added in v0.34.0

func ValidateNetworkDisjointedness(fldPath *field.Path, shootNodes, shootPods, shootServices, seedNodes *string, seedPods, seedServices string, workerless bool) field.ErrorList

ValidateNetworkDisjointedness validates that the given <seedNetworks> and <k8sNetworks> are disjoint.

func ValidateShootNetworkDisjointedness added in v1.40.0

func ValidateShootNetworkDisjointedness(fldPath *field.Path, shootNodes, shootPods, shootServices *string, workerless bool) field.ErrorList

ValidateShootNetworkDisjointedness validates that the given shoot network is disjoint.

Types

type CIDR

type CIDR interface {
	// GetCIDR returns the provided CIDR
	GetCIDR() string
	// GetFieldPath returns the fieldpath
	GetFieldPath() *field.Path
	// GetIPNet optionally returns the IPNet of the CIDR
	GetIPNet() *net.IPNet
	// Parse checks if CIDR parses
	Parse() bool
	// ValidateNotOverlap returns errors if subsets overlap with CIDR. This is the inverse operation of ValidateOverlap.
	ValidateNotOverlap(subsets ...CIDR) field.ErrorList
	// ValidateParse returns errors CIDR can't be parsed.
	ValidateParse() field.ErrorList
	// ValidateIPFamily returns error if IPFamily does not match CIDR.
	ValidateIPFamily(ipFamily string) field.ErrorList
	// ValidateSubset returns errors if subsets is not a subset.
	ValidateSubset(subsets ...CIDR) field.ErrorList
	// LastIPInRange returns the last IP in the CIDR range.
	LastIPInRange() net.IP
	// ValidateOverlap returns errors if the subnets do not overlap with CIDR.
	ValidateOverlap(subsets ...CIDR) field.ErrorList
}

CIDR contains CIDR and Path information

func NewCIDR

func NewCIDR(c string, f *field.Path) CIDR

NewCIDR creates a new instance of cidrPath

Jump to

Keyboard shortcuts

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