verify: allow cdnlist to override nxdomain (some domains have false nxdomain reports on bare domain)

This commit is contained in:
Felix Yan 2018-12-14 02:00:26 +08:00
parent e841cdc2f6
commit e3ff01f3db
No known key found for this signature in database
GPG Key ID: 786C63F330D7CB92
2 changed files with 9 additions and 2 deletions

View File

@ -2,4 +2,7 @@ www.azure.cn.mschcdn.com
www.gov.cn www.gov.cn
a1.cdn-hotels.com a1.cdn-hotels.com
cdn.jsdelivr.net cdn.jsdelivr.net
edge.yunjiasu.com edge.yunjiasu.com
www.travelsky.net
www.xiumu.org
www.igoldhk.com

View File

@ -89,10 +89,11 @@ class ChinaListVerify(object):
def check_domain(self, domain): def check_domain(self, domain):
nameservers = [] nameservers = []
nxdomain = False
try: try:
answers = dns.resolver.query(domain, 'NS') answers = dns.resolver.query(domain, 'NS')
except dns.resolver.NXDOMAIN: except dns.resolver.NXDOMAIN:
raise NXDOMAIN nxdomain = True
except: except:
pass pass
else: else:
@ -111,6 +112,9 @@ class ChinaListVerify(object):
if testdomain.endswith(domain): if testdomain.endswith(domain):
self.check_cdnlist(testdomain) self.check_cdnlist(testdomain)
if nxdomain:
raise NXDOMAIN
self.check_blacklist(nameservers) self.check_blacklist(nameservers)
for nameserver in nameservers: for nameserver in nameservers: