Trait AbstractDevice

Source
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§

Source

fn tun_name(&self) -> Result<String>

Get the device tun name.

Source

fn set_tun_name(&mut self, tun_name: &str) -> Result<()>

Set the device tun name.

Source

fn enabled(&mut self, value: bool) -> Result<()>

Turn on or off the interface.

Source

fn address(&self) -> Result<IpAddr>

Get the address.

Source

fn set_address(&mut self, value: IpAddr) -> Result<()>

Set the address.

Source

fn destination(&self) -> Result<IpAddr>

Get the destination address.

Source

fn set_destination(&mut self, value: IpAddr) -> Result<()>

Set the destination address.

Source

fn broadcast(&self) -> Result<IpAddr>

Get the broadcast address.

Source

fn set_broadcast(&mut self, value: IpAddr) -> Result<()>

Set the broadcast address.

Source

fn netmask(&self) -> Result<IpAddr>

Get the netmask.

Source

fn set_netmask(&mut self, value: IpAddr) -> Result<()>

Set the netmask.

Source

fn mtu(&self) -> Result<u16>

Get the MTU.

Source

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]

Source

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§

Source

fn configure(&mut self, config: &Configuration) -> Result<()>

Reconfigure the device.

Trait Implementations§

Source§

impl AsMut<dyn AbstractDevice> for Device

Source§

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

Source§

fn as_ref(&self) -> &(dyn AbstractDevice + 'static)

Converts this type into a shared reference of the (usually inferred) input type.

Implementors§