cidr

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cidr provides helper methods for generating labels for CIDRs which are partially derived from node state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCIDRLabels

func GetCIDRLabels(cidr *net.IPNet) labels.Labels

GetCIDRLabels turns a CIDR into a set of labels representing the cidr itself and all broader CIDRS which include the specified CIDR in them. For example: CIDR: 10.0.0.0/8 =>

"cidr:10.0.0.0/8", "cidr:10.0.0.0/7", "cidr:8.0.0.0/6",
"cidr:8.0.0.0/5", "cidr:0.0.0.0/4, "cidr:0.0.0.0/3",
"cidr:0.0.0.0/2",  "cidr:0.0.0.0/1",  "cidr:0.0.0.0/0"

The identity reserved:world is always added as it includes any CIDR.

func IPStringToLabel

func IPStringToLabel(IP string) (labels.Label, error)

IPStringToLabel parses a string and returns it as a CIDR label.

If "IP" is not a valid IP address or CIDR Prefix, returns an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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