pub struct TunTapInterface { /* private fields */ }Expand description
A virtual TUN (IP) or TAP (Ethernet) interface.
Implementations§
Source§impl TunTapInterface
impl TunTapInterface
Sourcepub fn new(name: &str, medium: Medium) -> Result<TunTapInterface>
pub fn new(name: &str, medium: Medium) -> Result<TunTapInterface>
Attaches to a TUN/TAP interface called name, or creates it if it does not exist.
If name is a persistent interface configured with UID of the current user,
no special privileges are needed. Otherwise, this requires superuser privileges
or a corresponding capability set on the executable.
Sourcepub fn from_fd(fd: RawFd, medium: Medium, mtu: usize) -> Result<TunTapInterface>
pub fn from_fd(fd: RawFd, medium: Medium, mtu: usize) -> Result<TunTapInterface>
Attaches to a TUN/TAP interface specified by file descriptor fd.
On platforms like Android, a file descriptor to a tun interface is exposed. On these platforms, a TunTapInterface cannot be instantiated with a name.
Trait Implementations§
Source§impl AsRawFd for TunTapInterface
impl AsRawFd for TunTapInterface
Source§impl Debug for TunTapInterface
impl Debug for TunTapInterface
Source§impl Device for TunTapInterface
impl Device for TunTapInterface
type RxToken<'a> = RxToken
type TxToken<'a> = TxToken
Source§fn capabilities(&self) -> DeviceCapabilities
fn capabilities(&self) -> DeviceCapabilities
Get a description of device capabilities.
Auto Trait Implementations§
impl Freeze for TunTapInterface
impl !RefUnwindSafe for TunTapInterface
impl !Send for TunTapInterface
impl !Sync for TunTapInterface
impl Unpin for TunTapInterface
impl !UnwindSafe for TunTapInterface
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