pybitmessage.upnp module

src/upnp.py

A simple upnp module to forward port for BitMessage Reference: http://mattscodecave.com/posts/using-python-and-upnp-to-forward-a-port

class Router(ssdpResponse, address)[source]

Encapulate routing

AddPortMapping(externalPort, internalPort, internalClient, protocol, description, leaseDuration=0, enabled=1)

Add UPnP port mapping

DeletePortMapping(externalPort, protocol)

Delete UPnP port mapping

GetExternalIPAddress()

Get the external address

address = None
extPort = None
name = ''
path = ''
routerPath = None
soapRequest(service, action, arguments=None)

Make a request to a router

exception UPnPError(message)[source]

Bases: exceptions.Exception

Handle a UPnP error

createRequestXML(service, action, arguments=None)[source]

Router UPnP requests are XML formatted

class uPnPThread[source]

Bases: pybitmessage.network.threads.StoppableThread

Start a thread to handle UPnP activity

GOOGLE_DNS = '8.8.8.8'
SSDP_ADDR = '239.255.255.250'
SSDP_MX = 2
SSDP_PORT = 1900
SSDP_ST = 'urn:schemas-upnp-org:device:InternetGatewayDevice:1'
createPortMapping(router)

Add a port mapping

deletePortMapping(router)

Delete a port mapping

getLocalIP()

Get the local IP of the node

run()

Start the thread to manage UPnP activity

sendSearchRouter()

Querying for UPnP services