Struct iptables::IPTables [−][src]
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]
&self,
table: &str,
chain: &str
) -> Result<String, Box<dyn Error>>
Get the default policy for a table/chain.
pub fn set_policy(
&self,
table: &str,
chain: &str,
policy: &str
) -> Result<(), Box<dyn Error>>
[src]
&self,
table: &str,
chain: &str,
policy: &str
) -> Result<(), Box<dyn Error>>
Set the default policy for a table/chain.
pub fn execute(
&self,
table: &str,
command: &str
) -> Result<Output, Box<dyn Error>>
[src]
&self,
table: &str,
command: &str
) -> Result<Output, Box<dyn Error>>
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]
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<bool, Box<dyn Error>>
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]
&self,
table: &str,
chain: &str
) -> Result<bool, Box<dyn Error>>
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]
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<(), Box<dyn Error>>
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]
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<(), Box<dyn Error>>
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]
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<(), Box<dyn Error>>
Replaces rule
in the position
to the table/chain.
pub fn append(
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<(), Box<dyn Error>>
[src]
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<(), Box<dyn Error>>
Appends rule
to the table/chain.
pub fn append_unique(
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<(), Box<dyn Error>>
[src]
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<(), Box<dyn Error>>
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]
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<(), Box<dyn Error>>
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]
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<(), Box<dyn Error>>
Deletes rule
from the table/chain.
pub fn delete_all(
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<(), Box<dyn Error>>
[src]
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<(), Box<dyn Error>>
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]
&self,
table: &str,
chain: &str
) -> Result<Vec<String>, Box<dyn Error>>
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]
&self,
table: &str,
chain: &str
) -> Result<(), Box<dyn Error>>
Flushes (deletes all rules) a chain.
pub fn rename_chain(
&self,
table: &str,
old_chain: &str,
new_chain: &str
) -> Result<(), Box<dyn Error>>
[src]
&self,
table: &str,
old_chain: &str,
new_chain: &str
) -> Result<(), Box<dyn Error>>
Renames a chain in the table.
pub fn delete_chain(
&self,
table: &str,
chain: &str
) -> Result<(), Box<dyn Error>>
[src]
&self,
table: &str,
chain: &str
) -> Result<(), Box<dyn Error>>
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
impl RefUnwindSafe for IPTables
impl Send for IPTables
impl Sync for IPTables
impl Unpin for IPTables
impl UnwindSafe for IPTables
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,