by codetrotter · 2y ago · 0 comments
Is there any Cloudflare service one can use to determine the IP instead? That way there’s not an extra company in addition to Cloudflare itself that you need to continue existing.
[0]: https://www.icanhazip.com/ [1]: https://major.io/p/a-new-future-for-icanhazip/
I’m in the middle of transferring all my domains from Squarespace thanks to Googles sale of that business to that incredibly lousy vendor.
At some point their rationale has to become irrelevant. It’s simply unprofessional behavior.
Pick your poison as you wish - either is great! :-)
curl -4 https://www.cloudflare.com/cdn-cgi/trace
curl -6 https://www.cloudflare.com/cdn-cgi/trace
Also the reason that the 1.1.1.1 one shows only IPv4 address is because 1.1.1.1 is itself an IPv4 address. So any connection to it will have to be using IPv4.Example: https://www.fullspectrum.dev/a-less-suspect-way-to-get-exter...
In my experience, you have to be careful if relying on one IP source because if they give you the wrong one, then your servers could be MITM’d. I say this because I have a script which does this exact thing, and found a couple of these ‘what’s my ip’ services giving me someone else’s IP. Because of that, I randomly select a few IP addresses and ensure they are identical before I trust any of them.
So you have some junk VPS or whatever that just has caddy hosting its log with an easy to remember domain (they're cheap enough), and you go like "curl http://easydomain.com/idreallylikemyip" and then once more: curl http://easydomain.com/N | grep "idreallylikemyip"
the code that used to work is on my github, i uploaded it there a week or two ago. Someone who needs a way to find out the public ipv4 of any device not just their own can probably figure out how to get it to work again!
Similar things are also possible with nginx and Apache.
And they offer a similar service on their DNS resolver over IPv6.
This page lists the IPv6 addresses to use when connecting to their resolver over IPv6
https://developers.cloudflare.com/1.1.1.1/ip-addresses/
and with that I just tried
dig @2606:4700:4700::1111 ch txt whoami.cloudflare +short
And it works, returning the IPv6 address that the request came from :)