From: Peter van Dijk Date: Thu, 15 Mar 2018 14:53:07 +0000 (+0100) Subject: add crude geoiplookup function X-Git-Tag: dnsdist-1.3.1~136^2~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d56dac6d2c6ab9b29e99cc1f205c02935df1ac2;p=pdns add crude geoiplookup function --- 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);