View Source hackney_cidr (hackney v1.23.0)
Summary
Functions
return the number of IP addresses included in the CIDR block
return true if the CIDR block contains the IP address or CIDR block, false otherwise.
return true if the value is an ipv4 address
return true if the value is an ipv6 address
Unique sort and merge a list of CIDR blocks, ordering IPv4 ranges before IPv6 ranges. For merging, CIDR blocks that are contained by other CIDR blocks are removed and adjacent CIDR blocks are merged into larger ones.
parses S as a CIDR notation IP address and mask
parses S as a CIDR notation IP address and mask. If Adjust =
true
, allow the IP to contain values beyond the mask and silently ignore them. Otherwise, enforce that the IP address is fully inside the specified mask (the default behavior of parse/1
).return a CIDR block as a binary string.
return a CIDR block as a string.
Unique sort a list of CIDR blocks, ordering IPv4 ranges before IPv6 ranges
Types
-type cidr() :: {Start :: inet:ip4_address(), End :: inet:ip4_address(), MaskLen :: 0..32} | {Start :: inet:ip6_address(), End :: inet:ip6_address(), MaskLen :: 0..128}.
Functions
-spec address_count(inet:ip4_address(), MaskLen :: 0..32) -> pos_integer(); (inet:ip6_address(), MaskLen :: 0..128) -> pos_integer().
-spec contains(cidr(), inet:ip_address() | cidr()) -> boolean().
-spec is_ipv4(inet:ip_address()) -> boolean().
-spec is_ipv6(inet:ip_address()) -> boolean().
true
, allow the IP to contain values beyond the mask and silently ignore them. Otherwise, enforce that the IP address is fully inside the specified mask (the default behavior of parse/1
).