News for hackers. Stuff that matters.
Re:Show HN: A simple IP address API by jgrahamc on Friday February 14, 2014 @12:28PM (#7239679)
I use https://freegeoip.net/ which gives you output in JSON, CSV or XML and has a limit of 10,000 requests per hour. The limit of 1,000 per day on this service is too low.
Re:Show HN: A simple IP address API by jaytaylor on Friday February 14, 2014 @12:44PM (#7239808)
I also like how freegeoip is open source so you can run your own instance: https://github.com/fiorix/freegeoip
Re:Show HN: A simple IP address API by shortstuffsushi on Friday February 14, 2014 @12:32PM (#7239711)
Out of curiosity, what are you doing that requires that many IP lookups?
Re:Show HN: A simple IP address API by jqueryin on Friday February 14, 2014 @12:36PM (#7239732)
Tracking visitors/customers comes to mind. Definitely not uncommon to have 1000 uniques a day :)
Re:Show HN: A simple IP address API by rhizome on Friday February 14, 2014 @12:58PM (#7239896)
I imagine caching netblocks rather than running individual IP lookups would cut down on the load quite a bit.
Re:Show HN: A simple IP address API by samuelkadolph on Saturday February 15, 2014 @12:02PM (#7244334)
If you are geolocating, I would suggest spending $370 to buy the MaxMind GeoIPCity database. There's an nginx module for it and any major language will have code to run queries against it.

http://www.maxmind.com/en/city http://nginx.org/en/docs/http/ngx_http_geoip_module.html

Re:Show HN: A simple IP address API by shortstuffsushi on Friday February 14, 2014 @12:49PM (#7239839)
So something along the lines of tracking incoming requests, then doing a DNS lookup on the incoming IP? Isn't that something that something like Google Analytics could do for you? And in that case, would this be more for people who are avoiding GA?
Re:Show HN: A simple IP address API by dudus on Friday February 14, 2014 @03:12PM (#7240720)
Google Analytics can give you this data in the reports but won't allow you to get access to it in real time in your application.

Imagine you want to redirect users to the correct country page in your site. In this case you need to get access to the ip geolocation in real time. GA won't help you there.

Re:Show HN: A simple IP address API by watson on Friday February 14, 2014 @03:34PM (#7240823)
If your goal is geo-redirection then a 3rd party service is usually a bad choice (speed + downtime). An memory geo-ip database is the best way to go - but this is usually also part of what you pay for when you buy the non-free version
Re:Show HN: A simple IP address API by hansjorg on Friday February 14, 2014 @06:22PM (#7241754)
Maxmind have a free database (GeoLite2) that's updated weekly. Here's an overview of the accuracy per country:

http://www.maxmind.com/en/geolite_city_accuracy

It's less accurate than their commercial offering, but good enough in many cases. For ease of use, there's a nice C API (https://github.com/maxmind/geoip-api-c) and wrappers like pygeoip for Python.

Re:Show HN: A simple IP address API by pkh80 on Friday February 14, 2014 @09:23PM (#7242370)
The problem is if you totally max out freogeoip it doesn't scale (or let you pay) for more requests.
Re:Show HN: A simple IP address API by arthulia on Saturday February 15, 2014 @01:08AM (#7242882)
But freegeoip's limit of 10,000 requests per hour is better than ipinfo's $200/mo plan (6,667/hr). Plus there are no limits if you run freegeoip on your own server.
Re:Show HN: A simple IP address API by ivanca on Saturday February 15, 2014 @02:03AM (#7242985)
Throws a SSL certificate error on latest Chrome (32.0.1700.107) W7 64
Re:Show HN: A simple IP address API by daviding on Saturday February 15, 2014 @02:39AM (#7243035)
Looks like no immediate fix either, which is a shame as I wanted to use it client side but (a) need SSL and (b) can't ignore Chrome (it fails on Chrome for Android latest too)..

https://github.com/fiorix/freegeoip/issues/32

Re:Show HN: A simple IP address API by Gys on Friday February 14, 2014 @01:19PM (#7240029)
This database does not know my ip address. I assume then they use a free database then so you should pay nothing either...

Anyway, this 'quality' should be free anyway ;-)

Re:Show HN: A simple IP address API by loceng on Friday February 14, 2014 @01:35PM (#7240132)
I think pretty much all pay-versions aren't 100% accurate either, from my experiences anyway.
Re:Show HN: A simple IP address API by Goopplesoft on Friday February 14, 2014 @02:24PM (#7240458)
He's not saying the paid one's are 100% accurate (obviously they aren't), but they are better.
Re:Show HN: A simple IP address API by bduerst on Friday February 14, 2014 @04:44PM (#7241185)
Right, but the point is that just because it doesn't show up doesn't mean the paid is better.

Why not check both rather than just one?

Re:Show HN: A simple IP address API by atmosx on Saturday February 15, 2014 @12:55PM (#7244557)
Thanks for that! I'm building a small script which may evolve in a service and I was retrieving IP addresses using curl, this is way more clean. Thanks!
Re:Show HN: A simple IP address API by coderholic on Friday February 14, 2014 @12:33PM (#7239713)
Yeah that's also a great service. It doesn't include the network organization or hostname though, which you may or may not need.
Re:Show HN: A simple IP address API by hox on Friday February 14, 2014 @01:50PM (#7240241)
How often is the AS info updated? What source do you use, and how do you handle multi-homed IP addresses?
Re:Show HN: A simple IP address API by welterde on Saturday February 15, 2014 @01:41PM (#7244741)
IP addresses should only be announced by one ASN at a time (regardless if that AS is multihomed or singlehomed). If that's not the case that's usually a hint of prefix hijacking.
Re:Show HN: A simple IP address API by Hansi on Friday February 14, 2014 @03:39PM (#7240848)
It's also more accurate, ipinfo.io thinks I'm in Enfield whereas freegeoip.net accurately identifies that I'm in London.
Re:Show HN: A simple IP address API by willthames on Saturday February 15, 2014 @03:07AM (#7243075)
Interesting - freegeoip.net thinks I'm about 30km from Brisbane in the opposite direction to the side I'm on.

ipinfo.io thinks I'm in Brisbane, which is slightly more accurate (although also less specific), although still about 25km out.

Re:Show HN: A simple IP address API by girvo on Saturday February 15, 2014 @01:32PM (#7244714)
/waves at another Brisbanite on HN

It gets my Location wrongish here on the Gold Coast, but not too far out. We have huge suburbs though, all of the GeoIP DB's seem to think im in the wrong suburb, despite having a static IP on Telstra cable.

Re:Show HN: A simple IP address API by NomenNudum on Saturday February 15, 2014 @06:43AM (#7243496)
Heh, thinks I'm in Romford (east London), even though I'm in west London!
Re:Show HN: A simple IP address API by gtaylor on Friday February 14, 2014 @04:41PM (#7241165)
yeah, ipinfo thinks I'm about an hour east on the other side of Atlanta.
Re:Show HN: A simple IP address API by fnsa on Friday February 14, 2014 @01:02PM (#7239925)
freegeoip also has https support for free.

I use it for my bitcoin client: https://github.com/bit-c/bitc