pub trait AbstractDevice: Read + Write {
Show 15 methods
// Required methods
fn tun_name(&self) -> Result<String>;
fn set_tun_name(&mut self, tun_name: &str) -> Result<()>;
fn enabled(&mut self, value: bool) -> Result<()>;
fn address(&self) -> Result<IpAddr>;
fn set_address(&mut self, value: IpAddr) -> Result<()>;
fn destination(&self) -> Result<IpAddr>;
fn set_destination(&mut self, value: IpAddr) -> Result<()>;
fn broadcast(&self) -> Result<IpAddr>;
fn set_broadcast(&mut self, value: IpAddr) -> Result<()>;
fn netmask(&self) -> Result<IpAddr>;
fn set_netmask(&mut self, value: IpAddr) -> Result<()>;
fn mtu(&self) -> Result<u16>;
fn set_mtu(&mut self, value: u16) -> Result<()>;
fn packet_information(&self) -> bool;
// Provided method
fn configure(&mut self, config: &Configuration) -> Result<()> { ... }
}
Expand description
A TUN abstract device interface.
Required Methods§
Sourcefn set_tun_name(&mut self, tun_name: &str) -> Result<()>
fn set_tun_name(&mut self, tun_name: &str) -> Result<()>
Set the device tun name.
Sourcefn set_address(&mut self, value: IpAddr) -> Result<()>
fn set_address(&mut self, value: IpAddr) -> Result<()>
Set the address.
Sourcefn destination(&self) -> Result<IpAddr>
fn destination(&self) -> Result<IpAddr>
Get the destination address.
Sourcefn set_destination(&mut self, value: IpAddr) -> Result<()>
fn set_destination(&mut self, value: IpAddr) -> Result<()>
Set the destination address.
Sourcefn set_broadcast(&mut self, value: IpAddr) -> Result<()>
fn set_broadcast(&mut self, value: IpAddr) -> Result<()>
Set the broadcast address.
Sourcefn set_netmask(&mut self, value: IpAddr) -> Result<()>
fn set_netmask(&mut self, value: IpAddr) -> Result<()>
Set the netmask.
Sourcefn set_mtu(&mut self, value: u16) -> Result<()>
fn set_mtu(&mut self, value: u16) -> Result<()>
Set the MTU.
[Note: This setting has no effect on the Windows platform due to the mtu of wintun is always 65535. –end note]
Sourcefn packet_information(&self) -> bool
fn packet_information(&self) -> bool
Return whether the underlying tun device on the platform has packet information
[Note: This value is not used to specify whether the packets delivered from/to tun2 have packet information. – end note]
Provided Methods§
Sourcefn configure(&mut self, config: &Configuration) -> Result<()>
fn configure(&mut self, config: &Configuration) -> Result<()>
Reconfigure the device.
Trait Implementations§
Source§impl AsMut<dyn AbstractDevice> for Device
impl AsMut<dyn AbstractDevice> for Device
Source§fn as_mut(&mut self) -> &mut (dyn AbstractDevice + 'static)
fn as_mut(&mut self) -> &mut (dyn AbstractDevice + 'static)
Converts this type into a mutable reference of the (usually inferred) input type.
Source§impl AsRef<dyn AbstractDevice> for Device
impl AsRef<dyn AbstractDevice> for Device
Source§fn as_ref(&self) -> &(dyn AbstractDevice + 'static)
fn as_ref(&self) -> &(dyn AbstractDevice + 'static)
Converts this type into a shared reference of the (usually inferred) input type.