iprange
is a Rust library for managing IP ranges.
It provides fast adding and removing operations.
It also provides merge
, intersect
and exclude
methods
that enable you to manipulate it like a set.
Of course, you can test whether an IP address is in an IpRange
.
See the documentation for details.
```rust extern crate iprange;
use std::net::Ipv4Addr; use iprange::IpRange;
fn main() { let mut iprange = IpRange::new(); iprange .add("10.0.0.0/8".parse().unwrap()) .add("172.16.0.0/16".parse().unwrap()) .add("192.168.1.0/24".parse().unwrap());
assert!(ip_range.includes("172.16.32.1".parse::<Ipv4Addr>().unwrap()));
assert!(ip_range.includes("192.168.1.1".parse::<Ipv4Addr>().unwrap()));
} ```
iprange
is licensed under the MIT license.