Skip to content

Classless Inter-Domain Routing (CIDR) for Elixir

License

Notifications You must be signed in to change notification settings

hex-sh/cidr-elixir

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hex.pm Version Build Status

Setup

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

Usage

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

Contribution Process

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."

tl;dr

  1. Check for open issues or open a new issue to start a discussion around a feature idea or a bug
  2. Fork the cidr-elixir repository on Github to start making your changes
  3. Write a test which shows that the bug was fixed or that the feature works as expected
  4. Send a pull request and wait for it to be merged

License

MIT License.

About

Classless Inter-Domain Routing (CIDR) for Elixir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 100.0%