Skip to main content


This package helps you to work with IP ranges.

IP range is a set of IP addresses. Both IPv4 and IPv6 are supported.

IP range interface:

type Range interface {
Family() Family
Contains(ip net.IP) bool
Size() *big.Int

Supported formats

  • IPv4 address (
  • IPv4 range (
  • IPv4 CIDR (
  • IPv4 subnet mask (
  • IPv6 address (2001:db8::1)
  • IPv6 range (2001:db8::-2001:db8::10)
  • IPv6 CIDR (2001:db8::/64)

IP range doesn't contain network and broadcast IP addresses if the format is IPv4 CIDR, IPv4 subnet mask or IPv6 CIDR.

Was this page helpful?

Need more help?