11 releases

0.2.5 Jan 11, 2024
0.2.4 Aug 17, 2023
0.2.3 Jan 19, 2023
0.2.2 Aug 13, 2022
0.1.3 Jan 24, 2020

#1250 in Network programming

Download history 839/week @ 2024-03-14 553/week @ 2024-03-21 579/week @ 2024-03-28 406/week @ 2024-04-04 483/week @ 2024-04-11 672/week @ 2024-04-18 634/week @ 2024-04-25 1112/week @ 2024-05-02 1113/week @ 2024-05-09 901/week @ 2024-05-16 1106/week @ 2024-05-23 1114/week @ 2024-05-30 1057/week @ 2024-06-06 1197/week @ 2024-06-13 682/week @ 2024-06-20 989/week @ 2024-06-27

4,167 downloads per month

MIT license

55KB
1K 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.2.5"

Example of usage

let first_range = IpRange::new("127.0.0.1/16", "").unwrap();
let second_range = IpRange::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.65.0+

License

This project is licensed under the MIT license.

Dependencies

~2.8–4MB
~67K SLoC