VintageNet.IP.ip_to_tuple

You're seeing just the function ip_to_tuple, go back to VintageNet.IP module for more information.

Specs

ip_to_tuple(VintageNet.any_ip_address()) ::
  {:ok, :inet.ip_address()} | {:error, String.t()}

Convert an IP address to tuple form

Examples:

iex> VintageNet.IP.ip_to_tuple("192.168.0.1")
{:ok, {192, 168, 0, 1}}

iex> VintageNet.IP.ip_to_tuple({192, 168, 1, 1})
{:ok, {192, 168, 1, 1}}

iex> VintageNet.IP.ip_to_tuple("fe80::1")
{:ok, {65152, 0, 0, 0, 0, 0, 0, 1}}

iex> VintageNet.IP.ip_to_tuple({65152, 0, 0, 0, 0, 0, 0, 1})
{:ok, {65152, 0, 0, 0, 0, 0, 0, 1}}

iex> VintageNet.IP.ip_to_tuple("bologna")
{:error, "Invalid IP address: bologna"}