* QPS Limit total
* QPS Limit per IP address or subnet
* QClass (QClassRule)
+ * QName (QNameRule)
* QType (QTypeRule)
* RegexRule on query name
* RE2Rule on query name (optional)
* an OrRule
* a QClassRule
* a QNameLabelsCountRule
+ * a QNameRule
* a QNameWireLengthRule
* a QTypeRule
* a RCodeRule
* `OpcodeRule()`: matches queries with the specified opcode
* `QClassRule(qclass)`: matches queries with the specified qclass (numeric)
* `QNameLabelsCountRule(min, max)`: matches if the qname has less than `min` or more than `max` labels
+ * `QNameRule(qname)`: matches queries with the specified qname
* `QNameWireLengthRule(min, max)`: matches if the qname's length on the wire is less than `min` or more than `max` bytes
* `QTypeRule(qtype)`: matches queries with the specified qtype
* `RCodeRule(rcode)`: matches queries or responses the specified rcode
{ "rmServer", true, "n", "remove server with index n" },
{ "roundrobin", false, "", "Simple round robin over available servers" },
{ "QNameLabelsCountRule", true, "min, max", "matches if the qname has less than `min` or more than `max` labels" },
+ { "QNameRule", true, "qname", "matches queries with the specified qname" },
{ "QNameWireLengthRule", true, "min, max", "matches if the qname's length on the wire is less than `min` or more than `max` bytes" },
{ "QTypeRule", true, "qtype", "matches queries with the specified qtype" },
{ "RCodeRule", true, "rcode", "matches responses with the specified rcode" },
return std::shared_ptr<DNSRule>(new AllRule());
});
+ g_lua.writeFunction("QNameRule", [](const std::string& qname) {
+ return std::shared_ptr<DNSRule>(new QNameRule(DNSName(qname)));
+ });
+
g_lua.writeFunction("QTypeRule", [](boost::variant<int, std::string> str) {
uint16_t qtype;
if(auto dir = boost::get<int>(&str)) {
if(d_quiet)
return "qname==in-set";
else
- return "qname=="+d_smn.toString();
+ return "qname in "+d_smn.toString();
}
private:
SuffixMatchNode d_smn;
bool d_quiet;
};
+class QNameRule : public DNSRule
+{
+public:
+ QNameRule(const DNSName& qname) : d_qname(qname)
+ {
+ }
+ bool matches(const DNSQuestion* dq) const override
+ {
+ return d_qname==*dq->qname;
+ }
+ string toString() const override
+ {
+ return "qname=="+d_qname.toString();
+ }
+private:
+ DNSName d_qname;
+};
+
+
class QTypeRule : public DNSRule
{
public: