NAME

Log::Parallel::Geo::IP - IP address to country code translation

SYNOPSIS

use Log::Parallel::Geo::IP;

local($Log::Parallel::Geo::IP::cc_stream_command) = "ssh my.computer cat my.cached.copy";

$cc = ip2cc("1.2.3.4");

start_ordered_ip2cc();
$integer = ip2int("1.2.3.4");
$cc = ordered_ip2cc("1.2.3.4");

DESCRIPTION

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.

LICENSE

This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.