achanda / ipnetwork

A library to work with CIDRs in rust
Apache License 2.0
121 stars 38 forks source link

How to create CIDR from network and broadcast? #154

Open acim opened 2 years ago

acim commented 2 years ago

So, 218.188.0.0 and 218.191.255.255 should result into 218.188.0.0/14. I don't see any method in this crate to be able to achieve this. Thank you.

acim commented 2 years ago

Even worse, sometimes this may result in multiple CIDR's, for example 223.252.177.0 to 223.252.255.255 should result in:

223.252.177.0/24
223.252.178.0/23
223.252.180.0/22
223.252.184.0/21
223.252.192.0/18