ipnetwork
ipnetwork copied to clipboard
CidrGuess considerations
Hi Luc,
The behavior of Parse("192.0.43.8") of v2.2.0 is:
- Network = 192.0.43.0
- Cidr =24
Apparently this is class-full. Now consider Parse("192.0.43.0"):
- Network = 192.0.43.0
- Cidr =24
For class-full of course I would expect the same. But for class-less I would also expect this. Why? Because of the trailing "0". But of course this could result in invalid behavior when somebody expects Cidr = 32 for a trailing "0".
I don't fully see the behavior of the current code. But in case class-less always results in Cidr = 32 (for IPv4), I have a request:
Please provide a third CidrGuess, one that is "network aware". Expectation:
Parse("192.0.43.8")=> Cidr = 32Parse("192.0.43.0")=> Cidr = 24Parse("192.43.0.0")=> Cidr = 16Parse("192.0.43.255")=> Cidr = 24 (wildcard mask)Parse("192.43.255.255")=> Cidr = 16 (wildcard mask)- ...
Best regards, Matthias