cidrutil

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPBelongsToCIDR

func IPBelongsToCIDR(ipAddr string, cidr string) (bool, error)

IPBelongsToCIDR checks if the given IP is encompassed by the given CIDR block

func IPBelongsToCIDRBlocksSlice

func IPBelongsToCIDRBlocksSlice(ipAddr string, cidrs []string) (bool, error)

IPBelongsToCIDRBlocksSlice checks if the given IP is encompassed by any of the given CIDR blocks

func IPBelongsToCIDRBlocksString

func IPBelongsToCIDRBlocksString(ipAddr string, cidrList, separator string) (bool, error)

IPBelongsToCIDRBlocksString checks if the given IP is encompassed by any of the given CIDR blocks, when the input is a string composed by joining all the CIDR blocks using a separator. The input is separated based on the given separator and the IP is checked to be belonged by any CIDR block.

func Subset

func Subset(cidr1, cidr2 string) (bool, error)

Subset checks if the IPs belonging to a given CIDR block is a subset of IPs belonging to another CIDR block.

func SubsetBlocks

func SubsetBlocks(cidrBlocks1, cidrBlocks2 []string) (bool, error)

SubsetBlocks checks if each CIDR block of a given set of CIDR blocks, is a subset of at least one CIDR block belonging to another set of CIDR blocks. First parameter is the set of CIDR blocks to check against and the second parameter is the set of CIDR blocks that needs to be checked.

func ValidateCIDRListSlice

func ValidateCIDRListSlice(cidrBlocks []string) (bool, error)

ValidateCIDRListSlice checks if the given list of CIDR blocks are valid

func ValidateCIDRListString

func ValidateCIDRListString(cidrList string, separator string) (bool, error)

ValidateCIDRListString checks if the list of CIDR blocks are valid, given that the input is a string composed by joining all the CIDR blocks using a separator. The input is separated based on the given separator and validity of each is checked.

Types

This section is empty.

Jump to

Keyboard shortcuts

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