Log::Parallel::Geo::IP - IP address to country code translation
use Log::Parallel::Geo::IP; local($Log::Parallel::Geo::IP::cc_stream_command) = "ssh my.computer cat my.cached.copy"; $cc = ip2cc("220.127.116.11"); start_ordered_ip2cc(); $integer = ip2int("18.104.22.168"); $cc = ordered_ip2cc("22.214.171.124");
This package does IP addres to country code translations. It does it based on a text file downloaded from
http://software77.net/geo-ip/. It will automatically re-download the file every
$Log::Parallel::Geo::IP::cc_update_freq days (default 3). If you're running this on multiple systems, download the file in a cronjob and distribute it.
It can do a lookup of a single address with a binary search of the file
ip2cc() or it can bulk lookups if the requests come in IP address integer order. Start bulk lookups with
start_ordered_ip2cc() and then do the lookups with
ordered_ip2cc(). Bulk lookups are much faster when you have to do a lot of them.
This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.