CommentMatch

Example:

>>> from linuxnet.iptables import CommentMatch
>>> m = CommentMatch()
>>> m.comment().equals("some random text")
<linuxnet.iptables.matches.commentmatch.CommentMatch object at 0x7f6adbe86208>
>>> m.to_iptables_args()
['-m', 'comment', '--comment', 'some random text']
class CommentMatch[source]

Provide a way to add a comment to a rule

static get_match_name() str[source]

Returns the iptables(8) match extension name

get_criteria() Iterable[Criterion][source]

Returns the comment match criteria (only one).

comment() CommentCriterion[source]

The rule comment


CommentCriterion

class CommentCriterion(match: Match)[source]

Not really a criterion.

The value is the comment string and is set using the equals() method.

compare(is_equal: bool, *args, **kwargs) Match[source]

This Criterion method is not supported

not_equals(*args, **kwargs)[source]

This Criterion method is not supported

any() Match

Match any value.

This method is used when creating a Criterion in order to search an existing chain for rules that try to match against certain packet properties (e.g. input interface) without being particular about the specific property value (e.g. eth0).

equals(value) Match

Compare with the specified value

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: True for equals() or False for not_equals()

Raises IptablesError if the criterion is not set

is_set() bool

Returns True if the criterion has been set