package cidr

import "github.com/oslokommune/okctl/pkg/cfn/components/cidr"

Package cidr provides functionality for interacting with classless inter-domain routing https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

Index

Functions

func PrivateCidrRanges

func PrivateCidrRanges() []string

PrivateCidrRanges returns a set of valid private CIDRs https://en.wikipedia.org/wiki/Private_network#Private_IPv4_addresses

func RequiredHosts

func RequiredHosts(subnets, prefixLen int) uint64

RequiredHosts calculates the required number of hosts and rounds up to the nearest power of two

Types

type Cidr

type Cidr struct {
	Block *net.IPNet
}

Cidr stores the parsed range

func New

func New(from string, requiredHosts uint64, validRanges []string) (*Cidr, error)

New parses a provided cidr and ensures that it is valid

func NewDefault

func NewDefault(block string) (*Cidr, error)

NewDefault parses the provided Cidr given the default restrictions

Source Files

cidr.go

Version
v0.0.106 (latest)
Published
Oct 21, 2022
Platform
linux/amd64
Imports
6 packages
Last checked
1 day ago

Tools for package owners.