network

package
v0.0.0-...-c57eb44 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance(a, b net.IP) int

func FirstLast

func FirstLast(network *net.IPNet) (net.IP, net.IP)

FirstLast returns the first and last IP of a network

func NetDistance

func NetDistance(a, b *net.IPNet) int

NetDistance is absolute distance between 2 networks, last to last, if < 0 it's an overlap

|--a--| |--b--|

|<------>|

|--a--|

|---b--|
|<->|

func NextAvailableNetwork

func NextAvailableNetwork(networks []*net.IPNet,
	mini *net.IPNet,
	maxi *net.IPNet,
	mask net.IPMask) (*net.IPNet, error)

Types

type ByNetwork

type ByNetwork []*net.IPNet

func (ByNetwork) Len

func (a ByNetwork) Len() int

func (ByNetwork) Less

func (a ByNetwork) Less(i, j int) bool

func (ByNetwork) Swap

func (a ByNetwork) Swap(i, j int)

Jump to

Keyboard shortcuts

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