subnet

package
v1.28.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 4 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BelongsTo

func BelongsTo(parent *net.IPNet, child *net.IPNet) bool

BelongsTo checks if child is a subnet of parent

func Overlap

func Overlap(l, r *net.IPNet) bool

Overlap checks if two subnets overlap

func SplitInto added in v1.28.0

func SplitInto(additionalBits uint, parent *net.IPNet) ([]*net.IPNet, error)

SplitInto splits the parent IPNet into subnets with the specified number of additional bits in the prefix.

func SplitInto1 added in v1.28.0

func SplitInto1(parent *net.IPNet) ([]*net.IPNet, error)

SplitInto1 splits the parent IPNet into 1 subnet

func SplitInto2 added in v1.28.0

func SplitInto2(parent *net.IPNet) ([]*net.IPNet, error)

SplitInto2 splits the parent IPNet into 2 subnets

func SplitInto4 added in v1.28.0

func SplitInto4(parent *net.IPNet) ([]*net.IPNet, error)

SplitInto4 splits the parent IPNet into 4 subnets

func SplitInto8

func SplitInto8(parent *net.IPNet) ([]*net.IPNet, error)

SplitInto8 splits the parent IPNet into 8 subnets

Types

type CIDRMap added in v1.23.0

type CIDRMap struct {
	// contains filtered or unexported fields
}

CIDRMap is a helper structure to allocate unused CIDRs

func (*CIDRMap) Allocate added in v1.23.0

func (c *CIDRMap) Allocate(from string, mask net.IPMask) (*net.IPNet, error)

func (*CIDRMap) MarkInUse added in v1.23.0

func (c *CIDRMap) MarkInUse(s string) error

Jump to

Keyboard shortcuts

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