def https_resolve(qname, qtype, queobj): queobjt = Queue.Queue() for _ in range(https_resolve_threads): thread.start_new_thread(_https_resolve, (qname, qtype, queobjt)) for _ in range(https_resolve_threads): iplist = queobjt.get() if iplist: break queobj.put(iplist)
def https_resolve(qname, qtype, queobj): if dnshostalias not in dns: dns.set(dnshostalias, GC.IPLIST_MAP[GC.DNS_OVER_HTTPS_LIST], 24 * 3600) queobjt = Queue.Queue() for _ in range(https_resolve_threads): thread.start_new_thread(_https_resolve, (qname, qtype, queobjt)) for _ in range(https_resolve_threads): iplist = queobjt.get() if iplist: break queobj.put(iplist)
def _dns_over_https_resolve(qname): n = 0 xips = [] iplist = classlist() queobj = Queue.Queue() if '4' in GC.LINK_PROFILE: thread.start_new_thread(https_resolve, (qname, A, queobj)) n += 1 if '6' in GC.LINK_PROFILE: thread.start_new_thread(https_resolve, (qname, AAAA, queobj)) n += 1 for _ in range(n): result = queobj.get() if hasattr(result, 'xip'): xips.append(result.xip[0]) iplist += result if xips: iplist.xip = '|'.join(xips), None return iplist