client, server: new CIDRs must be hostname-compatible

towards the goal of supporting #82
pull/92/head
Jake McGinty 2021-05-21 13:35:07 +09:00
parent 911a2d8f00
commit b4fb9f9250
2 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ pub fn add_cidr(cidrs: &[Cidr], request: &AddCidrOpts) -> Result<Option<CidrCont
};
let cidr_request = CidrContents {
name,
name: name.to_string(),
cidr,
parent: Some(parent_cidr.id),
};

View File

@ -322,7 +322,7 @@ pub struct AddPeerOpts {
pub struct AddCidrOpts {
/// The CIDR name (eg. "engineers")
#[structopt(long)]
pub name: Option<String>,
pub name: Option<Hostname>,
/// The CIDR network (eg. "10.42.5.0/24")
#[structopt(long)]
@ -581,7 +581,7 @@ impl FromStr for Hostname {
if Self::is_valid(name) {
Ok(Self(name.to_string()))
} else {
Err("invalid hostname")
Err("invalid hostname string (only alphanumeric with dashes)")
}
}
}