fix: don't fail when upstream DNS returns no AAAA records

workaround for silly recursors
This commit is contained in:
ptrcnull 2024-10-04 12:44:50 +02:00
parent 2ca4710a91
commit 62e01cbcbf

View file

@ -82,7 +82,13 @@ def resolve4(addr: str) -> list[str]:
return list(map(str, res))
def resolve6(addr: str) -> list[str]:
res = dns.resolver.resolve(addr, 'AAAA')
try:
res = dns.resolver.resolve(addr, 'AAAA')
except dns.resolver.NoAnswer:
# workaround for silly recursors that return NOERROR
# empty response when they don't support IPv6
log.warning('no IPv6 nameservers returned')
res = []
return list(map(str, res))