IpReserved (IP Reserved v0.1.1) View Source

Documentation for IpReserved, a tool that checks if the given IP is private / reserved or "normal". Works with IPv4 and IPv6 addresses.

Link to this section Summary

Functions

Returns whether an IP address is reserved or not.

Link to this section Types

Specs

ip_address() :: ipv4_address() | ipv6_address()

Specs

ipv4_address() :: {0..255, 0..255, 0..255, 0..255}

Specs

ipv6_address() ::
  {0..65535, 0..65535, 0..65535, 0..65535, 0..65535, 0..65535, 0..65535,
   0..65535}

Link to this section Functions

Specs

is_reserved?(String.t()) :: boolean()
is_reserved?(ip_address()) :: boolean()

Returns whether an IP address is reserved or not.

Examples

iex> IpReserved.is_reserved?("192.168.0.1")
true

iex> IpReserved.is_reserved?({8, 8, 1, 1})
false

iex> IpReserved.is_reserved?("2001:db8:0:85a3::ac1f:8001")
true