mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-10 18:20:00 -04:00
Simplify match criteria for CookieHandler
The CookieHandler class handles all traffic for the "example." domain. Make it a subclass of DomainHandler to simplify its definition.
This commit is contained in:
parent
c0f01b60fd
commit
ba6eee2b80
1 changed files with 3 additions and 4 deletions
|
|
@ -21,6 +21,7 @@ import dns.rrset
|
|||
from isctest.asyncserver import (
|
||||
AsyncDnsServer,
|
||||
DnsResponseSend,
|
||||
DomainHandler,
|
||||
QnameQtypeHandler,
|
||||
QueryContext,
|
||||
ResponseHandler,
|
||||
|
|
@ -67,10 +68,8 @@ class ExampleNSHandler(QnameQtypeHandler, StaticResponseHandler):
|
|||
additional = [rrset("ns.example.", 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue