range2cidr

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 4 Imported by: 1

README

range2cidr

De-aggregates an IP address range into a list of network prefixes (CIDR blocks)

GoDoc

Returns a list of prefixes (CIDR blocks) that covers the given IP range.

For example, if:

ipLo = 23.128.1.0
ipHi = 23.128.7.255

then Deaggregate(ipLo, ipHi) will return:

23.128.1.0/24
23.128.2.0/23
23.128.4.0/22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigToV4

func BigToV4(nBig *big.Int) netip.Addr

func BigToV6

func BigToV6(nBig *big.Int) netip.Addr

func Deaggregate

func Deaggregate(ipLo, ipHi netip.Addr) ([]netip.Prefix, error)

Returns a list of prefixes (CIDR blocks) that covers the given IP range.

For example, if:

ipLo = 23.128.1.0
ipHi = 23.128.7.255

then Deaggregate(ipLo, ipHi) will return:

23.128.1.0/24
23.128.2.0/23
23.128.4.0/22

func ToBig

func ToBig(addr netip.Addr) *big.Int

func Uint32ToV4

func Uint32ToV4(n32 uint32) netip.Addr

func V4ToUint32

func V4ToUint32(ipaddr netip.Addr) (uint32, bool)

Types

type RErr

type RErr int
const (
	EIpVersionMismatch RErr = iota
	EIpInvalid
)

func (RErr) Error

func (e RErr) Error() string

Jump to

Keyboard shortcuts

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