[][src]Struct async_tun::TunBuilder

pub struct TunBuilder<'a> { /* fields omitted */ }

Represents a factory to build new instances of Tun.

Implementations

impl<'a> TunBuilder<'a>[src]

pub fn new() -> Self[src]

Creates a new instance of TunBuilder.

pub fn name(self, name: &'a str) -> Self[src]

Sets the name of device (max length: 16 characters), if it is empty, then device name is set by kernel. Default value is empty.

pub fn tap(self, is_tap: bool) -> Self[src]

If is_tap is true, a TAP device is allocated, otherwise, a TUN device is created. Default value is false.

pub fn packet_info(self, packet_info: bool) -> Self[src]

If packet_info is false, then IFF_NO_PI flag is set. Default value is true.

pub fn mtu(self, mtu: i32) -> Self[src]

Sets the MTU of device.

pub fn owner(self, owner: i32) -> Self[src]

Sets the owner of device.

pub fn group(self, group: i32) -> Self[src]

Sets the group of device.

pub fn address(self, address: Ipv4Addr) -> Self[src]

Sets IPv4 address of device.

pub fn destination(self, dst: Ipv4Addr) -> Self[src]

Sets IPv4 destination address of device.

pub fn broadcast(self, broadcast: Ipv4Addr) -> Self[src]

Sets IPv4 broadcast address of device.

pub fn netmask(self, netmask: Ipv4Addr) -> Self[src]

Sets IPv4 netmask address of device.

pub fn persist(self) -> Self[src]

Makes the device persistent.

pub fn up(self) -> Self[src]

Sets up the device.

pub async fn try_build(self) -> Result<Tun>[src]

Builds a new instance of Tun.

pub async fn try_build_mq(self, queues: usize) -> Result<Vec<Tun>>[src]

Builds multiple instances of Tun with IFF_MULTI_QUEUE flag.

Trait Implementations

impl<'a> Default for TunBuilder<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for TunBuilder<'a>

impl<'a> Send for TunBuilder<'a>

impl<'a> Sync for TunBuilder<'a>

impl<'a> Unpin for TunBuilder<'a>

impl<'a> UnwindSafe for TunBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.