mpolden / echoip

IP address lookup service
https://ifconfig.co
BSD 3-Clause "New" or "Revised" License
3.98k stars 527 forks source link

Feature request: Show IPv4 AND IPv6 #160

Open sachaz opened 2 years ago

sachaz commented 2 years ago

Hi, We cannot see IPv4 AND IPv6 if booth are available. Something like: https://www.octopuce.fr/ip.php And add to the actual http://ifconfig.co/ip: http://ifconfig.co/ipv4 and http://ifconfig.co/ipv6 ? Kind regards.

onfro commented 1 year ago

same! Please, add both ipv6 and ipv4 for ifconfig.co/json it only shows IP address and IP address (decimal) for my ipv6, but not ipv4 addr

slatian commented 1 year ago

Since there seems to be a slight misunderstanding of how IP and echoip works allow me an attempt to explain: IPv4 and IPv6 are different protocols, both can talk to the internet but there are really two internets, one only speaks IPv4, the other one only speaks IPv6. It just happens that most machines are fluent in both protocols so that in most cases not even the network people care which one is used.

The point is: You can only speak one IP version for one connection (roughly equals one http request) and therefor only fin out one IP-Address per connection.

What echoip does is simply return to you the IP address it sees as being the other end of the line (thick packet return address) to you in the format of your choice, all in one request, that is the reason it only returns one address.

https://www.octopuce.fr/ip.php can display both addresses because it actually makes two (relevant for this case) requests from the client side (html, javascript "magic"), one to ipv4.sarbl.org and one to ipv6.sarbl.org which uses the same DNS trick (the v4 address only resolves to an IPv4 address, the v6 one resolves to an IPv6 address) https://ifconfig.co used until somewhen in 2018 (look at the FAQ) (shameless self promotion: https://echoip.slatecave.net uses this trick) one makes the client use IPv4 to get the IPv4 address and one makes it use v6 to get the v6 address.


So with that in mind:

Please, add both ipv6 and ipv4 for ifconfig.co/json

No, a single curl query can't give you both at the same time, you have to query twice with the -4 and -6 as indicated in the FAQ. (or use an instance that has the v4 and v6 subdomains configured and query those)

And add to the actual http://ifconfig.co/ip: http://ifconfig.co/ipv4 and http://ifconfig.co/ipv6 ?

This doesn't work because you can't connect paths to addresses, this is why the subdomain trick is needed for browsers (yes javascript, but that won't work for curl, and why use js when the server perfectly capable of rendering html)


Remains the question: Why were the v4 and v6 domains discontinued?

I'll pass that one on to @mpolden