listener->start();
});
+
+ luaCtx.writeFunction("getResolvers", [](const std::string& resolvConfPath) -> LuaArray<std::string> {
+ auto resolvers = getResolvers(resolvConfPath);
+ LuaArray<std::string> result;
+ result.reserve(resolvers.size());
+ int counter = 1;
+ for (const auto& resolver : resolvers) {
+ result.emplace_back(counter, resolver.toString());
+ counter++;
+ }
+ return result;
+ });
};
Other functions
---------------
+.. function:: getResolvers(path)
+
+ .. versionadded:: 1.8.0
+
+ This function can be used to get a Lua table of name servers from a file in the resolv.conf format.
+
+ :param str path: The path to the file, usually /etc/resolv.conf
+
.. function:: maintenance()
If this function exists, it is called every second to do regular tasks.