pub struct CreateBuilder<'a, T: SetType> { /* private fields */ }Expand description
Helper for creating a ipset
Implementations§
Source§impl<'a, T: SetType> CreateBuilder<'a, T>
impl<'a, T: SetType> CreateBuilder<'a, T>
Sourcepub fn with_timeout(self, timeout: u32) -> Result<Self, Error>
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.
Sourcepub fn with_counters(self) -> Result<Self, Error>
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.
Sourcepub fn with_skbinfo(self) -> Result<Self, Error>
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.
pub fn with_comment(self) -> Result<Self, Error>
Source§impl<'a, T: SetType<Method = HashMethod>> CreateBuilder<'a, T>
impl<'a, T: SetType<Method = HashMethod>> CreateBuilder<'a, T>
Sourcepub fn with_hash_size(self, size: u32) -> Result<Self, Error>
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.
Sourcepub fn with_max_elem(self, max: u32) -> Result<Self, Error>
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
Sourcepub fn with_ipv6(self, ipv6: bool) -> Result<Self, Error>
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.
Sourcepub fn with_nomatch(self) -> Result<Self, Error>
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.
Sourcepub fn with_forceadd(self) -> Result<Self, Error>
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>
impl<'a, T: SetType<Method = HashMethod, DataType = (NetDataType, IfaceDataType)>> CreateBuilder<'a, T>
Sourcepub fn with_wildcard(self) -> Result<Self, Error>
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>
impl<'a, T: SetType<Method = BitmapMethod>> CreateBuilder<'a, T>
Source§impl<'a, T: SetType<DataType = IpDataType>> CreateBuilder<'a, T>where
T::Method: WithNetmask,
impl<'a, T: SetType<DataType = IpDataType>> CreateBuilder<'a, T>where
T::Method: WithNetmask,
Sourcepub fn with_netmask(self, cidr: u8) -> Result<Self, Error>
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.