Module hackney_cidr

Data Types

cidr()

cidr() = {Start::inet:ip4_address(), End::inet:ip4_address(), MaskLen::0..32} | {Start::inet:ip6_address(), End::inet:ip6_address(), MaskLen::0..128}

Function Index

address_count/2return the number of IP addresses included in the CIDR block.
contains/2return true if the CIDR block contains the IP address or CIDR block, false otherwise.
ip_gte/2
ip_lte/2
is_ipv4/1return true if the value is an ipv4 address.
is_ipv6/1return true if the value is an ipv6 address.
merge_cidrs/1Unique sort and merge a list of CIDR blocks, ordering IPv4 ranges before IPv6 ranges.
parse/1parses S as a CIDR notation IP address and mask.
parse/2parses S as a CIDR notation IP address and mask.
to_binary/1return a CIDR block as a binary string.
to_string/1return a CIDR block as a string.
usort_cidrs/1Unique sort a list of CIDR blocks, ordering IPv4 ranges before IPv6 ranges.

Function Details

address_count/2

address_count(IP::inet:ip4_address(), MaskLen::0..32) -> pos_integer()

address_count(IP::inet:ip6_address(), MaskLen::0..128) -> pos_integer()

return the number of IP addresses included in the CIDR block

contains/2

contains(X1::cidr(), Addr::inet:ip_address() | cidr()) -> boolean()

return true if the CIDR block contains the IP address or CIDR block, false otherwise.

ip_gte/2

ip_gte(X1, X2) -> any()

ip_lte/2

ip_lte(X1, X2) -> any()

is_ipv4/1

is_ipv4(X1::inet:ip_address()) -> boolean()

return true if the value is an ipv4 address

is_ipv6/1

is_ipv6(X1::inet:ip_address()) -> boolean()

return true if the value is an ipv6 address

merge_cidrs/1

merge_cidrs(CIDRs::[cidr()]) -> [cidr()]

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.

parse/1

parse(S::string() | binary()) -> cidr()

parses S as a CIDR notation IP address and mask

parse/2

parse(B::string() | binary(), Adjust::boolean()) -> cidr()

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).

to_binary/1

to_binary(X1::cidr()) -> binary()

return a CIDR block as a binary string.

to_string/1

to_string(X1::cidr()) -> string()

return a CIDR block as a string.

usort_cidrs/1

usort_cidrs(CIDRs::[cidr()]) -> [cidr()]

Unique sort a list of CIDR blocks, ordering IPv4 ranges before IPv6 ranges


Generated by EDoc