cidr

package
v1.9.6 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	_, PrivateIPv4Net1, _ = net.ParseCIDR("10.0.0.0/8")
	_, PrivateIPv4Net2, _ = net.ParseCIDR("172.16.0.0/12")
	_, PrivateIPv4Net3, _ = net.ParseCIDR("192.168.0.0/16")
	_, PrivateIPv6Net, _  = net.ParseCIDR("fc00::/7")

	PrivateIPv4Nets       = []*net.IPNet{PrivateIPv4Net1, PrivateIPv4Net2, PrivateIPv4Net3}
	PrivateIPv4NetsString = []string{"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"}

	PrivateIPv6Nets       = []*net.IPNet{PrivateIPv6Net}
	PrivateIPv6NetsString = []string{"fc00::/7"}
	_, IPv4ZeroCIDR, _    = net.ParseCIDR("0.0.0.0/0")
	_, IPv6ZeroCIDR, _    = net.ParseCIDR("::/0")
	_, LinkLocalCIDR, _   = net.ParseCIDR("169.254.0.0/16")
)

Functions

func IsUnicastIP

func IsUnicastIP(ip net.IP, subnet string) bool

func ListFirtstAndLastIPStringFromCIDR

func ListFirtstAndLastIPStringFromCIDR(cidr string) []net.IP

func ListIPsFromCIDR

func ListIPsFromCIDR(cidr *net.IPNet) []net.IP

func ListIPsFromCIDRString

func ListIPsFromCIDRString(cidr string) []net.IP

func ListIPsStringFromCIDR

func ListIPsStringFromCIDR(cidr string) []string

func RegisterCIDRFlags added in v1.6.12

func RegisterCIDRFlags(pset *pflag.FlagSet)

Types

This section is empty.

Jump to

Keyboard shortcuts

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