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
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}
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}
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}]
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}]