1. 15
  1.  

  2. 8

    I actually run this service =) Surprised to see it on here! Am happy to answer any questions (if there are any) =)

    1. 2

      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.

      1. 3

        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 =)

        1. 2

          Nice :)

      2. 2

        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:

        require "net/http"
        
        ip = Net::HTTP.get(URI("https://api.ipify.org"))
        puts "My public IP Address is: " + ip
        
        1. 2

          Thanks for the suggestion! I’m not a ruby guy, so the ruby example was cobbled together. I just updated the code snippets! <33

          1. 2

            Awesome, thanks! I should’ve noticed it was on github and opened an issue there heh. :-)

          2. 1

            I found http://icanhazip.com to be easy to remember. It also return the IP in text/plain.

        2. 4

          Neat. I generally use icanhazip.com for this purpose. The native JSON is a nice touch!

          1. 4

            I generally use http://ifconfig.me/. It’s nice to know one more alternative is out there though, thanks.

            1. 2

              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
              
              1. 1

                Yes, ifconfig.me is really too slow, but also too easy to remember. :p

            2. 2

              This is another popular one I see mentioned a lot:

              http://jsonip.com/

              1. 2

                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.

                1. 2

                  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 ^^

                2. 1

                  dig +short myip.opendns.com @resolver1.opendns.com