Skip to main content

inRange

Check whether an IP (or network) is within another network (inclusive). Returns true if contained.


Examples

IPv4 address in a CIDR:

"10.0.5.7/32".inRange("10.0.0.0/16")

IPv6 address in a CIDR:

"2001:db8::123/128".inRange("2001:db8::/48")