MasqueradeTarget

class MasqueradeTarget(*, port: Optional[int] = None, last_port: Optional[int] = None, is_random=False, is_random_fully=False)[source]

This class provides access to the MASQUERADE target

Parameters:
  • port – port number (integer)

  • last_port – port number (integer) used when defining a port range

  • is_random – if True, use the iptables(8) --random option

  • is_random_fully – if True, use the iptables(8) --random-fully option

to_iptables_args() List[str][source]

Returns a list of iptables(8) arguments

uses_random_port_mapping() bool[source]

Returns the random target attribute

uses_fully_random_port_mapping() bool[source]

Returns the random-fully target attribute

get_ports() Tuple[int, Optional[int]][source]

Returns the port range

get_target_name() str

Returns the target name

is_terminating() bool

Returns True if this is a terminating target