return true;
}
#endif
+
+bool checkDNSCryptQuery([[maybe_unused]] const ClientState& clientState, [[maybe_unused]] PacketBuffer& query, [[maybe_unused]] std::unique_ptr<DNSCryptQuery>& dnsCryptQuery, [[maybe_unused]] time_t now, [[maybe_unused]] bool tcp)
+{
+#ifdef HAVE_DNSCRYPT
+ if (clientState.dnscryptCtx) {
+ PacketBuffer response;
+ dnsCryptQuery = std::make_unique<DNSCryptQuery>(clientState.dnscryptCtx);
+
+ bool decrypted = handleDNSCryptQuery(query, *dnsCryptQuery, tcp, now, response);
+
+ if (!decrypted) {
+ if (!response.empty()) {
+ query = std::move(response);
+ return true;
+ }
+ throw std::runtime_error("Unable to decrypt DNSCrypt query, dropping.");
+ }
+ }
+#endif /* HAVE_DNSCRYPT */
+ return false;
+}
#pragma once
#include "config.h"
+#include "dnsdist.hh"
#ifdef HAVE_DNSCRYPT
-#include "dnsdist.hh"
bool handleDNSCryptQuery(PacketBuffer& packet, DNSCryptQuery& query, bool tcp, time_t now, PacketBuffer& response);
bool encryptResponse(PacketBuffer& response, size_t maximumSize, bool tcp, std::unique_ptr<DNSCryptQuery>& dnsCryptQuery);
#endif
+bool checkDNSCryptQuery(const ClientState& clientState, PacketBuffer& query, std::unique_ptr<DNSCryptQuery>& dnsCryptQuery, time_t now, bool tcp);
#include "dnsdist.hh"
#include "dnsdist-concurrent-connections.hh"
#include "dnsdist-dnsparser.hh"
+#include "dnsdist-dnscrypt.hh"
#include "dnsdist-ecs.hh"
#include "dnsdist-edns.hh"
#include "dnsdist-nghttp2-in.hh"
return true;
}
-bool checkDNSCryptQuery(const ClientState& clientState, [[maybe_unused]] PacketBuffer& query, [[maybe_unused]] std::unique_ptr<DNSCryptQuery>& dnsCryptQuery, [[maybe_unused]] time_t now, [[maybe_unused]] bool tcp)
-{
- if (clientState.dnscryptCtx) {
-#ifdef HAVE_DNSCRYPT
- PacketBuffer response;
- dnsCryptQuery = std::make_unique<DNSCryptQuery>(clientState.dnscryptCtx);
-
- bool decrypted = handleDNSCryptQuery(query, *dnsCryptQuery, tcp, now, response);
-
- if (!decrypted) {
- if (!response.empty()) {
- query = std::move(response);
- return true;
- }
- throw std::runtime_error("Unable to decrypt DNSCrypt query, dropping.");
- }
-#endif /* HAVE_DNSCRYPT */
- }
- return false;
-}
-
bool checkQueryHeaders(const struct dnsheader& dnsHeader, ClientState& clientState)
{
if (dnsHeader.qr) { // don't respond to responses
class DNSCryptQuery;
-bool checkDNSCryptQuery(const ClientState& clientState, PacketBuffer& query, std::unique_ptr<DNSCryptQuery>& dnsCryptQuery, time_t now, bool tcp);
-
enum class ProcessQueryResult : uint8_t
{
Drop,