cidr-radix 11.2.0

Zero-dependency, zero-allocation IPv4/IPv6 CIDR parsing, bitmask matching, canonicalization, and radix-indexed IpCidrSet lookup.
Documentation
  • Coverage
  • 100%
    16 out of 16 items documented0 out of 0 items with examples
  • Size
  • Source code size: 129.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 866.6 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates-dev/ctares
    2 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • vshengbro

cidr-radix

Zero-Dependency Zero-Allocation IPv4/IPv6 CIDR Parser, Matcher & Radix Set

Crates.io Version Docs.rs CI Status Rust 2024 License: MIT

Workspace Overview · API Docs


Overview

cidr-radix provides zero-dependency IPv4 and IPv6 CIDR parsing, canonical masking, branchless containment checks, and a coalesced radix IpCidrSet for allowlists, firewalls, and trusted-proxy validation.

Installation

cargo add cidr-radix

Usage

use std::net::{IpAddr, Ipv4Addr};
use cidr_radix::{IpCidrSet, Ipv4Cidr, Ipv6Cidr};

let v4 = Ipv4Cidr::parse("192.168.1.0/24").unwrap();
let v6 = Ipv6Cidr::parse("2001:db8::/32").unwrap();
let mut builder = IpCidrSet::builder();
builder.insert_v4(v4);
builder.insert_v6(v6);
let set = builder.build();
assert!(set.contains(IpAddr::V4(Ipv4Addr::new(192, 168, 1, 42))));

Verification

cargo run -p crate-cli -- fmt --check
cargo clippy -p cidr-radix --all-features --all-targets -- -D warnings
cargo test -p cidr-radix --all-features

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For inquiries, please contact the author at root@devhub.vip.