Pf

Struct Pf 

Source
pub struct Pf { /* private fields */ }

Implementations§

Source§

impl Pf

Source

pub fn new(pf_dev_path: Option<&str>) -> PfResult<Self>

Creates new instance. Opens the pf device in dev.

The file descriptor for the opened PF device will be closed on drop of this instance, so don’t keep it.

Source

pub fn pfctl_kill_state<H: AsRef<str>>( &self, src: H, dest: Option<H>, ) -> PfResult<()>

Kills the state from the state table of the firewall. When host address is added to the table, it is not purged from the state table automatically and the connection will stay alive until the state is not killed.

§Arguments
  • src - a host IP address to be killed.

  • dest - a destination IP address to match if any.

Source

pub fn pfctl_table_file<'p, T: AsRef<str>>( &self, table_name: T, cmd: PfCmdFile<'p>, ) -> PfResult<i32>

Performs the operation on a specific table from the file.

§Arguments
  • table_name - a reference to a name of the table on which the operation should be performed.

  • cmd - a PfCmd operation to be performed with the payload data.

§Returns

A PfResult is returned.

  • Result::Ok is returned with the amound of the successfully performed operations (pedends on the amount of the data in payload).

  • Result::Err is returned with error description.

Source

pub fn pfctl_table<T: AsRef<str>>( &self, table_name: T, cmd: PfCmd, ) -> PfResult<i32>

Performs the operation on a specific table.

§Arguments
  • table_name - a reference to a name of the table on which the operation should be performed.

  • cmd - a PfCmd operation to be performed with the payload data.

§Returns

A PfResult is returned.

  • Result::Ok is returned with the amound of the successfully performed operations (pedends on the amount of the data in payload).

  • Result::Err is returned with error description.

Auto Trait Implementations§

§

impl Freeze for Pf

§

impl RefUnwindSafe for Pf

§

impl Send for Pf

§

impl Sync for Pf

§

impl Unpin for Pf

§

impl UnwindSafe for Pf

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.