Popularity
4.5
Growing
Activity
0.0
Declining
42
2
4
Monthly Downloads: 82,926
Programming language: Elixir
License: Apache License 2.0
Tags:
Text And Numbers
inet_cidr alternatives and similar packages
Based on the "Text and Numbers" category.
Alternatively, view inet_cidr alternatives based on common mentions on social networks and blogs.
-
money
Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog. -
nanoid
Elixir port of NanoID, a secure and URL-friendly unique ID generator. https://hex.pm/packages/nanoid -
secure_random
Convenience library for random base64 strings modeled after my love for Ruby's SecureRandom -
chinese_translation
An elixir module to translate simplified Chinese to traditional Chinese, and vice versa, based on wikipedia data -
veritaserum
Sentiment analysis based on afinn-165, emojis and some enhancements. -
abacus
Parses and evaluates mathematical expressions in Elixir. Inspired by math.js -
haikunator
Generate Heroku-like memorable random names to use in your apps or anywhere else. -
Ex_Cldr_Units
Unit formatting (volume, area, length, ...) functions for the Common Locale Data Repository (CLDR) -
expr
An Elixir library for parsing and evaluating mathematical expressions -
mt940
MT940 (standard structured SWIFT Customer Statement message) parser for Elixir. -
convertat
An Elixir library for converting from and to arbitrary bases.
Static code analysis for 29 languages.
Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.
Promo
www.sonarqube.org
Do you think we are missing an alternative of inet_cidr or a related project?
Popular Comparisons
README
InetCidr
Classless Inter-Domain Routing (CIDR) library for Elixir
This library has the following features:
- Compatible with Erlang's :inet module
- Supports IPv4 and IPv6
Install
defp deps do
[
{:inet_cidr, "~> 1.0.0"}
]
end
Usage
Parsing a CIDR string
iex(1)> InetCidr.parse("192.168.0.0/16")
{{192,168,0,0}, {192,168,255,255}, 16}
iex(2)> InetCidr.parse("2001:abcd::/32")
{{8193, 43981, 0, 0, 0, 0, 0, 0}, {8193, 43981, 65535, 65535, 65535, 65535, 65535, 65535}, 32}
Printing a CIDR block to string
iex(1)> "192.168.0.0/16" |> InetCidr.parse |> InetCidr.to_string
"192.168.0.0/16"
iex(2)> "2001:abcd::/32" |> InetCidr.parse |> InetCidr.to_string
"2001:ABCD::/32"
Check whether a CIDR block contains an IP address
iex(1)> cidr = InetCidr.parse("192.168.0.0/16")
{{192,168,0,0}, {192,168,255,255}, 16}
iex(2)> address1 = InetCidr.parse_address!("192.168.15.20")
{192,168,15,20}
iex(3)> InetCidr.contains?(cidr, address1)
true
iex(4)> address2 = InetCidr.parse_address!("10.168.15.20")
{10,168,15,20}
iex(5)> InetCidr.contains?(cidr, address2)
false
iex(1)> cidr = InetCidr.parse("2001:abcd::/32")
{{8193, 43981, 0, 0, 0, 0, 0, 0}, {8193, 43981, 65535, 65535, 65535, 65535, 65535, 65535}, 32}
iex(2)> address1 = InetCidr.parse_address!("2001:abcd::")
{8193, 43981, 0, 0, 0, 0, 0, 0}
iex(3)> InetCidr.contains?(cidr, address1)
true
iex(4)> address2 = InetCidr.parse_address!("abcd:2001::")
{43981, 8193, 0, 0, 0, 0, 0, 0}
iex(5)> InetCidr.contains?(cidr, address2)
false
License
[LICENSE](LICENSE)
*Note that all licence references and agreements mentioned in the inet_cidr README section above
are relevant to that project's source code only.