Add basic NAT structures

This commit is contained in:
2024-01-08 21:03:39 +01:00
parent 80ecb3c5d2
commit 672e866897
9 changed files with 190 additions and 30 deletions

View File

@ -1,4 +1,6 @@
use crate::constants;
use crate::libvirt_lib_structures::XMLUuid;
use crate::libvirt_rest_structures::net::NetworkName;
use crate::libvirt_rest_structures::nw_filter::NetworkFilterName;
use clap::Parser;
use std::net::IpAddr;
@ -250,8 +252,16 @@ impl AppConfig {
self.definitions_path().join(format!("vm-{name}.json"))
}
pub fn net_definition_path(&self, name: &str) -> PathBuf {
self.definitions_path().join(format!("net-{name}.json"))
pub fn net_definition_path(&self, name: &NetworkName) -> PathBuf {
self.definitions_path().join(format!("net-{}.json", name.0))
}
pub fn nat_path(&self) -> PathBuf {
self.storage_path().join(constants::STORAGE_NAT_DIR)
}
pub fn net_nat_path(&self, name: &NetworkName) -> PathBuf {
self.nat_path().join(format!("nat-{}.json", name.0))
}
pub fn net_filter_definition_path(&self, name: &NetworkFilterName) -> PathBuf {