ChainTarget

class ChainTarget(*, chain=None, real_chain_name: Optional[str] = None)[source]

This class handles a target that is a chain

Either chain or real_chain_name must be present (and not None). If both are present, the chain’s real name must be equal to real_chain_name.

The target name is set to the real chain name.

Parameters:
  • chain – a Chain object

  • real_chain_name – a string

get_chain() Optional[Chain][source]

Returns the Chain object

resolve_chain(pft, log_failure=True) Optional[Chain][source]

Resolve the target name to the Chain object, and return that object.

Parameters:
  • pft – the IptablesPacketFilterTable object that is expected to contain the chain

  • log_failure – if True and resolution fails, log a warning

Return type:

a Chain object or None

get_target_name() str

Returns the target name

is_terminating() bool

Returns True if this is a terminating target

to_iptables_args() List[str]

Returns a list of iptables(8) arguments