[][src]Struct rtnetlink::NetworkNamespace

pub struct NetworkNamespace();

Implementations

impl NetworkNamespace[src]

pub async fn add(ns_name: String) -> Result<(), Error>[src]

Add a new network namespace. This is equivalent to ip netns add NS_NAME.

pub async fn del(ns_name: String) -> Result<(), Error>[src]

Remove a network namespace This is equivalent to ip netns del NS_NAME.

pub fn prep_for_fork() -> Result<(), Error>[src]

pub fn parent_process(child: Pid) -> Result<(), Error>[src]

This is the parent process form the fork, it waits for the child to exit properly

pub fn child_process(ns_name: String) -> Result<String, Error>[src]

This is the child process, it will actually create the namespace resources. It creates the folder and namespace file. Returns the namespace file path

pub fn unshare_processing(netns_path: String) -> Result<(), Error>[src]

This function unshare the calling process and move into the given network namespace

Auto Trait Implementations

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.