Folk,
I've translated some of the GPL'd GeoIP (Geographic database by IP
address) C library code to perform country lookups against the free
GeoIP database (from www.maxmind.com) using pure Ruby. It should
work with all the commercial GeoIP databases also, but doesn't
implement the non-free features.
This is an alternative to Sean's Ruby wrapper for the native code
version. The code is 266 lines. What's the best way to provide it
to the community - as a Gem perhaps? What's the procedure? I don't
feel inclined to spend much effort packaging or documenting it.
Alternatively, if someone cares to test it against the commercial
versions of the database, I might be inclined to finish those
features.
The data file it uses contains a binary tree, which appears to be
built from the FTP files downloadable from the big four NICs. It
wouldn't be hard to implement a procedure to build one periodically,
and in fact I have a Ruby script that fetches the relevant files
using FTP already. I'm guessing that it wouldn't be hard to get
city information as well, by extracting the location data from
whois lookups.
Clifford Heath, cjh at the polyplex organization ;-).