The CookieHandler class handles all traffic for the "example." domain.
Make it a subclass of DomainHandler to simplify its definition.
(cherry picked from commit
ba6eee2b80064c459d21bb7a8723bea0a3d208fd)
from isctest.asyncserver import (
AsyncDnsServer,
DnsResponseSend,
+ DomainHandler,
QnameQtypeHandler,
QueryContext,
ResponseHandler,
additional = [rrset("a.root-servers.nil.", dns.rdatatype.A, "10.53.0.3")]
-class CookieHandler(ResponseHandler):
- def match(self, qctx: QueryContext) -> bool:
- example = dns.name.from_text("example")
- return qctx.qname.is_subdomain(example)
+class CookieHandler(DomainHandler):
+ domains = ["example."]
async def get_responses(
self, qctx: QueryContext