12 releases

0.3.0 Aug 17, 2024
0.2.5 Jan 11, 2024
0.2.4 Aug 17, 2023
0.2.3 Jan 19, 2023
0.1.3 Jan 24, 2020

#1050 in Network programming

Download history 1021/week @ 2024-08-16 838/week @ 2024-08-23 784/week @ 2024-08-30 952/week @ 2024-09-06 688/week @ 2024-09-13 673/week @ 2024-09-20 554/week @ 2024-09-27 688/week @ 2024-10-04 1033/week @ 2024-10-11 1056/week @ 2024-10-18 1140/week @ 2024-10-25 518/week @ 2024-11-01 615/week @ 2024-11-08 1007/week @ 2024-11-15 1075/week @ 2024-11-22 949/week @ 2024-11-29

3,702 downloads per month

MIT license

59KB
1.5K SLoC

Build Status Crates.io API reference

Iptools

This is a port of package iptools from Python.

Getting Started

Add the following dependency to your Cargo manifest:

[dependencies]
iptools = "0.3.0"

Example of usage

let first_range = IpRange::<IPv4>::new("127.0.0.1/16", "").unwrap();
let second_range = IpRange::<IPv4>::new("127.0.0.1", "127.0.0.255").unwrap();
// Print range (tuple)
println!("{:?} {:?}", first_range.get_range(), second_range.get_range());
// Ip address range iterator
println!("{:?} {:?}", first_range.next(), second_range.next());
// Print current length of range (next() iterator reduces the length of range)
println!("{}", first_range.len_cur());
// Print initial range
println!("{}", first_range.len());
// Сheck if the current range contains an ip address
println!("{:?}", first_range.contains("127.0.0.3"));

Supported Rust Versions

Rust 1.70.0+

License

This project is licensed under the MIT license.

Dependencies

~2.9–4MB
~68K SLoC