Iplist.Ip

Summary

Given a string representing an IP number, return the corresponding tuple

Given a tuple representing an IP number, return the next tuple

Take string, in various formats, representing an IP range return a list of all IPs in the range, as tuples

Given the start and end of an IP range, as two strings or two tuples, return a list of all IPs in the range, as tuples

Convert an IP number tuple to a string

Functions

from_string(str)

Given a string representing an IP number, return the corresponding tuple.

Example

iex> Iplist.Ip.from_string "1.2.3.4"
{1, 2, 3, 4}
increment(arg1)

Given a tuple representing an IP number, return the next tuple.

Example

iex> Iplist.Ip.increment {1, 2, 3, 4}
{1, 2, 3, 5}

iex> Iplist.Ip.increment {1, 2, 255, 255}
{1, 3, 0, 0}
range(str)

Take string, in various formats, representing an IP range return a list of all IPs in the range, as tuples.

Example

iex> Iplist.Ip.range "1.2.3.4"
[{1, 2, 3, 4}]

iex> Iplist.Ip.range "1.2.3.4..1.2.3.5"
[{1, 2, 3, 4}, {1, 2, 3, 5}]

iex> Iplist.Ip.range("1.2.3.4/31")
[{1, 2, 3, 4}, {1, 2, 3, 5}]
range(a, a)

Given the start and end of an IP range, as two strings or two tuples, return a list of all IPs in the range, as tuples.

Example

iex> Iplist.Ip.range("1.2.3.4", "1.2.3.5")
[{1, 2, 3, 4}, {1, 2, 3, 5}]

iex> Iplist.Ip.range({1, 2, 3, 4}, {1, 2, 3, 5})
[{1, 2, 3, 4}, {1, 2, 3, 5}]
to_string(arg1)

Convert an IP number tuple to a string.

Example

iex> Iplist.Ip.to_string {1, 2, 3, 4}
"1.2.3.4"