def __init__(self, source_ip: Host, source_port: Port, strategy='auto', **kwargs):
        """
        Create a port mapped socket via selectable strategy.
        Args:
            source_ip (ip string): the network interface/ip to bind
            source_port (int): the local port to bind
            strategy (str, tuple): Strategy to use to traverse NAT (auto, upnp, stun, none,
                                   (ip, port))
            **kwargs: generic kwargs that are passed to the underlying implementations

        The traversal methods are implemented in the `map_<method>` and `unmap_<method>` methods.
        """
        self.source_ip = source_ip
        self.source_port = source_port
        self.method_args = None
        if isinstance(strategy, tuple):
            if strategy[1] is None:
                # If no external port was provided use local one
                strategy = strategy[0], source_port
            self.strategy_args = strategy
            strategy = 'ext'
        self.strategy = strategy
        self.kwargs = kwargs
        self.method = None
        self.socket = None
        self.storage = {}
def __init__ ( self , source_ip : Host , source_port : Port , strategy = 'auto' , ** kwargs ) : self . source_ip = source_ip self . source_port = source_port self . method_args = None if isinstance ( strategy , tuple ) : if strategy [ 1 ] is None : strategy = strategy [ 0 ] , source_port self . strategy_args = strategy strategy = 'ext' self . strategy = strategy self . kwargs = kwargs self . method = None self . socket = None self . storage = { }
Create a port mapped socket via selectable strategy.
        Args:
            source_ip (ip string): the network interface/ip to bind
            source_port (int): the local port to bind
            strategy (str, tuple): Strategy to use to traverse NAT (auto, upnp, stun, none,
                                   (ip, port))
            **kwargs: generic kwargs that are passed to the underlying implementations

        The traversal methods are implemented in the `map_<method>` and `unmap_<method>` methods.