Exemplo n.º 1
0
Arquivo: stun.py Projeto: bmxp/shtoom
 def startDiscovery(self):
     from shtoom.nat import isBogusAddress, getLocalIPAddress
     if _ForceStunType is not None:
         self.natType = _ForceStunType
         reactor.callLater(0, self._finishedStun)
         return
     localAddress = self.transport.getHost().host
     if isBogusAddress(localAddress):
         d = getLocalIPAddress()
         d.addCallback(self._resolveStunServers)
     else:
         self._resolveStunServers(localAddress)
Exemplo n.º 2
0
 def _cb_map_gotUPnP(self, upnp, port):
     from shtoom.nat import isBogusAddress, getLocalIPAddress
     # XXX Test that upnp is present
     self.upnp = upnp
     # Extract local address from the port
     locAddr = port.getHost().host
     if isBogusAddress(locAddr):
         # lookup local IP.
         d = getLocalIPAddress()
         d.addCallback(lambda x: self._cb_map_gotLocalIP(x, port))
     else:
         self._cb_map_gotLocalIP(locAddr, port)
Exemplo n.º 3
0
 def startDiscovery(self):
     from shtoom.nat import isBogusAddress, getLocalIPAddress
     if _ForceStunType is not None:
         self.natType = _ForceStunType
         reactor.callLater(0, self._finishedStun)
         return
     localAddress = self.transport.getHost().host
     if isBogusAddress(localAddress):
         d = getLocalIPAddress()
         d.addCallback(self._resolveStunServers)
     else:
         self._resolveStunServers(localAddress)
Exemplo n.º 4
0
 def _cb_map_gotUPnP(self, upnp, port):
     from shtoom.nat import isBogusAddress, getLocalIPAddress
     # XXX Test that upnp is present
     self.upnp = upnp
     # Extract local address from the port
     locAddr = port.getHost().host
     if isBogusAddress(locAddr):
         # lookup local IP.
         d = getLocalIPAddress()
         d.addCallback(lambda x: self._cb_map_gotLocalIP(x, port))
     else:
         self._cb_map_gotLocalIP(locAddr, port)