diff options
Diffstat (limited to 'project2/proj2_s4498062/dns/resolver.py')
-rw-r--r-- | project2/proj2_s4498062/dns/resolver.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/project2/proj2_s4498062/dns/resolver.py b/project2/proj2_s4498062/dns/resolver.py index a046d5d..b57e044 100644 --- a/project2/proj2_s4498062/dns/resolver.py +++ b/project2/proj2_s4498062/dns/resolver.py @@ -1,8 +1,8 @@ """ DNS Resolver -This module contains a class for resolving hostnames. You will have to implement -things in this module. This resolver will be both used by the DNS client and the -DNS server, but with a different list of servers. +This module contains a class for resolving hostnames. You will have to +implement things in this module. This resolver will be both used by the DNS +client and the DNS server, but with a different list of servers. """ import re @@ -13,6 +13,7 @@ from dns.message import Message, Header, Question from dns.types import Type import dns.regexes as rgx + class Resolver(object): """ DNS resolver """ @@ -47,7 +48,7 @@ class Resolver(object): def do_query(self, query, using): """Send a query to a list of name servers""" for hint in using: - if re.match(rgx.IP, hint) == None: + if re.match(rgx.IP, hint) is None: continue sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(self.timeout) @@ -68,7 +69,7 @@ class Resolver(object): using += self.nameservers domains = re.match(rgx.DOMAIN, domain) - if domains == None: + if domains is None: return None sub, dom = domains.groups() if parent != '': @@ -89,7 +90,7 @@ class Resolver(object): result = self.get_hints( sub, dom, new_hints + using, in_recursion=True) - if result != None: + if result is not None: return result return [] |