My first stab at GeoIP2 is avalable on github:
$ git clone github.com:Tux/GeoIP2 geoip $ cd geoip $ wget -q -m -L -nd -np -nH \ http://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN-CSV.z +ip \ http://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV. +zip \ http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-C +SV.zip $ echo "create database geoip;" | psql -f - CREATE DATABASE $ perl geoip Create table stamps Create table continent Create table country Create table ipv4 Create table provider Create table city Create table ipc4 Reading Country info ... Reading Country IPv4 info ... Reading Provider IPv4 info ... Reading City info ... Reading City IPv4 info ...
Note that loading the database will require quite a bit of memory and may cause your machine to feel sluggish while loading. On my laptop this took 400 seconds. Once the data is in the database, the queries are quick.
$ time perl geoip perlmonks.org GeoIP data for 66.39.54.27 - www.perlmonks.org: CIDR : 66.39.0.0/16 IP range : 66.39.0.0 - 66.39.255.255 Provider : pair Networks City : Pittsburgh, 508, 15203 Country : US United States Continent : North America Location : 40.4254 / -79.9799 (1000) 40°25'31.44" / -79°58' +47.64" https://www.google.com/maps/place/@40.4254,-79.9799,10z Timezone : America/New_York EU member : No Satellite : No Anon Proxy: No 0.112u 0.008s 0:00.69 15.9% 0+0k 0+0io 0pf+0w
In reply to Re: GeoIP revisited
by Tux
in thread GeoIP revisited
by cavac
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |