Start to build NAT configuration mode

This commit is contained in:
2024-01-10 19:29:24 +01:00
parent 6fdcc8c07c
commit ed25eed31e
10 changed files with 200 additions and 12 deletions

View File

@ -61,6 +61,13 @@ pub struct IPV6Config {
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
pub struct NetworkName(pub String);
impl NetworkName {
/// Get the name of the file that will store the NAT configuration of this network
pub fn nat_file_name(&self) -> String {
format!("nat-{}.json", self.0)
}
}
impl NetworkName {
pub fn is_valid(&self) -> bool {
regex!("^[a-zA-Z0-9]+$").is_match(&self.0)