dnspython: fix deprecation warnings when using dnspython 2.0
related: #6828
This commit is contained in:
@@ -69,8 +69,8 @@ def _fast_getaddrinfo(host, *args, **kwargs):
|
|||||||
addrs = []
|
addrs = []
|
||||||
expected_errors = (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer,
|
expected_errors = (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer,
|
||||||
concurrent.futures.CancelledError, concurrent.futures.TimeoutError)
|
concurrent.futures.CancelledError, concurrent.futures.TimeoutError)
|
||||||
ipv6_fut = _dns_threads_executor.submit(dns.resolver.query, host, dns.rdatatype.AAAA)
|
ipv6_fut = _dns_threads_executor.submit(dns.resolver.resolve, host, dns.rdatatype.AAAA)
|
||||||
ipv4_fut = _dns_threads_executor.submit(dns.resolver.query, host, dns.rdatatype.A)
|
ipv4_fut = _dns_threads_executor.submit(dns.resolver.resolve, host, dns.rdatatype.A)
|
||||||
# try IPv6
|
# try IPv6
|
||||||
try:
|
try:
|
||||||
answers = ipv6_fut.result()
|
answers = ipv6_fut.result()
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ def query(url, rtype):
|
|||||||
validated = True
|
validated = True
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
_logger.info(f"DNSSEC error: {repr(e)}")
|
_logger.info(f"DNSSEC error: {repr(e)}")
|
||||||
resolver = dns.resolver.get_default_resolver()
|
out = dns.resolver.resolve(url, rtype)
|
||||||
out = resolver.query(url, rtype)
|
|
||||||
validated = False
|
validated = False
|
||||||
return out, validated
|
return out, validated
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ class LNWorker(Logger, NetworkRetryManager[LNPeerAddr]):
|
|||||||
for srv_ans in srv_answers:
|
for srv_ans in srv_answers:
|
||||||
try:
|
try:
|
||||||
# note: this might block for several seconds
|
# note: this might block for several seconds
|
||||||
answers = dns.resolver.query(srv_ans['host'])
|
answers = dns.resolver.resolve(srv_ans['host'])
|
||||||
except dns.exception.DNSException as e:
|
except dns.exception.DNSException as e:
|
||||||
self.logger.info(f'failed querying (2) dns seed "{dns_seed}" for ln peers: {repr(e)}')
|
self.logger.info(f'failed querying (2) dns seed "{dns_seed}" for ln peers: {repr(e)}')
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -1295,7 +1295,7 @@ def list_enabled_bits(x: int) -> Sequence[int]:
|
|||||||
|
|
||||||
|
|
||||||
def resolve_dns_srv(host: str):
|
def resolve_dns_srv(host: str):
|
||||||
srv_records = dns.resolver.query(host, 'SRV')
|
srv_records = dns.resolver.resolve(host, 'SRV')
|
||||||
# priority: prefer lower
|
# priority: prefer lower
|
||||||
# weight: tie breaker; prefer higher
|
# weight: tie breaker; prefer higher
|
||||||
srv_records = sorted(srv_records, key=lambda x: (x.priority, -x.weight))
|
srv_records = sorted(srv_records, key=lambda x: (x.priority, -x.weight))
|
||||||
|
|||||||
Reference in New Issue
Block a user