From 1d56dac6d2c6ab9b29e99cc1f205c02935df1ac2 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Thu, 15 Mar 2018 15:53:07 +0100 Subject: [PATCH] add crude geoiplookup function --- pdns/lua-record.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index 28845a9ec..029e7ed38 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -734,7 +734,11 @@ std::vector> luaSynth(const std::string& code, cons }); lua.executeCode("debug.sethook(report, '', 1000)"); - + // TODO: make this better. Accept netmask/CA objects; provide names for the attr constants + lua.writeFunction("geoiplookup", [](const string &ip, const GeoIPBackend::GeoIPQueryAttribute attr) { + return getGeo(ip, attr); + }); + typedef const boost::variant > > combovar_t; lua.writeFunction("continent", [&bestwho](const combovar_t& continent) { string res=getGeo(bestwho.toString(), GeoIPBackend::Continent); -- 2.50.0