Perl module for identifying Chinese IP addresses
This new Perl module IP::China provides a lookup for internet addresses which rapidly tells whether they are from China. It is based on a binary search of a database of about 2600 ranges, from the MaxMind GeoLite IP database.
This module is written in C and uses a binary search of the database, which is compiled into the code. Thus it should be extremely fast. The total size of the binary of the module is less than 30,000 bytes when compiled, so memory use should also be very small.
I blog about Perl.
I've been told by David Landgren that he initially wrote Regexp::Assemble for about the same task: filtering on IP address blocks. Your implemetation is probably more effecient but of a tighter usage.
An it would be better if the building script (that use GeoIP to generate block-china-data.c) was included in the distribution.
https://github.com/benkasminbullock/chinese-ip/blob/master/get-ip-addresses.pl