mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-27 12:13:20 -04:00
Remove dnspython<2.0.0 compatibility hacks from custom servers
isctest.asyncserver requires dnspython 2+ now.
(cherry picked from commit 8c2a72143c)
This commit is contained in:
parent
fa27b3df00
commit
8f0406d5fb
4 changed files with 6 additions and 20 deletions
|
|
@ -31,7 +31,7 @@ from isctest.asyncserver import (
|
|||
try:
|
||||
dns_namerelation_equal = dns.name.NameRelation.EQUAL
|
||||
dns_namerelation_subdomain = dns.name.NameRelation.SUBDOMAIN
|
||||
except AttributeError: # dnspython < 2.0.0 compat
|
||||
except AttributeError: # dnspython < 2.3.0 compat
|
||||
dns_namerelation_equal = dns.name.NAMERELN_EQUAL # type: ignore
|
||||
dns_namerelation_subdomain = dns.name.NAMERELN_SUBDOMAIN # type: ignore
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,6 @@ from isctest.asyncserver import (
|
|||
ResponseAction,
|
||||
)
|
||||
|
||||
try:
|
||||
RdataType = dns.rdatatype.RdataType
|
||||
except AttributeError: # dnspython < 2.0.0 compat
|
||||
RdataType = int # type: ignore
|
||||
|
||||
|
||||
class ChainNameGenerator:
|
||||
"""
|
||||
|
|
@ -105,13 +100,13 @@ class RecordGenerator(abc.ABC):
|
|||
|
||||
@classmethod
|
||||
def create_rrset(
|
||||
cls, owner: dns.name.Name, rrtype: RdataType, rdata: str
|
||||
cls, owner: dns.name.Name, rrtype: dns.rdatatype.RdataType, rdata: str
|
||||
) -> dns.rrset.RRset:
|
||||
return dns.rrset.from_text(owner, 86400, dns.rdataclass.IN, rrtype, rdata)
|
||||
|
||||
@classmethod
|
||||
def create_rrset_signature(
|
||||
cls, owner: dns.name.Name, rrtype: RdataType
|
||||
cls, owner: dns.name.Name, rrtype: dns.rdatatype.RdataType
|
||||
) -> dns.rrset.RRset:
|
||||
covers = dns.rdatatype.to_text(rrtype)
|
||||
ttl = "86400"
|
||||
|
|
|
|||
|
|
@ -53,13 +53,6 @@ import dns.tsig
|
|||
import dns.version
|
||||
import dns.zone
|
||||
|
||||
try:
|
||||
RdataType = dns.rdatatype.RdataType
|
||||
RdataClass = dns.rdataclass.RdataClass
|
||||
except AttributeError: # dnspython < 2.0.0 compat
|
||||
RdataType = int # type: ignore
|
||||
RdataClass = int # type: ignore
|
||||
|
||||
|
||||
_UdpHandler = Callable[
|
||||
[bytes, Tuple[str, int], asyncio.DatagramTransport], Coroutine[Any, Any, None]
|
||||
|
|
@ -291,11 +284,11 @@ class QueryContext:
|
|||
return self.alias or self.qname
|
||||
|
||||
@property
|
||||
def qclass(self) -> RdataClass:
|
||||
def qclass(self) -> dns.rdataclass.RdataClass:
|
||||
return self.query.question[0].rdclass
|
||||
|
||||
@property
|
||||
def qtype(self) -> RdataType:
|
||||
def qtype(self) -> dns.rdatatype.RdataType:
|
||||
return self.query.question[0].rdtype
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ from isctest.asyncserver import (
|
|||
ResponseAction,
|
||||
)
|
||||
|
||||
from isctest.compat import dns_rcode
|
||||
|
||||
|
||||
def log_query(qctx: QueryContext) -> None:
|
||||
"""
|
||||
|
|
@ -66,7 +64,7 @@ class EntRcodeChanger(DomainHandler):
|
|||
|
||||
@property
|
||||
@abc.abstractmethod
|
||||
def rcode(self) -> dns_rcode:
|
||||
def rcode(self) -> dns.rcode.Rcode:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_responses(
|
||||
|
|
|
|||
Loading…
Reference in a new issue