Targets

All target-related classes are derived from the Target class. The following subclasses are available:


The helper class Targets provides access to the special targets (e.g. ACCEPT).

class Targets[source]

This class provides a namespace for all target classes

ACCEPT = <linuxnet.iptables.targets.target.Target object>

Special ACCEPT target

DROP = <linuxnet.iptables.targets.target.Target object>

Special DROP target

QUEUE = <linuxnet.iptables.targets.target.Target object>

Special QUEUE target

RETURN = <linuxnet.iptables.targets.target.Target object>

Special RETURN target

classmethod get_special(target_name: str) Optional[Target][source]

Returns the Target object for the special target identified by target_name.

The special targets are:

  • ACCEPT

  • DROP

  • RETURN

  • QUEUE

classmethod from_policy(policy: str) Target[source]

Return the Target object for one the special targets that can be used as a policy target. These include:

  • ACCEPT

  • DROP

  • QUEUE