]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Add missing documentation for dynamic block methods
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 13 Nov 2023 11:19:29 +0000 (12:19 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 14 Nov 2023 14:43:39 +0000 (15:43 +0100)
pdns/dnsdist-console.cc
pdns/dnsdistdist/docs/reference/config.rst

index 18af1c4a51e47fa6d054d4add2143d0135568b47..0856ec9b88e5c037fc1c95fb5ecda839bed1b6d5 100644 (file)
@@ -524,6 +524,8 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "getCacheHitResponseRule", true, "selector", "Return the cache-hit response rule corresponding to the selector, if any" },
   { "getCacheInsertedResponseRule", true, "selector", "Return the cache-inserted response rule corresponding to the selector, if any" },
   { "getCurrentTime", true, "", "returns the current time" },
+  { "getDynamicBlocks", true, "", "returns a table of the current network-based dynamic blocks" },
+  { "getSMTDynamicBlocks", true, "", "returns a table of the current suffix-based dynamic blocks" },
   { "getDNSCryptBind", true, "n", "return the `DNSCryptContext` object corresponding to the bind `n`" },
   { "getDNSCryptBindCount", true, "", "returns the number of DNSCrypt listeners" },
   { "getDOHFrontend", true, "n", "returns the DOH frontend with index n" },
index f5bd25e4ac2da9621300344c9578dfd7c513d2bd..d264aed9298437ee334db19dae4cafd908f7daae 100644 (file)
@@ -1440,6 +1440,18 @@ Dynamic Blocks
 
   Remove all current dynamic blocks.
 
+.. function:: getDynamicBlocks()
+
+  .. versionadded:: 1.9.0
+
+  Return an associative table of active network-based dynamic blocks. The keys are the network IP or range that are blocked, the value are :class:`DynBlock` objects.
+
+.. function:: getSMTDynamicBlocks()
+
+  .. versionadded:: 1.9.0
+
+  Return an associative table of active domain-based (Suffix Match Tree or SMT) dynamic blocks. The keys are the domains that are blocked, the values are :class:`DynBlock` objects.
+
 .. function:: showDynBlocks()
 
   List all dynamic blocks in effect.
@@ -1460,6 +1472,40 @@ Dynamic Blocks
 
   :param int sec: The interval between two runs of the cleaning algorithm, in seconds. Default is 60 (1 minute), 0 means disabled.
 
+.. class:: DynBlock
+
+  .. versionadded:: 1.9.0
+
+  Represent the current state of a dynamic block.
+
+  .. attribute:: DynBlock.action
+
+    The action of this block, as an integer representing a :ref:`DNSAction <DNSAction>`.
+
+  .. attribute:: DynBlock.blocks
+
+    The number of queries blocked.
+
+  .. attribute:: DynBlock.bpf
+
+    Whether this block is using eBPF, as a boolean.
+
+  .. attribute:: DynBlock.domain
+
+    The domain that is blocked, as a string, for Suffix Match Tree blocks.
+
+  .. attribute:: DynBlock.reason
+
+    The reason why this block was inserted, as a string.
+
+  .. attribute:: DynBlock.until
+
+    The time (in seconds since Epoch) at which the block will expire.
+
+  .. attribute:: DynBlock.warning
+
+    Whether this block is only a warning one (true) or is really enforced (false).
+
 .. _exceedfuncs:
 
 Getting addresses that exceeded parameters