Representation of IP addresses and subnets.
Find a file
2021-12-08 00:18:14 +00:00
config FIRST POST 2017-10-06 14:56:47 +13:00
lib chore(dev-deps): Update credo to 1.6.1. 2021-12-08 00:12:29 +00:00
test Fix bug in prefix's enumerable implementation. 2019-04-23 17:09:28 +12:00
.formatter.exs Update deps 2018-09-04 03:25:04 +00:00
.gitignore Initial parsing of various formats for IP addresses. 2017-10-08 19:07:51 +13:00
.gitlab-ci.yml Fix outdated dependencies. 2019-04-23 17:09:17 +12:00
LICENSE Update MIT license file 2019-03-04 15:07:55 +13:00
mix.exs chore(dev-deps): remove dependency on dialyxir. 2021-12-08 00:15:27 +00:00
mix.lock chore(dev-deps): Update earmark to 1.4.19. 2021-12-08 00:18:14 +00:00
README.md chore: change default branch to main. 2021-12-08 12:51:30 +13:00
renovate.json Add renovate.json 2020-07-23 16:44:24 +12: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, "~> 1.0.0"}
  ]
end

Usage

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

iex> ~i(192.0.2.1)
#IP.Address<192.0.2.1 DOCUMENTATION>

iex> ~i(2001:db8::)
#IP.Address<2001:db8:: DOCUMENTATION>

iex> outside = ~i(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.