Struct Filter

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

Implementations§

Source§

impl Filter

Source

pub fn new() -> Self

Source

pub fn add_host(self, host: IpAddr) -> Self

Adds an ip host to the filter. It clears the src and dst hosts. Ips added here can match both src and dst hosts.

§Arguments
  • host - The ip address to add to the filter.
Source

pub fn add_src_host(self, src_host: IpAddr) -> Self

Adds a src ip host to the filter. It clears the general hosts. Ips added here must be present as the src host of packets.

§Arguments
  • src_host - The ip address to add to the filter.
Source

pub fn add_dst_host(self, dst_host: IpAddr) -> Self

Adds a dest ip host to the filter. It clears the general hosts. Ips added here must be present as the dest host of packets.

§Arguments
  • dst_host - The ip address to add to the filter.
Source

pub fn clear_host(self) -> Self

Deletes all the previously added IP hosts.

Source

pub fn clear_src_host(self) -> Self

Deletes all the previously added source IP hosts.

Source

pub fn clear_dst_host(self) -> Self

Deletes all the previously added dest IP hosts.

Source

pub fn set_tcp_only(self) -> Self

Detect only tcp packets.

Source

pub fn set_udp_only(self) -> Self

Detect only udp packets.

Source

pub fn clear_protocol(self) -> Self

Detect both tcp and udp packets.

Source

pub fn add_port(self, port: u16) -> Self

Add an accepted port to the filter. Matches both src and dst ports. It clears the src and dst ports.

§Arguments
  • port - The valid port to add to the filter.
Source

pub fn add_src_port(self, src_port: u16) -> Self

Add an accepted source port to the filter. It clears the general ports.

§Arguments
  • src_port - The source port to accept.
Source

pub fn add_dst_port(self, dst_port: u16) -> Self

Add an accepted dest port to the filter. It clears the generic ports.

§Arguments
  • dst_port - The destination port to accept.

Trait Implementations§

Source§

impl Default for Filter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Filter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Filter

§

impl RefUnwindSafe for Filter

§

impl Send for Filter

§

impl Sync for Filter

§

impl Unpin for Filter

§

impl UnwindSafe for Filter

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.