cidr v1.0.0 CIDR

Classless Inter-Domain Routing (CIDR)

Summary

Functions

Check whether the argument is a CIDR value

Checks if an IP address is in the provided CIDR

Throwing version of match/2, raises ArgumentError on error

Parses a bitstring into a CIDR struct

Functions

is_cidr?(cidr)

Check whether the argument is a CIDR value.

Examples

iex> CIDR.is_cidr?("192.168.1.254/32")
true
match(cidr, address)

Checks if an IP address is in the provided CIDR.

Returns {:ok, true} if the address is in the CIDR range, {:ok, false} if it’s not, and {:error, reason} if the second argument isn’t a valid IP address.

match!(cidr, address)

Throwing version of match/2, raises ArgumentError on error.

parse(string)

Parses a bitstring into a CIDR struct