diff --git a/resources/maintainer_scripts/node_util.py b/resources/maintainer_scripts/node_util.py index 9456f81..eda36d4 100755 --- a/resources/maintainer_scripts/node_util.py +++ b/resources/maintainer_scripts/node_util.py @@ -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...") @@ -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: @@ -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()