-def getCurIP(domain, family):
- '''Return the current IP of the given <domain>. <family> can be socket.AF_INET or socket.AF_INET6.'''
+def getResolver(server):
+ '''Return a resovler with the given server (defined by DNS name)'''
+ addr = socket.getaddrinfo(server, None, family=socket.AF_INET)
+ addr = addr[0][4][0]
+ res = dns.resolver.Resolver()
+ res.nameservers = [addr]
+ return res
+
+def getCurIP(domain, rtype, res):
+ '''Return the current IP of the given <domain>. <rtype> can be A or AAAA.'''