]> granicus.if.org Git - pdns/commitdiff
dnsdist: add inClientStartup() function
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 8 Dec 2017 09:32:56 +0000 (10:32 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 8 Dec 2017 09:32:56 +0000 (10:32 +0100)
pdns/dnsdist-console.cc
pdns/dnsdist-lua.cc
pdns/dnsdistdist/docs/reference/config.rst

index d70a646747e438dc30e57e5530fdb93d108a40bd..ae6d449afd693102c07a82d274af884695f29944 100644 (file)
@@ -335,6 +335,7 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "getResponseRing", true, "", "return the current content of the response ring" },
   { "getServer", true, "n", "returns server with index n" },
   { "getServers", true, "", "returns a table with all defined servers" },
+  { "inClientStartup", true, "", "returns true during console client parsing of configuration" },
   { "grepq", true, "Netmask|DNS Name|100ms|{\"::1\", \"powerdns.com\", \"100ms\"} [, n]", "shows the last n queries and responses matching the specified client address or range (Netmask), or the specified DNS Name, or slower than 100ms" },
   { "leastOutstanding", false, "", "Send traffic to downstream server with least outstanding queries, with the lowest 'order', and within that the lowest recent latency"},
   { "LogAction", true, "[filename], [binary], [append], [buffered]", "Log a line for each query, to the specified file if any, to the console (require verbose) otherwise. When logging to a file, the `binary` optional parameter specifies whether we log in binary form (default) or in textual form, the `append` optional parameter specifies whether we open the file for appending or truncate each time (default), and the `buffered` optional parameter specifies whether writes to the file are buffered (default) or not." },
index d6a2b294f8009e88da9a9752ceba78afd4514222..525707e8991212b11fe7faae4fa144b41793c76a 100644 (file)
@@ -266,6 +266,11 @@ vector<std::function<void(void)>> setupLua(bool client, const std::string& confi
     dd.push_back({n.first, n.second});
   g_lua.writeVariable("dnsdist", dd);
   
+  g_lua.writeFunction("inClientStartup", [client]() {
+        return client;
+  });
+
+
   g_lua.writeFunction("newServer", 
                      [client](boost::variant<string,newserver_t> pvars, boost::optional<int> qps)
                      { 
index b8f5f08f834a9db404d66c13bccf69879f0d0772..e9d28238e726278daba7165d24013a437bccff5f 100644 (file)
@@ -118,6 +118,10 @@ Control Socket, Console and Webserver
 
   :param str address: An IP address with optional port. By default, the port is 5199.
 
+.. function:: inClientStartup()
+
+  Returns true while the console client is parsing the configuration.
+
 .. function:: makeKey()
 
   Generate and print an encryption key.