DNS
GeoIP API for Chicken Scheme
By Arto on Mon, 2006-06-19 21:05. API | Chicken | DNS | GeoIP | Lisp | projects | SchemeGeoIP is a IP geolocation library and database developed by MaxMind. They provide a freely available GeoLite Country database that maps IP address blocks to country codes (with a claimed 97% accuracy), and sell several subscription-based commercial databases that provide more fine-grained geolocation services such as determining the exact region or city based on an IP address.
Geolocation is useful in a number of areas. For example, geolocation services can be used in web applications to customize content or target ads regionally, to select the geographically closest mirror server, or to analyze web server logs to determine the countries that visitors originate from.
As part of a distributed, geographically load-balanced DNS daemon I’ve been developing in Scheme, I’ve put together a set of GeoIP API bindings for Chicken Scheme that I’m hereby making available under the MIT License.
This was the first egg I’ve developed for Chicken — not to mention the first time I’d needed to make any real use of Chicken’s FFI — and I have to say I was pleasantly surprised at how easy it was to create.
It was gratifying to be able to go from zero to completed egg in only a couple hours simply by looking at some other eggs for examples on how to use foreign-lambda , create a setup spec, and write the eggdoc documentation.
The GeoIP API subset provided by the egg is straightforward to use. Basically, you feed in a hostname or an IP address, and you get back a country code or country name. Country codes can be returned as either the 2-letter or 3-letter codes defined in ISO-3166-1.
