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: 3 Imported by: 56

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(ipNets []*net.IPNet, ipNet *net.IPNet) bool

Contains returns true if 'ipNets' contains ipNet.

func ContainsAll

func ContainsAll(ipNets1, ipNets2 []*net.IPNet) bool

ContainsAll returns true if 'ipNets1' contains all net.IPNet of 'ipNets2'

func Equal

func Equal(n, o *net.IPNet) bool

Equal returns true if the n and o net.IPNet CIDRs arr Equal.

Types

type CIDR

type CIDR struct {
	*net.IPNet
}

CIDR is a network CIDR representation based on net.IPNet

func DiffCIDRLists

func DiffCIDRLists(old, new []*CIDR) (add, remove []*CIDR)

DiffCIDRLists compares an old and new list of CIDRs and returns the list of removed and added CIDRs

func MustParseCIDR

func MustParseCIDR(str string) *CIDR

MustParseCIDR parses the CIDR string using net.ParseCIDR and panics if the CIDR cannot be parsed

func NewCIDR

func NewCIDR(ipnet *net.IPNet) *CIDR

NewCIDR returns a new CIDR using a net.IPNet

func ParseCIDR

func ParseCIDR(str string) (*CIDR, error)

ParseCIDR parses the CIDR string using net.ParseCIDR

func (*CIDR) AvailableIPs

func (n *CIDR) AvailableIPs() int

AvailableIPs returns the number of IPs available in a CIDR

func (*CIDR) DeepCopy

func (n *CIDR) DeepCopy() *CIDR

DeepCopy creates a deep copy of a CIDR

func (*CIDR) DeepCopyInto

func (in *CIDR) DeepCopyInto(out *CIDR)

DeepCopyInto is a deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CIDR) DeepEqual

func (in *CIDR) DeepEqual(other *CIDR) bool

DeepEqual is an deepequal function, deeply comparing the receiver with other. in must be non-nil.

func (*CIDR) Equal

func (n *CIDR) Equal(o *CIDR) bool

Equal returns true if the receiver's CIDR equals the other CIDR.

Jump to

Keyboard shortcuts

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