Hi, welcome to my Github pages.
magiclen / cidr-utils Goto Github PK
View Code? Open in Web Editor NEWThis crate provides functions for working with IPv4 CIDRs and IPv6 CIDRs.
License: MIT License
This crate provides functions for working with IPv4 CIDRs and IPv6 CIDRs.
License: MIT License
Cidrs should be able to serialize and deserialize with serde.
Expected output: 0.0.0.5, 0.0.0.6, ... 0.0.0.255
Given the following example:
use cidr_utils::cidr::IpCidr;
fn main() {
let cidr = IpCidr::from_str("100.64.0.0/10");
match cidr {
Ok(IpCidr::V4(cidr)) => {
println!("{:?} {:?}", cidr.first(), cidr.last());
println!("{:?} {:?}", cidr.first_as_ipv4_addr(), cidr.last_as_ipv4_addr());
println!("{:?} {:?}", u32::from(cidr.first_as_ipv4_addr()), u32::from(cidr.last_as_ipv4_addr()));
},
_ => {},
}
}
It prints the following:
16484 4294934372
100.64.0.0 100.127.255.255
1681915904 1686110207
The value for cidr last seems wrong, it should be 1686110207
Edit* The value for first also seems wrong, I've updated the example to show the u32 conversions.
How to delete cidr from CidrCombiner?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.