StateMatch¶
Example:
>>> from linuxnet.iptables import StateMatch
>>> m = StateMatch()
>>> m.state().equals('NEW') is m
True
>>> m.to_iptables_args()
['-m', 'state', '--state', 'NEW']
- class StateMatch[source]¶
Match against the connection tracking state
This match is accessed via the state module, but it is not clear how its functionality is different from the conntrack module’s –ctstate option.
- state() StateCriterion[source]¶
Match against the connection tracking state
StateCriterion¶
- class StateCriterion(match)[source]¶
Compare with the connection tracking state
The comparison value is a string.
- compare(is_equal: bool, *args, **kwargs) Match¶
Alternative method used for comparisons. It invokes
equals()(ornot_equals()) withargsandkwargsifis_equalisTrue(orFalse).
- get_iptables_option() str¶
Returns the iptables(8) option
- get_value() Any¶
Returns the criterion value
- is_positive() bool¶
Returns the ‘polarity’ of the criterion;
Trueforequals()orFalsefornot_equals()Raises
IptablesErrorif the criterion is not set
- is_set() bool¶
Returns
Trueif the criterion has been set