From: Remi Gacogne Date: Thu, 23 Jan 2020 13:20:33 +0000 (+0100) Subject: dnsdist: Add Lua bindings and documentation for the Lua FFI policies X-Git-Tag: auth-4.3.0-beta2~1^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21e189be336ea7ac3f3938245c9385b5aa5ef104;p=thirdparty%2Fpdns.git dnsdist: Add Lua bindings and documentation for the Lua FFI policies --- diff --git a/pdns/dnsdist-lua-bindings.cc b/pdns/dnsdist-lua-bindings.cc index 60717e174d..f86f79140d 100644 --- a/pdns/dnsdist-lua-bindings.cc +++ b/pdns/dnsdist-lua-bindings.cc @@ -60,7 +60,9 @@ void setupLuaBindings(bool client) g_lua.writeFunction("newServerPolicy", [](string name, ServerPolicy::policyfunc_t policy) { return std::make_shared(name, policy, true);}); g_lua.registerMember("name", &ServerPolicy::name); g_lua.registerMember("policy", &ServerPolicy::policy); + g_lua.registerMember("ffipolicy", &ServerPolicy::ffipolicy); g_lua.registerMember("isLua", &ServerPolicy::isLua); + g_lua.registerMember("isFFI", &ServerPolicy::isFFI); g_lua.registerFunction("toString", &ServerPolicy::toString); g_lua.writeVariable("firstAvailable", ServerPolicy{"firstAvailable", firstAvailable, false}); diff --git a/pdns/dnsdistdist/docs/guides/serverselection.rst b/pdns/dnsdistdist/docs/guides/serverselection.rst index 53286c346e..16f2084dec 100644 --- a/pdns/dnsdistdist/docs/guides/serverselection.rst +++ b/pdns/dnsdistdist/docs/guides/serverselection.rst @@ -114,6 +114,35 @@ ServerPolicy Objects :param servers: A list of :class:`Server` objects :param DNSQuestion dq: The incoming query + .. attribute:: ServerPolicy.ffipolicy + + .. versionadded: 1.5.0 + + For policies implemented using the Lua FFI interface, the policy function itself. + + .. attribute:: ServerPolicy.isFFI + + .. versionadded: 1.5.0 + + Whether a Lua-based policy is implemented using the FFI interface. + + .. attribute:: ServerPolicy.isLua + + Whether this policy is a native (C++) policy or a Lua-based one. + + .. attribute:: ServerPolicy.name + + The name of the policy. + + .. attribute:: ServerPolicy.policy + + The policy function itself, except for FFI policies. + + .. method:: Server:toString() + + Return a textual representation of the policy. + + Functions ---------