Representation of IP addresses and subnets.
Find a file
2017-10-12 09:03:36 +13:00
config FIRST POST 2017-10-06 14:56:47 +13:00
lib Tidy up documentation. 2017-10-12 09:03:36 +13:00
test Add IP address scopes. 2017-10-10 22:56:30 +13:00
.credo.exs Implement prefix contains prefix test. 2017-10-11 18:06:48 +13:00
.gitignore Initial parsing of various formats for IP addresses. 2017-10-08 19:07:51 +13:00
.gitlab-ci.yml Initial parsing of various formats for IP addresses. 2017-10-08 19:07:51 +13:00
mix.exs Add description. 2017-10-11 18:11:38 +13:00
mix.lock Initial parsing of various formats for IP addresses. 2017-10-08 19:07:51 +13:00
README.md Typo. 2017-10-11 18:30:23 +13:00

IP

pipeline status Hex.pm

IP, IP, Ooray! Simple IP Address representations.

Installation

If available in Hex, the package can be installed by adding ip to your list of dependencies in mix.exs:

def deps do
  [
    {:ip, "~> 0.1.0"}
  ]
end

Usage

ip provides representations for IP addresses and subnets for Elixir with a bunch of helpful stuff tacked on the side.

iex> "192.0.2.1"
...> |> IP.Address.from_string!
#IP.Address<192.0.2.1 DOCUMENTATION>

iex> "2001:db8::"
...> |> IP.Address.from_string!
#IP.Address<2001:db8:: DOCUMENTATION>

iex> outside = IP.Prefix.from_string!("2001:db8::/64")
...> inside  = IP.Prefix.eui_64!(outside, "60:f8:1d:ad:d8:90")
...> IP.Prefix.contains_address?(outside, inside)
true

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ip.