pub enum InterfaceOption {
Show 28 variants
Address(String),
Netmask(String),
Gateway(String),
Broadcast(String),
Network(String),
Mtu(u16),
BridgeAccess(u16),
BridgePorts(Vec<String>),
BridgePvid(u16),
BridgeVids(String),
BridgeVlanAware(bool),
MstpctlBpduguard(bool),
MstpctlPortadminedge(bool),
PostUp(String),
PreDown(String),
PostDown(String),
PreUp(String),
Vrf(String),
VrfTable(String),
VlanId(u16),
VlanRawDevice(String),
HwAddress(String),
DnsNameservers(String),
DnsSearch(String),
Metric(u32),
Pointopoint(String),
Media(String),
Other(String, String),
}Expand description
Represents a network interface configuration option with proper typing.
This enum provides strongly typed variants for common interface options, ensuring type safety and validation at compile time where possible.
Unknown options are captured in the InterfaceOption::Other variant.
Variants§
Address(String)
IP address, optionally with CIDR notation (e.g., “192.168.1.100” or “192.168.1.100/24”)
Netmask(String)
Network mask (e.g., “255.255.255.0”)
Gateway(String)
Default gateway address
Broadcast(String)
Broadcast address
Network(String)
Network address
Mtu(u16)
Maximum Transmission Unit
BridgeAccess(u16)
VLAN ID for bridge access port
BridgePorts(Vec<String>)
List of bridge member ports
BridgePvid(u16)
Bridge Port VLAN ID (PVID)
BridgeVids(String)
Bridge VLAN IDs (can be ranges like “100-154 199”)
BridgeVlanAware(bool)
Whether the bridge is VLAN-aware
MstpctlBpduguard(bool)
MSTP BPDU guard setting
MstpctlPortadminedge(bool)
MSTP port admin edge setting
PostUp(String)
Script to run after interface comes up
PreDown(String)
Script to run before interface goes down
PostDown(String)
Script to run after interface goes down
PreUp(String)
Script to run before interface comes up
Vrf(String)
VRF name
VrfTable(String)
VRF table (can be “auto” or a number)
VlanId(u16)
VLAN ID
VlanRawDevice(String)
Raw device for VLAN
HwAddress(String)
Hardware address (MAC)
DnsNameservers(String)
DNS nameservers
DnsSearch(String)
DNS search domains
Metric(u32)
Metric for the route
Pointopoint(String)
Point-to-point address
Media(String)
Media type
Other(String, String)
Any other option not explicitly defined
Implementations§
Source§impl InterfaceOption
impl InterfaceOption
Sourcepub fn from_key_value(key: &str, value: &str) -> Self
pub fn from_key_value(key: &str, value: &str) -> Self
Creates an InterfaceOption from a key-value pair.
This parses the value into the appropriate type based on the key.
Sourcepub fn to_key_value(&self) -> (String, String)
pub fn to_key_value(&self) -> (String, String)
Converts the option back to a key-value tuple.
Trait Implementations§
Source§impl Clone for InterfaceOption
impl Clone for InterfaceOption
Source§fn clone(&self) -> InterfaceOption
fn clone(&self) -> InterfaceOption
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more