Pike v8.1 release 6

Class Geography.GeoIP.IPv4

Inheritance graph
Geography.GeoIP.IP Geography.GeoIP.IPv4
Description

Class for GeoIP lookups of ipv4 addresses. Uses ADT.CritBit.IPv4Tree objects internally to map IPv4 addresses to a geographical region.


Inherit IP

inherit IP : IP


Method create

Geography.GeoIP.IPv4 Geography.GeoIP.IPv4(string file_name, function(string, ADT.CritBit.IPv4Tree:void) fun)
Geography.GeoIP.IPv4 Geography.GeoIP.IPv4(ADT.CritBit.IPv4Tree tree)

Description

Objects of this class can either be created from a file file_name with an optional parsing function fun. When fun is omitted, it defaults to Geography.GeoIP.parse_maxmind. fun will be called for each line in file_name and the critbit tree to add the entry to.

Alternatively, an instance of ADT.CritBit.IPv4Tree can be passed. tree is expected to map the first address of each range to its geographical location.