Find your IP Address Script

Needed to find the outgoing true IP address for computer to provide for whitelisting to another proxy.  Here I am using a third party website to get an IP result icanhazip.com

Ideally I would create a client side call that is handled by the server and then queries the third party website, but a reasonable enough alternative (when developing locally as the server would be the client in this case as well) is to send the request client side and parse back the results like so

<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/superagent"></script>
<script type="text/javascript">
  async function externalIP(url) {
	const response = await superagent.get(url);
	console.log(`IP ${response.text}`);
  };  
  externalIP("https://ipv6.icanhazip.com");
  externalIP("https://ipv4.icanhazip.com");

</script>
</head>
<body>  
</body>
</html>

Results

IP 2600:1700:564:e380:9d37:4917:95c1:baa0
IP 99.120.104.246