Struct riptun::TokioTun[][src]

pub struct TokioTun { /* fields omitted */ }
Expand description

An asynchronous virtual TUN device based on the tokio ecosystem.

Implementations

Create a new multi-queue async Tun device, supporting the tokio ecosystem, using the specified name and number of queues. The name parameter can be augmented with %d to denote a OS determined incrementing ID to assign this device. To get the real device name call TokioTun::name().

Return the OS determined name of this device.

Retrieve an immutable reference to the specified queue(s) if the suplied SliceIndex is inbounds.

Retrieve a mutable reference to the specified queue(s) if the suplied SliceIndex is inbounds.

Close the device destroying all internal queues. NOTE: If drain is called its on the caller to cleanup the queues.

Drain the internal queues, passing ownership of the queue and its lifecycle to the caller. This is useful in certain scenarios where extreme control over threading and I/O operations is desired.

Iterate over immutable instances internal queues.

Iterate over mutable instances of the internal queues.

Send a packet asynchronously to an available queue. This method handles collecting all of the TokioQueue::writable() futures. Then leverages [select_all()] to await the first available queue to send the datagram via.

Send a packet asynchronously via the specified TUN queue, see the TokioQueue::send() documentation for more details.

Errors

General I/O errors are possible, along with a Error::InvalidQueue if the specified queue is out of range for this device.

Receive a packet asynchronously from an available queue. This method handles collecting all of the TokioQueue::readable() futures. Then leverages [select_all()] to await the first available queue to send the datagram via.

Receive a packet asynchronously from the specified TUN queue, see the TokioQueue::recv() documentation for more details.

Errors

General I/O errors are possible, along with a Error::InvalidQueue if the specified queue is out of range for this device.

Trait Implementations

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.