https://github.com/benoitc/inet_cidr
CIDR erlang library
https://github.com/benoitc/inet_cidr
Last synced: 12 months ago
JSON representation
CIDR erlang library
- Host: GitHub
- URL: https://github.com/benoitc/inet_cidr
- Owner: benoitc
- License: other
- Created: 2016-02-22T23:03:12.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-02-19T23:27:17.000Z (about 2 years ago)
- Last Synced: 2025-03-13T04:34:10.238Z (12 months ago)
- Language: Erlang
- Homepage:
- Size: 72.3 KB
- Stars: 27
- Watchers: 4
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://hex.pm/packages/erl_cidr)
# inet_cidr
CIDR library for Erlang.
> Based on the Elixir library [InetCidr](https://github.com/Cobenian/inet_cidr)
but rewritten so it can be easily used in an Erlang application without
requiring Elixir.
Available on [hex.pm](https://hex.pm) as [erl_cidr](https://hex.pm/packages/erl_cidr).
## Usage
### Parsing a CIDR string
```erlang
1> inet_cidr:parse("192.168.0.0/16").
{{192,168,0,0},{192,168,255,255},16}
2> inet_cidr:parse("2001:abcd::/32").
{{8193,43981,0,0,0,0,0,0},
{8193,43981,65535,65535,65535,65535,65535,65535},
32}
```