pub struct Interface {Show 18 fields
pub index: u32,
pub name: String,
pub friendly_name: Option<String>,
pub description: Option<String>,
pub if_type: InterfaceType,
pub mac_addr: Option<MacAddr>,
pub ipv4: Vec<Ipv4Net>,
pub ipv6: Vec<Ipv6Net>,
pub ipv6_scope_ids: Vec<u32>,
pub flags: u32,
pub oper_state: OperState,
pub transmit_speed: Option<u64>,
pub receive_speed: Option<u64>,
pub stats: Option<InterfaceStats>,
pub gateway: Option<NetworkDevice>,
pub dns_servers: Vec<IpAddr>,
pub mtu: Option<u32>,
pub default: bool,
}Expand description
A network interface.
Fields§
§index: u32§name: String§friendly_name: Option<String>§description: Option<String>§if_type: InterfaceType§mac_addr: Option<MacAddr>§ipv4: Vec<Ipv4Net>§ipv6: Vec<Ipv6Net>§ipv6_scope_ids: Vec<u32>§flags: u32§oper_state: OperState§transmit_speed: Option<u64>§receive_speed: Option<u64>§stats: Option<InterfaceStats>§gateway: Option<NetworkDevice>§dns_servers: Vec<IpAddr>§mtu: Option<u32>§default: boolImplementations§
Source§impl Interface
impl Interface
pub fn default() -> Result<Interface, String>
pub fn dummy() -> Interface
Sourcepub fn refresh(&mut self) -> Result<()>
pub fn refresh(&mut self) -> Result<()>
Refresh all interface fields from the operating system.
This performs a fresh system lookup and may be more expensive than
the accessor methods on Interface.
pub fn is_up(&self) -> bool
pub fn is_loopback(&self) -> bool
pub fn is_point_to_point(&self) -> bool
pub fn is_multicast(&self) -> bool
pub fn is_broadcast(&self) -> bool
pub fn is_tun(&self) -> bool
pub fn is_running(&self) -> bool
pub fn is_physical(&self) -> bool
pub fn oper_state(&self) -> OperState
pub fn is_oper_up(&self) -> bool
Sourcepub fn refresh_oper_state(&mut self) -> Result<()>
pub fn refresh_oper_state(&mut self) -> Result<()>
Refresh the operational state from the operating system.
This may perform a fresh interface lookup.
Sourcepub fn update_oper_state(&mut self)
pub fn update_oper_state(&mut self)
Refresh the operational state from the operating system.
This may perform a fresh interface lookup.
Sourcepub fn ipv4_addr_iter(&self) -> impl Iterator<Item = Ipv4Addr> + '_
pub fn ipv4_addr_iter(&self) -> impl Iterator<Item = Ipv4Addr> + '_
Iterate IPv4 addresses without allocating a new vector.
pub fn ipv4_addrs(&self) -> Vec<Ipv4Addr>
Sourcepub fn ipv6_addr_iter(&self) -> impl Iterator<Item = Ipv6Addr> + '_
pub fn ipv6_addr_iter(&self) -> impl Iterator<Item = Ipv6Addr> + '_
Iterate IPv6 addresses without allocating a new vector.
pub fn ipv6_addrs(&self) -> Vec<Ipv6Addr>
Sourcepub fn ip_addr_iter(&self) -> impl Iterator<Item = IpAddr> + '_
pub fn ip_addr_iter(&self) -> impl Iterator<Item = IpAddr> + '_
Iterate IP addresses without allocating a new vector.
pub fn ip_addrs(&self) -> Vec<IpAddr>
pub fn has_ipv4(&self) -> bool
pub fn has_ipv6(&self) -> bool
pub fn has_global_ipv4(&self) -> bool
pub fn has_global_ipv6(&self) -> bool
pub fn has_global_ip(&self) -> bool
pub fn global_ipv4_addrs(&self) -> Vec<Ipv4Addr>
pub fn global_ipv6_addrs(&self) -> Vec<Ipv6Addr>
pub fn global_ip_addrs(&self) -> Vec<IpAddr>
Sourcepub fn refresh_stats(&mut self) -> Result<()>
pub fn refresh_stats(&mut self) -> Result<()>
Refresh interface statistics from the operating system.
This may perform a fresh interface lookup.
Sourcepub fn update_stats(&mut self) -> Result<()>
pub fn update_stats(&mut self) -> Result<()>
Refresh interface statistics from the operating system.
This may perform a fresh interface lookup.
Trait Implementations§
impl Eq for Interface
impl StructuralPartialEq for Interface
Auto Trait Implementations§
impl Freeze for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnsafeUnpin for Interface
impl UnwindSafe for Interface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more