/// Linux limite les noms d'interface à 15 caractères (IFNAMSIZ - 1). On /// dérive un nom court et déterministe à partir du nom de service, pour /// que `create`/`destroy` retrouvent toujours la même paire veth sans /// avoir à la stocker séparément. pub struct VethNames { pub host: String, pub peer: String, } pub fn veth_names(service_name: &str) -> VethNames { let short: String = service_name .chars() .filter(|c| c.is_ascii_alphanumeric()) .map(|c| c.to_ascii_lowercase()) .take(6) .collect(); VethNames { host: format!("tv-{short}h"), peer: format!("tv-{short}p"), } }