return std::shared_ptr<DNSAction>(new PoolAction(a));
});
+ g_lua.writeFunction("QPSAction", [](int limit) {
+ return std::shared_ptr<DNSAction>(new QPSAction(limit));
+ });
+
g_lua.writeFunction("QPSPoolAction", [](int limit, const string& a) {
return std::shared_ptr<DNSAction>(new QPSPoolAction(limit, a));
});
All queries over the limit are dropped.
This function is deprecated as of 1.2.0 and will be removed in 1.3.0, please use:
- addAction(DNSRule, QPSLimitAction(limit))
+ addAction(DNSRule, QPSAction(limit))
:param DNSRule: match queries based on this rule
:param int limit: QPS limit for this rule
Active Rules can be shown with :func:`showRules` and removed with :func:`rmRule`::
- > addAction("h4xorbooter.xyz.", QPSLimitAction(10))
- > addAction({"130.161.0.0/16", "145.14.0.0/16"} , QPSLimitAction(20))
- > addAction({"nl.", "be."}, QPSLimitAction(1))
+ > addAction("h4xorbooter.xyz.", QPSAction(10))
+ > addAction({"130.161.0.0/16", "145.14.0.0/16"} , QPSAction(20))
+ > addAction({"nl.", "be."}, QPSAction(1))
> showRules()
# Matches Rule Action
0 0 h4xorbooter.xyz. qps limit to 10
:param string poolname: The name of the pool
+.. function:: QPSAction(maxqps)
+
+ Drop a packet if it does exceed the ``maxqps`` queries per second limits.
+ Letting the subsequent rules apply otherwise.
+
+ :param int maxqps: The QPS limit
+
.. function:: QPSPoolAction(maxqps, poolname)
Send the packet into the specified pool only if it does not exceed the ``maxqps`` queries per second limits.
class TestAdvancedQPS(DNSDistTest):
_config_template = """
- addQPSLimit("qps.advanced.tests.powerdns.com", 10)
+ addAction("qps.advanced.tests.powerdns.com", QPSAction(10))
newServer{address="127.0.0.1:%s"}
"""
class TestAdvancedQPSNone(DNSDistTest):
_config_template = """
- addQPSLimit("qpsnone.advanced.tests.powerdns.com", 100)
+ addAction("qpsnone.advanced.tests.powerdns.com", QPSAction(100))
addAction(AllRule(), RCodeAction(dnsdist.REFUSED))
newServer{address="127.0.0.1:%s"}
"""