From 277923300e4a221433a1e94f22eba645a2a1021f Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 2 Jun 2022 12:05:36 +0200 Subject: [PATCH] dnsdist: Add the protocol (Do53, DoT, DoH, ...) of backends in the API --- pdns/dnsdist-web.cc | 1 + regression-tests.dnsdist/test_API.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pdns/dnsdist-web.cc b/pdns/dnsdist-web.cc index 5edc46114f..3d26d5ce84 100644 --- a/pdns/dnsdist-web.cc +++ b/pdns/dnsdist-web.cc @@ -951,6 +951,7 @@ static void addServerToJSON(Json::array& servers, int id, const std::shared_ptr< {"name", a->getName()}, {"address", a->d_config.remote.toStringWithPort()}, {"state", status}, + {"protocol", a->getProtocol().toPrettyString()}, {"qps", (double)a->queryLoad}, {"qpsLimit", (double)a->qps.getRate()}, {"outstanding", (double)a->outstanding}, diff --git a/regression-tests.dnsdist/test_API.py b/regression-tests.dnsdist/test_API.py index d58dd7d80f..3d3b0c6415 100644 --- a/regression-tests.dnsdist/test_API.py +++ b/regression-tests.dnsdist/test_API.py @@ -117,7 +117,7 @@ class TestAPIBasics(APITestsBase): 'dropRate', 'responses', 'tcpDiedSendingQuery', 'tcpDiedReadingResponse', 'tcpGaveUp', 'tcpReadTimeouts', 'tcpWriteTimeouts', 'tcpCurrentConnections', 'tcpNewConnections', 'tcpReusedConnections', 'tlsResumptions', 'tcpAvgQueriesPerConnection', - 'tcpAvgConnectionDuration']: + 'tcpAvgConnectionDuration', 'protocol']: self.assertIn(key, server) for key in ['id', 'latency', 'weight', 'outstanding', 'qpsLimit', 'reuseds', @@ -134,10 +134,10 @@ class TestAPIBasics(APITestsBase): self.assertTrue(frontend[key] >= 0) for pool in content['pools']: - for key in ['id', 'name', 'cacheSize', 'cacheEntries', 'cacheHits', 'cacheMisses', 'cacheDeferredInserts', 'cacheDeferredLookups', 'cacheLookupCollisions', 'cacheInsertCollisions', 'cacheTTLTooShorts']: + for key in ['id', 'name', 'cacheSize', 'cacheEntries', 'cacheHits', 'cacheMisses', 'cacheDeferredInserts', 'cacheDeferredLookups', 'cacheLookupCollisions', 'cacheInsertCollisions', 'cacheTTLTooShorts', 'cacheCleanupCount']: self.assertIn(key, pool) - for key in ['id', 'cacheSize', 'cacheEntries', 'cacheHits', 'cacheMisses', 'cacheDeferredInserts', 'cacheDeferredLookups', 'cacheLookupCollisions', 'cacheInsertCollisions', 'cacheTTLTooShorts']: + for key in ['id', 'cacheSize', 'cacheEntries', 'cacheHits', 'cacheMisses', 'cacheDeferredInserts', 'cacheDeferredLookups', 'cacheLookupCollisions', 'cacheInsertCollisions', 'cacheTTLTooShorts', 'cacheCleanupCount']: self.assertTrue(pool[key] >= 0) def testServersLocalhostPool(self): @@ -167,7 +167,7 @@ class TestAPIBasics(APITestsBase): 'dropRate', 'responses', 'tcpDiedSendingQuery', 'tcpDiedReadingResponse', 'tcpGaveUp', 'tcpReadTimeouts', 'tcpWriteTimeouts', 'tcpCurrentConnections', 'tcpNewConnections', 'tcpReusedConnections', 'tcpAvgQueriesPerConnection', - 'tcpAvgConnectionDuration']: + 'tcpAvgConnectionDuration', 'protocol']: self.assertIn(key, server) for key in ['id', 'latency', 'weight', 'outstanding', 'qpsLimit', 'reuseds', -- 2.47.2