8.1. Geoip¶
GeoIP utility module.
Usage:
local geoip = require('misc/geoip')
8.1.1. API¶
- geoip.open(file) → geoip_handle¶
Parameters: - file (string) – GeoIP data file.
Load GeoIP data file.
8.1.2. Example¶
local ipv4 = require('protocol/ipv4')
local geoip_module = require('misc/geoip')
local geoip = geoip_module.open('/usr/share/GeoIP/GeoIP.dat')
print(geoip:country(ipv4.addr("8.8.8.8")))