I actually run this service =) Surprised to see it on here! Am happy to answer any questions (if there are any) =)
Oh, that is neat! :) I hadn’t heard of it, but yes, it looks as though it fills a real need. I like that the examples are for a broad range of languages.
Ya! I started it a while back as a small need – it’s useful for dynamic DNS type stuff, and auto-provisioning tools. I tried to make the libraries really robust and fool-proof. They all use exponential backoff and retry logic, and try to smartly handle all network errors / etc =)
This looks neat, I usually hit http://whatismyip.akamai.com when I need it programatically as they just return the plaintext, but I never remember the URL and have to go search my browser history for it every damn time!
I do have a small suggestion for the ruby example however, open-uri is easy to use, but devs who use it should be aware what they’re doing with it - if you’re using it to load in external resources you could be opening yourself up to a remote code exploit. http://sakurity.com/blog/2015/02/28/openuri.html has more information.
Might I suggest you just drop back to net/http (which is all open-uri is wrapping) instead for the example? It’s still pretty small:
ip = Net::HTTP.get(URI("https://api.ipify.org"))
puts "My public IP Address is: " + ip
Thanks for the suggestion! I’m not a ruby guy, so the ruby example was cobbled together. I just updated the code snippets! <33
Awesome, thanks! I should’ve noticed it was on github and opened an issue there heh. :-)
I found http://icanhazip.com to be easy to remember. It also return the IP in text/plain.
Neat. I generally use icanhazip.com for this purpose. The native JSON is a nice touch!
I generally use http://ifconfig.me/. It’s nice to know one more alternative is out there though, thanks.
I don’t understand how a service so simple can be so slow.
$ time curl ifconfig.me > /dev/null
4.37 real 0.00 user 0.00 sys
$ time curl api.ipify.org > /dev/null
0.13 real 0.00 user 0.00 sys
Yes, ifconfig.me is really too slow, but also too easy to remember. :p
This is another popular one I see mentioned a lot:
Very nice documentation site for this, that was a nice touch. Although if you must do content negotiation via query string, I wish it at least supported Accept headers as a fallback. Now I’m tempted to learn enough Go to open a PR.
I’ll add this in =) I’ve been meaning to do it. Initially I wrote this to solve a small need, and got a lot of requests for the whole querystring approach, but I’d like to make it support the pure REST stuff too ^^
dig +short myip.opendns.com @resolver1.opendns.com