Representation of IP addresses and subnets.
Find a file
Jim Kane f3cfbb38a6 improvement: Update Bitwise use, libs
In order to accomodate deprecations in elixir 1.14, change how some
Bitwise functions are called.

Update library dependencies to avoid deprecation warnings.
2022-09-28 11:03:39 +13:00
config chore: set up git_ops and auto-releasing 2021-12-08 13:31:45 +13:00
lib improvement: Update Bitwise use, libs 2022-09-28 11:03:39 +13:00
test fix: correctly validate IPv4 netmasks 2022-09-23 11:45:19 +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 chore: set up git_ops and auto-releasing 2021-12-08 13:31:45 +13:00
CHANGELOG.md chore: release version v1.2.1 2022-09-22 23:48:53 +00:00
LICENSE Update MIT license file 2019-03-04 15:07:55 +13:00
mix.exs chore: release version v1.2.1 2022-09-22 23:48:53 +00:00
mix.lock improvement: Update Bitwise use, libs 2022-09-28 11:03:39 +13:00
README.md chore: release version v1.2.1 2022-09-22 23:48:53 +00:00
renovate.json chore: update renovate.json. 2021-12-09 11:17:01 +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, "~> 1.2.1"}
  ]
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.