Add a response handler for ignoring all queries

Dropping all incoming queries is a typical use case for a custom server
used in BIND 9 system tests.  Add a response handler implementing that
behavior so that it can be reused.
This commit is contained in:
Michał Kępień
2025-03-24 06:16:19 +01:00
parent 220fa70dea
commit 8c957388bf

View File

@@ -383,6 +383,17 @@ class ResponseHandler(abc.ABC):
yield DnsResponseSend(qctx.response)
class IgnoreAllQueries(ResponseHandler):
"""
Do not respond to any queries sent to the server.
"""
async def get_responses(
self, qctx: QueryContext
) -> AsyncGenerator[ResponseAction, None]:
yield ResponseDrop()
class DomainHandler(ResponseHandler):
"""
Base class used for deriving custom domain handlers.