g_lua.writeFunction("newServerPolicy", [](string name, ServerPolicy::policyfunc_t policy) { return std::make_shared<ServerPolicy>(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});
: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
---------