return d_protocol != type;
}
+bool Protocol::operator==(const Protocol& rhs) const
+{
+ return d_protocol == rhs.d_protocol;
+}
+
+bool Protocol::operator!=(const Protocol& rhs) const
+{
+ return d_protocol != rhs.d_protocol;
+}
+
const std::string& Protocol::toString() const
{
return s_names.at(static_cast<uint8_t>(d_protocol));
bool operator==(typeenum) const;
bool operator!=(typeenum) const;
+ bool operator==(const Protocol& rhs) const;
+ bool operator!=(const Protocol& rhs) const;
const std::string& toString() const;
const std::string& toPrettyString() const;
Comparisons d_comparison;
};
+class IncomingProtocolRule : public DNSRule
+{
+public:
+ IncomingProtocolRule(const std::string& protocol) :
+ d_protocol(protocol)
+ {
+ }
+
+ bool matches(const DNSQuestion* dq) const override
+ {
+ return dq->getProtocol() == d_protocol;
+ }
+
+ string toString() const override
+ {
+ return "incoming protocol is " + d_protocol.toString();
+ }
+
+private:
+ dnsdist::Protocol d_protocol;
+};
+
namespace dnsdist::selectors
{
std::shared_ptr<AndRule> getAndSelector(const std::vector<std::shared_ptr<DNSRule>>& rules);
- name: "expression"
type: "String"
description: "The regex to match on"
+- name: "IncomingProtocol"
+ description: "Matches queries received over a specific protocol"
+ version_added: 2.1.0
+ parameters:
+ - name: "protocol"
+ type: "String"
+ description: "The protocol to match on, in a case-sensitive way. Supported values are DoUDP, DoTCP, DNSCryptUDP, DNSCryptTCP, DoT, DoH, DoQ and DoH3"
- name: "KeyValueStoreLookup"
skip-cpp: true
skip-rust: true
output += '-' * len(object_name) + '\n'
output += '\n'
+ if 'version_added' in entries:
+ output += ' .. versionadded:: ' + entries['version_added'] + '\n'
+ output += '\n'
+
if 'description' in entries:
description = entries['description']
output += description + '\n'
:param str path: The exact HTTP path to match on
+.. function:: IncomingProtocolRule(protocol)
+
+ .. versionadded:: 2.1.0
+
+ Matches queries received over a specific protocol.
+
+ :param str protocol: The protocol to match on, in a case-sensitive way. Supported values are DoUDP, DoTCP, DNSCryptUDP, DNSCryptTCP, DoT, DoH, DoQ and DoH3
+
.. function:: KeyValueStoreLookupRule(kvs, lookupKey)
.. versionadded:: 1.4.0