larzip
IPv4 parsing, validation, and real CIDR matching.
Parse and validate dotted-quad addresses, test CIDR membership with real bitmask arithmetic (not string prefix matching), and check whether an address falls in the standard private ranges. The building block acl uses for its allow/deny rules.
larzscript pkg install ip
What you get
- Real dotted-quad parsing + validation
- CIDR matching by real bitmask arithmetic
- is_private() - the standard RFC1918 + loopback ranges
- The building block behind larzacl
Try it
import "ip" as ip
print(ip.parse("192.168.1.1"))
print(ip.is_valid("1.2.3.4"))
print(ip.in_cidr("192.168.1.5", "192.168.1.0/24"))
print(ip.is_private("10.0.0.5"))Output
[192, 168, 1, 1] true true true
Why it's in the Larz Stack
larzip is a real Larzscript package (larzscript pkg install ip) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.