Consider a list of IP addresses as provided by the X-Forwarded-For HTTP header:
10.0.0.142 , 192.168.0.10 , 184.108.40.206 , 220.127.116.11
I would like to know which is the first publicly-accessible address in that list. I can look over them easily enough, but how can I tell which are publicly-accessible? It seems to me (my untrained eye) that
10.0.0.142 is a workstation,
192.168.0.10 is an internal proxy, and
18.104.22.168 is a publicly-accessible address being forwarded through the proxy at
22.214.171.124. Is there any way to calculate this in code?
My first intuition is that addresses that start with
192. are not publicly accessible, but http://simplesniff.com reveals my home IP address to be
126.96.36.199. Is there a formula for determining which addresses are public and which are reserved private? Note that even trying to ping the server in question might not help as some servers won't respond to ping, and also there might be an address on my local network which also matched the internal address.