CIDR, a Classless Inter-Domain Routing library for Elixir
To use this library in your project, edit your mix.exs
file and add cidr as a dependency:
defp deps do
[
{:cidr, ">= 0.2.0"}
]
end
Parse an IP address / CIDR:
iex(1)> cidr = "1.2.3.4/24" |> CIDR.parse
%CIDR{ip: {1, 2, 3, 4}, mask: 24}
Match against a CIDR:
iex(2)> cidr |> CIDR.match({1,2,3,100})
true
iex(3)> cidr |> CIDR.match({1,2,4,1})
false
This project uses the C4.1 process for all code changes.
"Everyone, without distinction or discrimination, SHALL have an equal right to become a Contributor under the terms of this contract."
- Check for open issues or open a new issue to start a discussion around a feature idea or a bug
- Fork the cidr-elixir repository on Github to start making your changes
- Write a test which shows that the bug was fixed or that the feature works as expected
- Send a pull request and wait for it to be merged