ipnetwork icon indicating copy to clipboard operation
ipnetwork copied to clipboard

A library to work with CIDRs in rust

Results 21 ipnetwork issues
Sort by recently updated
recently updated
newest added

`Ipv4Network::size` panics if `self.prefix == 0` since the result is too large (`2^32`): pub fn size(self) -> u32 { let host_bits = u32::from(IPV4_BITS - self.prefix); (2 as u32).pow(host_bits) } This...

Works the same as `Ipv4Network::nth`, but using a `u128` index instead of `u32`. Fixes #146

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.

Hi ``` use ipnetwork::Ipv4Network; let net: Ipv4Network = "10.1.0.0/16".parse().unwrap(); let net2: Ipv4Network = "10.1.0.0/15".parse().unwrap(); println!("{:?} {} {}", net2, net.is_supernet_of(net2), net.is_supernet_of(Ipv4Network::new(net2.network(), net2.prefix()).unwrap())); ``` Output: `Ipv4Network { addr: 10.1.0.0, prefix: 15 }...

`nth` method is implemented for `Ipv4Network` but not for `Ipv6Network`. Is it due to some fundamental difference between IP4/IP6 neworks or just forgotten?

When creating an IP network, the network address's device bits should be resets to zero and then save into the struct. For example, I believe the following two networks should...

We had a need to calculate the set difference between two `IpNetwork`s. So given an initial broad `IpNetwork`, we wanted to remove a smaller `IpNetwork` sub-network from it. The operation...

This PR implements the `Sub` trait for `IpNetwork`, `Ipv4Network` and `Ipv6Network`. There are two possibilities: either a single IP network item is subtracted from the original IP network, or multiple...

_Fixes:_ - `is_subnet_of` was broken if the supernet was not the network address. - Display now prints the network ip and not the ip used to construct the `IpNetwork`. -...

Hello I wonder what the motivation behind the `NetworkSize` is. As I understand, the purpose of the `IpNetwork` enum is to generalize handling of both IPv4 and IPv6 networks. If...