Skip to content

The iptools package is a collection of utilities for dealing with IP addresses.

License

Notifications You must be signed in to change notification settings

Deniskore/iptools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

The iptools package is a collection of utilities for dealing with IP addresses.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages