Release 2.1.0
New features:
- Added
toBits()
toIPv4
/IPv6
, producing e.g.[1, 1, 0, 0, 0, 0, ...]
for192.0.0.0
(length 32 and 128 for IPv4 and IPv6 respectively) - Added
IPv4.fromBits(bits)
andIPv6.fromBits(bits)
, accepting the "bit arrays" produced fromtoBits()
- Accepts arrays (with length 32 for
IPv4
and length 128 forIPv6
) filled with0
's and1
's
- Accepts arrays (with length 32 for
- Added
IPv4.bits = 32
andIPv6.bits = 128
, both on the class and class objects (e.g.new IPv4('0.0.0.0').bits
) - Added
getAmount()
toIPMatch
, allowing you see how many IP addresses a match (e.g. a range/subnet) matches - Added
isSubsetOf(mask)
toIPMask
, allowing to check whether one mask is a subset of another mask- Mask A is a subset of mask B if every IP address that is matched by A is also matched by B
Changes:
- Caching added to
convertToMasks()
/convertToSubnets()
, making repeated calls a lot cheaper matches(ip)
inIPRange
no longer errors for passing anIPv4
to anIPv6
range and vice-versa, instead returning false now- This is line with
matches()
in general, where it only errors if the input is neither an IP nor a string that can be converted to one
- This is line with