1234567891011121314151617 |
- import miniupnpc
- upnp = miniupnpc.UPnP()
- upnp.discoverdelay = 10
- upnp.discover()
- upnp.selectigd()
- port = 8443
- # addportmapping(external-port, protocol, internal-host, internal-port, description, remote-host)
- upnp.addportmapping(port, 'TCP', upnp.lanaddr, port, 'testing', '')
- externalipaddress = upnp.externalipaddress()
- print('external ip address : ', 'https://' + externalipaddress + ':' + str(port))
|