client, server: new CIDRs must be hostname-compatible
towards the goal of supporting #82pull/92/head
parent
911a2d8f00
commit
b4fb9f9250
|
@ -39,7 +39,7 @@ pub fn add_cidr(cidrs: &[Cidr], request: &AddCidrOpts) -> Result<Option<CidrCont
|
||||||
};
|
};
|
||||||
|
|
||||||
let cidr_request = CidrContents {
|
let cidr_request = CidrContents {
|
||||||
name,
|
name: name.to_string(),
|
||||||
cidr,
|
cidr,
|
||||||
parent: Some(parent_cidr.id),
|
parent: Some(parent_cidr.id),
|
||||||
};
|
};
|
||||||
|
|
|
@ -322,7 +322,7 @@ pub struct AddPeerOpts {
|
||||||
pub struct AddCidrOpts {
|
pub struct AddCidrOpts {
|
||||||
/// The CIDR name (eg. "engineers")
|
/// The CIDR name (eg. "engineers")
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
pub name: Option<String>,
|
pub name: Option<Hostname>,
|
||||||
|
|
||||||
/// The CIDR network (eg. "10.42.5.0/24")
|
/// The CIDR network (eg. "10.42.5.0/24")
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
|
@ -581,7 +581,7 @@ impl FromStr for Hostname {
|
||||||
if Self::is_valid(name) {
|
if Self::is_valid(name) {
|
||||||
Ok(Self(name.to_string()))
|
Ok(Self(name.to_string()))
|
||||||
} else {
|
} else {
|
||||||
Err("invalid hostname")
|
Err("invalid hostname string (only alphanumeric with dashes)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue