Home | History | Annotate | Line # | Download | only in ans4
      1 """
      2 Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      3 
      4 SPDX-License-Identifier: MPL-2.0
      5 
      6 This Source Code Form is subject to the terms of the Mozilla Public
      7 License, v. 2.0.  If a copy of the MPL was not distributed with this
      8 file, you can obtain one at https://mozilla.org/MPL/2.0/.
      9 
     10 See the COPYRIGHT file distributed with this work for additional
     11 information regarding copyright ownership.
     12 """
     13 
     14 import dns.rcode
     15 
     16 from isctest.asyncserver import ControllableAsyncDnsServer
     17 
     18 from ..reclimit_ans import (
     19     DirectExampleHandler,
     20     FallbackNxdomainHandler,
     21     IndirectExampleOrgHandler,
     22     LimitControlCommand,
     23     Ns1ExampleOrgHandler,
     24     ReclimitStateHandler,
     25 )
     26 
     27 
     28 def main() -> None:
     29     server = ControllableAsyncDnsServer(
     30         default_aa=True, default_rcode=dns.rcode.NOERROR
     31     )
     32     server.install_response_handlers(
     33         state_handler := ReclimitStateHandler(),
     34         DirectExampleHandler(state_handler, 4),
     35         IndirectExampleOrgHandler(state_handler, 4),
     36         Ns1ExampleOrgHandler(state_handler),
     37         FallbackNxdomainHandler(state_handler),
     38     )
     39     server.install_control_command(LimitControlCommand(state_handler))
     40     server.run()
     41 
     42 
     43 if __name__ == "__main__":
     44     main()
     45