Struct smoltcp::phy::TunTapInterface
source · 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 !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