If there is no prefix, default to number of bits ipv4/32, ipv6/128

This commit is contained in:
sharks
2018-03-27 21:36:39 -05:00
parent 82fef85a02
commit 5fabbc91d5
3 changed files with 17 additions and 3 deletions

View File

@ -35,7 +35,7 @@ impl Error for IpNetworkError {
pub fn cidr_parts(cidr: &str) -> Result<(&str, &str), IpNetworkError> {
let parts = cidr.split('/').collect::<Vec<&str>>();
if parts.len() == 1 {
Ok((parts[0], "32"))
Ok((parts[0], ""))
} else if parts.len() == 2 {
Ok((parts[0], parts[1]))
} else {