use super::NATInterface;
use super::vmnet_network;
use crate::containerization_extras;
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Interface {
Nat(NATInterface),
Vmnet(vmnet_network::Interface),
}
impl Interface {
pub fn ipv4_address(&self) -> containerization_extras::address::CIDRv4 {
match self {
Self::Nat(interface) => interface.ipv4_address,
Self::Vmnet(interface) => interface.ipv4_address(),
}
}
pub fn ipv4_gateway(&self) -> Option<containerization_extras::address::IPv4Address> {
match self {
Self::Nat(interface) => interface.ipv4_gateway,
Self::Vmnet(interface) => interface.ipv4_gateway(),
}
}
pub fn ipv6_address(&self) -> Option<containerization_extras::address::CIDRv6> {
match self {
Self::Nat(interface) => interface.ipv6_address.clone(),
Self::Vmnet(interface) => interface.ipv6_address(),
}
}
pub fn ipv6_gateway(&self) -> Option<containerization_extras::address::IPv6Address> {
match self {
Self::Nat(interface) => interface.ipv6_gateway.clone(),
Self::Vmnet(interface) => interface.ipv6_gateway(),
}
}
pub fn mac_address(&self) -> Option<containerization_extras::address::MACAddress> {
match self {
Self::Nat(interface) => interface.mac_address,
Self::Vmnet(interface) => interface.mac_address(),
}
}
pub fn mtu(&self) -> u32 {
match self {
Self::Nat(interface) => interface.mtu,
Self::Vmnet(interface) => interface.mtu(),
}
}
}