SnatTarget

class SnatTarget(*, addr: Optional[IPv4Address] = None, port: Optional[int] = None, last_port: Optional[int] = None, is_random=False, is_persistent=False)[source]

This class provides access to the SNAT target

Parameters:
  • addr – an IPv4Address object

  • 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_persistent – if True, use the iptables(8) --persistent option

get_address() Optional[IPv4Address]

Returns the address used for [SD]NAT

to_iptables_args() List[str]

Returns a list of iptables(8) arguments