ipinfo.io clone that doesn't rate limit http://ip.zxq.co
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Morgan Bazalgette dd6b9160ba don't force copying db 1 month ago
.gitignore add gitignore 5 months ago
Dockerfile don't force copying db 1 month ago
LICENSE license 5 years ago
README.md update dockerfile 1 month ago
go.mod add go modules 5 months ago
go.sum add go modules 5 months ago
main.go change listen 1 month ago



An ipinfo.io clone, without the rate limiting. And some other thingies.


The main reason for this is: rate limiting. ipinfo.io sets a rate limiting of 1000 requests per day. I understand it, although that’s a bit of a bummer. So I said, whatever. Let’s just write our own clone. So, there you have it.


This is really similiar to the way ipinfo.io does it. Every response will be identical from ipinfo.io’s, almost. So, basic usage: you will just make a GET request to http://ip.zxq.co/[ip], like http://ip.zxq.co/ Need to get something specific? http://ip.zxq.co/

$ curl ip.zxq.co/
{"city":"Mountain View","continent":"NA","continent_full":"North America","country":"US","country_full":"United States","ip":"","loc":"37.3860,-122.0838","postal":"94040","region":"California"}
$ curl ip.zxq.co/

That is a bit ugly, though. Especially for testing purposes. Let’s make it pretty, shall we?

$ curl "ip.zxq.co/"
  "city": "Mountain View",
  "continent": "NA",
  "continent_full": "North America",
  "country": "US",
  "country_full": "United States",
  "ip": "",
  "loc": "37.3860,-122.0838",
  "postal": "94040",
  "region": "California"

Much better! 😄

But what if we don’t know the user’s IP? In that case, then, we can call /self.

$ curl "ip.zxq.co/self?pretty=1"
  "city": "",
  "continent": "EU",
  "continent_full": "Europe",
  "country": "IT",
  "country_full": "Italy",
  "ip": "",
  "loc": "42.8333,12.8333",
  "postal": "",
  "region": ""

Using /self works just like any normal request with an IP, which means you can still get a specific field. By default if you do not specify any IP it will assume it’s /self, although it’s recommended to always specify it, as if for any reason you have “webkit”, “opera” or “mozilla” in your user agent, it will assume you’re accessing from a browser and redirect you to this README.

We’re aren’t done just yet! You want to use JSONP. You guess it, we are using the same system as ipinfo.io’s. Just provide a callback parameter to your GET request.

$ curl "ip.zxq.co/"
/**/ typeof myFancyFunction === 'function' && myFancyFunction({
  "city": "Mountain View",
  "continent": "NA",
  "continent_full": "North America",
  "country": "US",
  "country_full": "United States",
  "ip": "",
  "loc": "37.3860,-122.0838",
  "postal": "94040",
  "region": "California"
var myFancyFunction = function(data) {
  alert("The city of the IP address is: " + data.city);
<script src="http://ip.zxq.co/"></script>

Features that aren’t here (and not going to be implemented)

  • Hostname. We would have to pick that data from another data source, which is too much effort.
  • Organization field. Need another datasource. Effort. Performance. I’ll just stick with not having it.

Features that aren’t on ipinfo.io but are here

  • JSON minified, so it gets to your server quicker.
  • Full name for the country!
  • We also got continent info, with the full name too.

Some advantages:

  • We are using Go and not nodejs like them. Go is a compiled language, and therefore is amazingly fast. A response can be generated in a very short time.
  • We get data only from one data source. Which means no lookups on other databases, which results in being faster overall.
  • We are open source. Which means you can compile and put it on your own server!

Running locally/development/contributing:

Feel free to open an issue or pull request for anything! If you want to run it locally for whatever reason, you can do so this way if you don’t need to touch the code:

go get -d http://github.com/thehowl/ip.zxq.co
cd $GOPATH/src/github.com/thehowl/ip.zxq.co
go build
./ip.zxq.co # .exe if you're on windows

After installing, you need to place a GeoLite database in the same folder. The original GeoLite databases are now hard to access and require registration, but a good (free) alternative is available here: https://db-ip.com/db/download/ip-to-city-lite

The file must be named GeoLite2-City.mmdb.

(the reason you can’t just do go get and then execute it from the terminal is that the software requires GeoLite2-City.mmdb to be in the same folder)

If you want to hack in the future, this is a better way:

mkdir -p src/github.com/thehowl
cd src/github.com/thehowl
git clone git@github.com:thehowl/ip.zxq.co.git
cd ip.zxq.co
go build
# Or if you don't want to create the binary in the folder
go run main.go


MIT. Check LICENSE file.