module looks cool to me. From the docs:
This module uses the Berkerly database. This database simply contains IP blocks as keys, and countries as values. The data is obtained from the ARIN, RIPE, and APNIC whois servers. This database should be more complete and accurate than reverse DNS lookups.
This module can be used to automatically select geographically closest mirror, or to target advertising by country, or to analysis your web server logs to determine the countries of your visiters."