bugfix
This commit is contained in:
parent
2d22940819
commit
bc9012e8b5
@ -32,16 +32,26 @@ class AcrossNat(object):
|
|||||||
|
|
||||||
def get_external_ip(self):
|
def get_external_ip(self):
|
||||||
if self.pmp_supported:
|
if self.pmp_supported:
|
||||||
self.external_ip = pmp.get_public_address()
|
try:
|
||||||
return self.external_ip
|
self.external_ip = pmp.get_public_address()
|
||||||
|
return self.external_ip
|
||||||
|
except:
|
||||||
|
self.pmp_supported = False
|
||||||
|
|
||||||
if self.upnp_supported:
|
if self.upnp_supported:
|
||||||
x = self.upnp.GetExternalIPAddress()
|
try:
|
||||||
return x['NewExternalIPAddress']
|
x = self.upnp.GetExternalIPAddress()
|
||||||
|
return x['NewExternalIPAddress']
|
||||||
|
except:
|
||||||
|
self.upnp_supported = False
|
||||||
try:
|
try:
|
||||||
return get('https://api.ipify.org').text
|
return get('https://api.ipify.org').text
|
||||||
except:
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
return get('https://ipapi.co/ip/').text
|
return get('https://ipapi.co/ip/').text
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
def upnp_check_external_port(self, eport, protocol='TCP'):
|
def upnp_check_external_port(self, eport, protocol='TCP'):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user