Skip to content

Commit

Permalink
Merge branch 'main' into 1.0.4_bump
Browse files Browse the repository at this point in the history
  • Loading branch information
sacherjj authored Sep 1, 2023
2 parents 8656d53 + 031df01 commit 4ca2bf8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions resources/maintainer_scripts/node_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ def _get_external_ip(self):
if self._external_ip:
return self._external_ip
services = (("https://checkip.amazonaws.com", "amazonaws.com"),
("https://ifconfig.me", "ifconfig.me"),
("https://ident.me", "ident.me"))
("https://4.icanhazip.com/", "icanhazip.com"),
("https://4.ident.me", "ident.me"))
ips = []
# Using our own PoolManager for shorter timeouts
print("Querying your external IP...")
Expand All @@ -285,7 +285,7 @@ def _get_external_ip(self):
def _is_valid_ip(ip):
""" Check validity of ip address """
try:
_ = ipaddress.ip_address(ip)
_ = ipaddress.IPv4Network(ip)
except ValueError:
return False
else:
Expand Down Expand Up @@ -878,6 +878,10 @@ def get_trusted_hash(self):
exit(1)
print(f"{block_hash}")

def get_ip(self):
""" Get external IP of node. Can be used to test code used for automatically filling IP
or to check if you need to update the IP in your config.toml file. """
print(self._get_external_ip())

if __name__ == '__main__':
NodeUtil()

0 comments on commit 4ca2bf8

Please sign in to comment.