def resolveDomainDnschainInfo(self, domain): try: match = self.isDomain(domain) sub_domain = match.group(1).strip(".") top_domain = match.group(2) if not sub_domain: sub_domain = "@" address = None with gevent.Timeout(5, Exception("Timeout: 5s")): res = Http.get("https://dnschain.info/bit/d/%s" % re.sub("\.bit$", "", top_domain)).read() data = json.loads(res)["value"] for key, val in data["zeronet"].iteritems(): self.dns_cache[key+"."+top_domain] = [val, time.time()+60*60*5] # Cache for 5 hours self.saveDnsCache() return data["zeronet"].get(sub_domain) # Not found return address except Exception, err: log.debug("Dnschain.info %s resolve error: %s" % (domain, Debug.formatException(err)))
def resolveDomainDnschainNet(self, domain): try: match = self.isDomain(domain) sub_domain = match.group(1).strip(".") top_domain = match.group(2) if not sub_domain: sub_domain = "@" address = None with gevent.Timeout(5, Exception("Timeout: 5s")): res = Http.get("https://api.dnschain.net/v1/namecoin/key/%s" % top_domain).read() data = json.loads(res)["data"]["value"] if "phantom" in data: for key, val in data["phantom"].iteritems(): self.dns_cache[key+"."+top_domain] = [val, time.time()+60*60*5] # Cache for 5 hours self.saveDnsCache() return data["phantom"].get(sub_domain) # Not found return address except Exception, err: log.debug("Dnschain.net %s resolve error: %s" % (domain, Debug.formatException(err)))
def resolveDomainDnschainNet(self, domain): try: match = self.isDomain(domain) sub_domain = match.group(1).strip(".") top_domain = match.group(2) if not sub_domain: sub_domain = "@" address = None with gevent.Timeout(5, Exception("Timeout: 5s")): res = Http.get("https://api.dnschain.net/v1/namecoin/key/%s" % top_domain).read() data = json.loads(res)["data"]["value"] if "zeronet" in data: for key, val in data["zeronet"].items(): self.dns_cache[key + "." + top_domain] = [ val, time.time() + 60 * 60 * 5 ] # Cache for 5 hours self.saveDnsCache() return data["zeronet"].get(sub_domain) # Not found return address except Exception as err: log.debug("Dnschain.net %s resolve error: %s" % (domain, Debug.formatException(err)))