magiclen / cidr-utils

This crate provides functions for working with IPv4 CIDRs and IPv6 CIDRs.
MIT License
32 stars 11 forks source link

Respect CIDR range specification? #6

Closed Skarlett closed 2 years ago

Skarlett commented 3 years ago

Input: 0.0.0.5/24 Outputs: 0.0.0.0, 0.0.0.1, 0.0.0.2

Expected output: 0.0.0.5, 0.0.0.6, ... 0.0.0.255

magiclen commented 3 years ago

Why 0.0.0.5/24 starts with 0.0.0.5?

Skarlett commented 3 years ago

0.0.0.X/24 where X is the start of the CIDR range. This should be explicit instead of implicitly the being of the netmask range since the information is overwritten once converted into IpCidr

Similarly, this should work independently of the bit mask. 10.0.X.0/16, 10.X.0.0/8

Merge Ready #7