[tahoe-dev] [tahoe-lafs] #49: UPnP

tahoe-lafs trac at allmydata.org
Sun Jul 12 18:02:22 PDT 2009


#49: UPnP
---------------------------+------------------------------------------------
     Reporter:  zooko      |        Type:  enhancement 
       Status:  new        |    Priority:  minor       
    Milestone:  undecided  |   Component:  code-network
      Version:             |    Keywords:              
Launchpad_bug:             |  
---------------------------+------------------------------------------------

Comment(by swillden):

 Replying to [comment:7 zooko]:
 > I was just trying to make my storage servers for [wiki:VolunteerGrid the
 volunteer grid] more reachable by setting up IP forwarding rules, and I
 realized that this would be nice and easy -- indeed would have happened
 automatically without my thinking about it -- if we had UPnP built in.
 >
 > So this is just a note to remind myself that I wish someone would
 implement this.  :-)

 I've fiddled a little bit with miniupnpc, which ghazel already mentioned.
 It's a C library but includes a Python wrapper.  It's pretty simple.  The
 following code was all it took to tell my gateway (a Linux box running
 linux-igd) to set up a forwarding for my Tahoe node:

 {{{
 import miniupnpc

 u = miniupnpc.UPnP()
 u.discoverdelay = 200
 u.discover()
 u.selectigd()

 external_port = 3456
 r = u.getspecificportmapping(external_port, 'TCP')
 while r != None and external_port < 65536:
     external_port += 1
     r = u.getspecificportmapping(external_port, 'TCP')
 u.addportmapping(external_port, 'TCP', u.lanaddr, 3456, "Tahoe %u" %
 external_port, '')
 }}}

 Obviously, that needs a lot of error checking, but it's still really
 straightforward.  I ran that script from the command line, and watched the
 log on my gateway to verify that the mapping was set up.  I then verified
 that I can connect to my local Tahoe server from outside.  Works fine.

-- 
Ticket URL: <http://allmydata.org/trac/tahoe/ticket/49#comment:8>
tahoe-lafs <http://allmydata.org>
secure decentralized file storage grid


More information about the tahoe-dev mailing list