| Crates.io | iptools |
| lib.rs | iptools |
| version | 0.3.0 |
| created_at | 2020-01-19 16:09:56.500981+00 |
| updated_at | 2024-08-17 19:58:58.257541+00 |
| description | Python iptools port for Rust |
| homepage | https://github.com/Deniskore |
| repository | https://github.com/Deniskore/iptools |
| max_upload_size | |
| id | 200166 |
| size | 60,735 |
This is a port of package iptools from Python.
Add the following dependency to your Cargo manifest:
[dependencies]
iptools = "0.3.0"
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"));
Rust 1.70.0+
This project is licensed under the MIT license.