2179: Fix resolver r=mergify[bot] a=nextgens

## What type of PR?

bug-fix

## What does this PR do?

Switch to the new API to solve a k8s specific problem

### Related issue(s)
- #2177


Co-authored-by: Florent Daigniere <nextgens@freenetproject.org>
Co-authored-by: Billy Chan <shing@PC1>
master
bors[bot] 3 years ago committed by GitHub
commit d3db047fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -324,7 +324,7 @@ class Domain(Base):
hostnames = set(app.config['HOSTNAMES'].split(','))
return any(
rset.exchange.to_text().rstrip('.') in hostnames
for rset in dns.resolver.query(self.name, 'MX')
for rset in dns.resolver.resolve(self.name, 'MX')
)
except dns.exception.DNSException:
return False

@ -52,7 +52,7 @@ resolver.flags = dns.flags.AD | dns.flags.RD
def has_dane_record(domain, timeout=10):
try:
result = resolver.query(f'_25._tcp.{domain}', dns.rdatatype.TLSA,dns.rdataclass.IN, lifetime=timeout)
result = resolver.resolve(f'_25._tcp.{domain}', dns.rdatatype.TLSA,dns.rdataclass.IN, lifetime=timeout)
if result.response.flags & dns.flags.AD:
for record in result:
if isinstance(record, dns.rdtypes.ANY.TLSA.TLSA):

Loading…
Cancel
Save