cidrman

package module
v0.0.0-...-28e79e3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: Unlicense Imports: 6 Imported by: 11

README

go-cidrman

golang CIDR block management utilities.

Inspired by the Python netaddr library:

Build

Note: This project uses Go Modules making it safe to work with it outside of your existing GOPATH. The instructions that follow assume a directory in your home directory outside of the standard GOPATH (i.e $HOME/development/EvilSuperstars/).

Clone repository to: $HOME/development/EvilSuperstars/

$ mkdir -p $HOME/development/EvilSuperstars/; cd $HOME/development/EvilSuperstars/
$ git clone git@github.com:EvilSuperstars/go-cidrman
$ cd $HOME/development/EvilSuperstars/terraform-provider-jmespath
$ make build

Test

$ cd $HOME/development/EvilSuperstars/terraform-provider-jmespath
$ make test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPRangeToCIDRs

func IPRangeToCIDRs(start, end string) ([]string, error)

IPRangeToCIDRs accepts an arbitrary start and end IP address and returns a list of CIDR subnets that fit exactly between the boundaries of the two with no overlap.

func IPRangeToIPNets

func IPRangeToIPNets(start, end net.IP) ([]*net.IPNet, error)

IPRangeToIPNets accepts an arbitrary start and end IP address and returns a list of CIDR subnets that fit exactly between the boundaries of the two with no overlap.

func MergeCIDRs

func MergeCIDRs(cidrs []string) ([]string, error)

MergeCIDRs accepts a list of CIDR blocks and merges them into the smallest possible list of CIDRs.

func MergeIPNets

func MergeIPNets(nets []*net.IPNet) ([]*net.IPNet, error)

MergeIPNets accepts a list of IP networks and merges them into the smallest possible list of IPNets. It merges adjacent subnets where possible, those contained within others and removes any duplicates.

func Subnets

func Subnets(cidr string, prefix int) ([]string, error)

Subnets divides up CIDR block into smaller subnets based on a specified CIDR prefix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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