ityonemo
NetAddress: tools for IP and Mac addresses
I’ve been internally using a library for IP and Mac addresses, and thought I’d open source the toolset. Some of the more interesting features include
- guard clauses
is_ip,is_ipv4,is_ipv6 - support for CIDR block notation and ease of generating ipv4 broadcast addresses
- sigil_i for IP addresses, ranges, and support for matching pinned variables (useful for /24 addresses)
Most Liked
ityonemo
updated in 0.3.0 to have ranges and subnets work in each other’s Kernel.in/2 implementations; also implements is_in function to detect membership in ranges and subnets, in guards.
ityonemo
The standard library’s Map.from_struct/1 does not return an error tuple. But doing a more comprehensive look, I see that the datetime/time/naivedatetime modules have from_* functions which do emit error tuples. I guess network addresses seem more like datetimes than structs, so I’ll go ahead and make the from_ functions emit tuples and have the bang equivalents throw.
ityonemo
updated in 0.2.0 to have bang functions and tuple functions for from_* functions, and as a bonus I implemented random and IP.SockAddr module.
mbklein
I like how you used the m modifier on sigil_i. Nice touch.







