From: Peter van Dijk Date: Mon, 8 Aug 2016 19:11:06 +0000 (+0200) Subject: expose SMN toString to lua X-Git-Tag: rec-4.0.2~40^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6b99fc11e6f1a67105fdcb90fa437e025bae5ab;p=thirdparty%2Fpdns.git expose SMN toString to lua --- diff --git a/docs/markdown/recursor/scripting.md b/docs/markdown/recursor/scripting.md index ac3291ad85..b551c8f93c 100644 --- a/docs/markdown/recursor/scripting.md +++ b/docs/markdown/recursor/scripting.md @@ -264,6 +264,8 @@ be `true` if dq.qname is part of any of the Suffix Match group domains. This could e.g. be used to answer questions for known malware domains. +To see the set of suffixes matched by a Suffix Match Group, use `:toString()`. + ### Metrics You can custom metrics which will be shown in the output of 'rec_control get-all' and sent to the metrics server over the Carbon protocol, and also appear in the diff --git a/pdns/lua-recursor4.cc b/pdns/lua-recursor4.cc index 0db7ef432f..10aad19a32 100644 --- a/pdns/lua-recursor4.cc +++ b/pdns/lua-recursor4.cc @@ -387,6 +387,7 @@ RecursorLua4::RecursorLua4(const std::string& fname) catch(std::exception& e) { theL() <registerFunction("check",(bool (SuffixMatchNode::*)(const DNSName&) const) &SuffixMatchNode::check); + d_lw->registerFunction("toString",(string (SuffixMatchNode::*)() const) &SuffixMatchNode::toString); d_lw->writeFunction("pdnslog", [](const std::string& msg, boost::optional loglevel) {