2 This package offers ways to retreive ip addresses of the machine, and map ports
5 @author: Raphael Slinckx
6 @copyright: Copyright 2005
8 @contact: U{raphael@slinckx.net<mailto:raphael@slinckx.net>}
13 from nattraverso.pynupnp.upnp import search_upnp_device, UPnPMapper
15 def get_external_ip():
17 Returns a deferred which will be called with the WAN ip address
18 retreived through UPnP. The ip is a string of the form "x.x.x.x"
20 @return: A deferred called with the external ip address of this host
21 @rtype: L{twisted.internet.defer.Deferred}
23 return search_upnp_device().addCallback(lambda x: x.get_external_ip())
25 def get_port_mapper():
27 Returns a deferred which will be called with a L{UPnPMapper} instance.
28 This is a L{nattraverso.portmapper.NATMapper} implementation.
30 @return: A deferred called with the L{UPnPMapper} instance.
31 @rtype: L{twisted.internet.defer.Deferred}
33 return search_upnp_device().addCallback(lambda x: UPnPMapper(x))