Struct iptables::IPTables[][src]

pub struct IPTables {
    pub cmd: &'static str,
    pub has_check: bool,
    pub has_wait: bool,
}

Contains the iptables command and shows if it supports -w and -C options. Use new method to create a new instance of this struct.

Fields

cmd: &'static str

The utility command which must be ‘iptables’ or ‘ip6tables’.

has_check: bool

Indicates if iptables has -C (–check) option

has_wait: bool

Indicates if iptables has -w (–wait) option

Implementations

impl IPTables[src]

pub fn get_policy(
    &self,
    table: &str,
    chain: &str
) -> Result<String, Box<dyn Error>>
[src]

Get the default policy for a table/chain.

pub fn set_policy(
    &self,
    table: &str,
    chain: &str,
    policy: &str
) -> Result<(), Box<dyn Error>>
[src]

Set the default policy for a table/chain.

pub fn execute(
    &self,
    table: &str,
    command: &str
) -> Result<Output, Box<dyn Error>>
[src]

Executes a given command on the chain. Returns the command output if successful.

pub fn exists(
    &self,
    table: &str,
    chain: &str,
    rule: &str
) -> Result<bool, Box<dyn Error>>
[src]

Checks for the existence of the rule in the table/chain. Returns true if the rule exists.

pub fn chain_exists(
    &self,
    table: &str,
    chain: &str
) -> Result<bool, Box<dyn Error>>
[src]

Checks for the existence of the chain in the table. Returns true if the chain exists.

pub fn insert(
    &self,
    table: &str,
    chain: &str,
    rule: &str,
    position: i32
) -> Result<(), Box<dyn Error>>
[src]

Inserts rule in the position to the table/chain.

pub fn insert_unique(
    &self,
    table: &str,
    chain: &str,
    rule: &str,
    position: i32
) -> Result<(), Box<dyn Error>>
[src]

Inserts rule in the position to the table/chain if it does not exist.

pub fn replace(
    &self,
    table: &str,
    chain: &str,
    rule: &str,
    position: i32
) -> Result<(), Box<dyn Error>>
[src]

Replaces rule in the position to the table/chain.

pub fn append(
    &self,
    table: &str,
    chain: &str,
    rule: &str
) -> Result<(), Box<dyn Error>>
[src]

Appends rule to the table/chain.

pub fn append_unique(
    &self,
    table: &str,
    chain: &str,
    rule: &str
) -> Result<(), Box<dyn Error>>
[src]

Appends rule to the table/chain if it does not exist.

pub fn append_replace(
    &self,
    table: &str,
    chain: &str,
    rule: &str
) -> Result<(), Box<dyn Error>>
[src]

Appends or replaces rule to the table/chain if it does not exist.

pub fn delete(
    &self,
    table: &str,
    chain: &str,
    rule: &str
) -> Result<(), Box<dyn Error>>
[src]

Deletes rule from the table/chain.

pub fn delete_all(
    &self,
    table: &str,
    chain: &str,
    rule: &str
) -> Result<(), Box<dyn Error>>
[src]

Deletes all repetition of the rule from the table/chain.

pub fn list(
    &self,
    table: &str,
    chain: &str
) -> Result<Vec<String>, Box<dyn Error>>
[src]

Lists rules in the table/chain.

pub fn list_table(&self, table: &str) -> Result<Vec<String>, Box<dyn Error>>[src]

Lists rules in the table.

pub fn list_chains(&self, table: &str) -> Result<Vec<String>, Box<dyn Error>>[src]

Lists the name of each chain in the table.

pub fn new_chain(&self, table: &str, chain: &str) -> Result<(), Box<dyn Error>>[src]

Creates a new user-defined chain.

pub fn flush_chain(
    &self,
    table: &str,
    chain: &str
) -> Result<(), Box<dyn Error>>
[src]

Flushes (deletes all rules) a chain.

pub fn rename_chain(
    &self,
    table: &str,
    old_chain: &str,
    new_chain: &str
) -> Result<(), Box<dyn Error>>
[src]

Renames a chain in the table.

pub fn delete_chain(
    &self,
    table: &str,
    chain: &str
) -> Result<(), Box<dyn Error>>
[src]

Deletes a user-defined chain in the table.

pub fn flush_table(&self, table: &str) -> Result<(), Box<dyn Error>>[src]

Flushes all chains in a table.

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.