[Haskell] [ANNOUNCE] network-address-0.1.0
Sebastian Nowicki
sebnow at gmail.com
Mon Aug 22 12:26:13 CEST 2011
Hi All,
I have just released network-address-0.1.0. This is the first version
of the package.
The network-address library provides data structures for IP addresses
as well as subnetworks. The goal is to have a generic library for
representing network addresses in binary or textual form. Currently it
supports IPv4 and IPv6 (partially).
*Data.Network.Address> readAddress "127.0.0.1" :: IPv4
IPv4 2130706433
*Data.Network.Address> let ip = readAddress "127.0.0.1" :: IPv4
*Data.Network.Address> showAddress ip
"127.0.0.1"
*Data.Network.Address> let subnet = readSubnet "192.168.1.42/8" :: IPSubnet IPv4
*Data.Network.Address> subnet
IPSubnet (IPv4 3232235776) (-256)
*Data.Network.Address> showSubnet subnet
"192.168.1.0/8"
*Data.Network.Address> showAddress . base $ subnet
"192.168.1.0"
*Data.Network.Address> (readAddress "192.168.1.5" :: IPv4) `member` subnet
True
*Data.Network.Address> (readAddress "192.168.2.5" :: IPv4) `member` subnet
False
I was looking for an IPv4/IPv6 data structure, and found a few
libraries such as network-data, iproute, and nettle-openflow. These
libraries are either written for a specific purpose or bring along
dependencies. I decided to create network-address to consolidate the
data structures and make a lightweight, fast, generic and complete
library for representing these addresses.
This is my first public Haskell library. The API is unstable and
possibly not idiomatic. I'd appreciate any feedback.
Hackage: http://hackage.haskell.org/package/network-address
GitHub: https://github.com/sebnow/haskell-network-address
Regards,
Sebastian
More information about the Haskell
mailing list