20 lines
412 B
Lua
20 lines
412 B
Lua
local compile = require("compile")
|
|
compile.check("haproxy")
|
|
local haproxy = require("haproxy")
|
|
|
|
local args = table.pack(...)
|
|
load_geoip(args[1])
|
|
|
|
local function country(txn, var1)
|
|
local src = txn:get_var(var1)
|
|
return get_country(src)
|
|
end
|
|
|
|
local function city(txn, var1)
|
|
local src = txn:get_var(var1)
|
|
return get_city(src)
|
|
end
|
|
|
|
core.register_fetches("country", country)
|
|
core.register_fetches("city", city)
|