def get_external_ip(): """ Returns a deferred which will be called with the WAN ip address retreived through UPnP. The ip is a string of the form "x.x.x.x" @return: A deferred called with the external ip address of this host @rtype: L{twisted.internet.defer.Deferred} """ return search_upnp_device().addCallback(lambda x: x.get_external_ip())
def get_port_mapper(): """ Returns a deferred which will be called with a L{UPnPMapper} instance. This is a L{nattraverso.portmapper.NATMapper} implementation. @return: A deferred called with the L{UPnPMapper} instance. @rtype: L{twisted.internet.defer.Deferred} """ return search_upnp_device().addCallback(lambda x: UPnPMapper(x))