Default to /32 for an IP

This commit is contained in:
sharks
2018-03-27 20:34:07 -05:00
parent c0143a2362
commit 746342c0af

View File

@ -35,10 +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 {
Err(IpNetworkError::InvalidCidrFormat(format!(
"CIDR must contain '/': {}",
cidr
)))
Ok((parts[0], "32"))
} else if parts.len() == 2 {
Ok((parts[0], parts[1]))
} else {