mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Follow common naming and coding conventions
Make the handlers defined in bin/tests/system/resend_loop/ans3/ans.py
follow canonical naming conventions used in other system tests. Keep
all server initialization code in the main() function.
(cherry picked from commit c5a30a7220)
This commit is contained in:
parent
074e435e3a
commit
6ad854d206
1 changed files with 6 additions and 10 deletions
|
|
@ -37,14 +37,14 @@ def rrset(
|
|||
return dns.rrset.from_text(qname, ttl, dns.rdataclass.IN, rtype, rdata)
|
||||
|
||||
|
||||
class RootNSHandler(QnameQtypeHandler, StaticResponseHandler):
|
||||
class RootNsHandler(QnameQtypeHandler, StaticResponseHandler):
|
||||
qnames = ["."]
|
||||
qtypes = [dns.rdatatype.NS]
|
||||
answer = [rrset(".", dns.rdatatype.NS, "a.root-servers.nil.")]
|
||||
additional = [rrset("a.root-servers.nil.", dns.rdatatype.A, "10.53.0.3")]
|
||||
|
||||
|
||||
class CookieHandler(DomainHandler):
|
||||
class ExampleCookieHandler(DomainHandler):
|
||||
domains = ["example."]
|
||||
|
||||
def _get_cookie(self, qctx: QueryContext) -> dns.edns.CookieOption | None:
|
||||
|
|
@ -71,17 +71,13 @@ class CookieHandler(DomainHandler):
|
|||
yield DnsResponseSend(qctx.response)
|
||||
|
||||
|
||||
def resend_server() -> AsyncDnsServer:
|
||||
def main() -> None:
|
||||
server = AsyncDnsServer(default_aa=True, default_rcode=dns.rcode.NOERROR)
|
||||
server.install_response_handlers(
|
||||
RootNSHandler(),
|
||||
CookieHandler(),
|
||||
RootNsHandler(),
|
||||
ExampleCookieHandler(),
|
||||
)
|
||||
return server
|
||||
|
||||
|
||||
def main() -> None:
|
||||
resend_server().run()
|
||||
server.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Reference in a new issue