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

comment() CommentCriterion[source]

The rule comment

to_iptables_args() List[str][source]

Returns iptables(8) arguments for this match


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

equals(value) Match

Compare with the specified value

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