MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / AddPortMapping

Method AddPortMapping

src/upnp.py:115–129  ·  view source on GitHub ↗
(self, externalPort, internalPort, internalClient, protocol, description, leaseDuration = 0, enabled = 1)

Source from the content-addressed store, hash-verified

113 self.upnp_schema = service.childNodes[0].data.split(':')[-2]
114
115 def AddPortMapping(self, externalPort, internalPort, internalClient, protocol, description, leaseDuration = 0, enabled = 1):
116 from debug import logger
117 resp = self.soapRequest(self.upnp_schema + ':1', 'AddPortMapping', [
118 ('NewRemoteHost', ''),
119 ('NewExternalPort', str(externalPort)),
120 ('NewProtocol', protocol),
121 ('NewInternalPort', str(internalPort)),
122 ('NewInternalClient', internalClient),
123 ('NewEnabled', str(enabled)),
124 ('NewPortMappingDescription', str(description)),
125 ('NewLeaseDuration', str(leaseDuration))
126 ])
127 self.extPort = externalPort
128 logger.info("Successfully established UPnP mapping for %s:%i on external port %i", internalClient, internalPort, externalPort)
129 return resp
130
131 def DeletePortMapping(self, externalPort, protocol):
132 from debug import logger

Callers 1

createPortMappingMethod · 0.80

Calls 1

soapRequestMethod · 0.95

Tested by

no test coverage detected