CreateBuilder

Struct CreateBuilder 

Source
pub struct CreateBuilder<'a, T: SetType> { /* private fields */ }
Expand description

Helper for creating a ipset

Implementations§

Source§

impl<'a, T: SetType> CreateBuilder<'a, T>

Source

pub fn with_timeout(self, timeout: u32) -> Result<Self, Error>

All set types supports the optional timeout parameter when creating a set and adding entries. The value of the timeout parameter for the create command means the default timeout value (in seconds) for new entries. If a set is created with timeout support, then the same timeout option can be used to specify non-default timeout values when adding entries. Zero timeout value means the entry is added permanent to the set.

Source

pub fn with_counters(self) -> Result<Self, Error>

All set types support the optional counters option when creating a set. If the option is specified then the set is created with packet and byte counters per element support. The packet and byte counters are initialized to zero when the elements are (re-)added to the set, unless the packet and byte counter values are explicitly specified by the packets and bytes options.

Source

pub fn with_skbinfo(self) -> Result<Self, Error>

All set types support the optional skbinfo extension. This extension allows you to store the metainfo (firewall mark, tc class and hardware queue) with every entry and map it to packets by usage of SET netfilter target with –map-set option.

Source

pub fn with_comment(self) -> Result<Self, Error>

Source

pub fn build(self) -> Result<(), Error>

last call to end the invocation.

Source§

impl<'a, T: SetType<Method = HashMethod>> CreateBuilder<'a, T>
where T::DataType: TypeName,

Source

pub fn with_hash_size(self, size: u32) -> Result<Self, Error>

This parameter is valid for the create command of all hash type sets.
It defines the initial hash size for the set, default is 1024. The hash size must be a power of two, the kernel automatically rounds up non power of two hash sizes to the first correct value.

Source

pub fn with_max_elem(self, max: u32) -> Result<Self, Error>

This parameter is valid for the create command of all hash type sets.
It does define the maximal number of elements which can be stored in the set, default 65536

Source

pub fn with_ipv6(self, ipv6: bool) -> Result<Self, Error>

This parameter is valid for the create command of all hash type sets except for hash:mac.
It defines the protocol family of the IP addresses to be stored in the set. The default is inet, i.e IPv4.

Source

pub fn with_nomatch(self) -> Result<Self, Error>

The hash set types which can store net type of data (i.e. hash:net) support the optional nomatch option when adding entries. When matching elements in the set, entries marked as nomatch are skipped as if those were not added to the set, which makes possible to build up sets with exceptions.

Source

pub fn with_forceadd(self) -> Result<Self, Error>

All hash set types support the optional forceadd parameter when creating a set.
When sets created with this option become full the next addition to the set may succeed and evict a random entry from the set.

Source§

impl<'a, T: SetType<Method = HashMethod, DataType = (NetDataType, IfaceDataType)>> CreateBuilder<'a, T>

Source

pub fn with_wildcard(self) -> Result<Self, Error>

This flag is valid when adding elements to a hash:net,iface set. If the flag is set, then prefix matching is used when comparing with this element.

Source§

impl<'a, T: SetType<Method = BitmapMethod>> CreateBuilder<'a, T>

Source

pub fn with_range( self, from: &T::DataType, to: &T::DataType, ) -> Result<Self, Error>

set range option for bitmap method. from and to must be reference, or the memory maybe destroyed when actually run the command.

Source§

impl<'a, T: SetType<DataType = IpDataType>> CreateBuilder<'a, T>
where T::Method: WithNetmask,

Source

pub fn with_netmask(self, cidr: u8) -> Result<Self, Error>

When the optional netmask parameter specified, network addresses will be stored in the set instead of IP host addresses. The cidr prefix value must be between 1-32.
An IP address will be in the set if the network address, which is resulted by masking the address with the specified netmask, can be found in the set.

Auto Trait Implementations§

§

impl<'a, T> Freeze for CreateBuilder<'a, T>

§

impl<'a, T> RefUnwindSafe for CreateBuilder<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for CreateBuilder<'a, T>

§

impl<'a, T> Sync for CreateBuilder<'a, T>

§

impl<'a, T> Unpin for CreateBuilder<'a, T>

§

impl<'a, T> UnwindSafe for CreateBuilder<'a, T>
where T: RefUnwindSafe,

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.