Package iprange parses IPv4/IPv6 addresses from strings in IP range format. This is the first formal version of package iprange, and I would like to express my gratitude to @souloss and @XIniris for their testing and feedback.
Supported IP range formats
172.18.0.1
/fd00::1
172.18.0.0/24
/fd00::/64
172.18.0.1-10
/fd00::1-a
172.18.0.1-172.18.1.10
/fd00::1-fd00::1:a
In short, it can
- Parse IPv4/IPv6 addresses from strings in IP range format.
- Calculate the size of IP ranges, containing relationships, etc.
- Calculate the union, difference or intersection of two IP ranges.
- Convert IP ranges to multiple separate IP addresses (
net.IP
). - Convert IP ranges to multiple separate CIDRs (
*net.IPNet
).