Beispiel #1
0
 def set_dns(self):
     action, target = get_action('https', self.host, self.path, self.url)
     if target and action in ('do_DIRECT', 'do_FORWARD'):
         iporname, profile = target
     else:
         iporname, profile = None, None
     if iporname is None and self.host not in dns:
         logging.warning('无法找到 DoH 域名 %r 的自定义 IP 列表,尝试使用系统 DNS 设置解析。',
                         self.host)
         dns[self.host] = dns_system_resolve(self.host)
     self.hostname = set_dns(self.host, iporname)
     if self.hostname is None:
         logging.error('无法解析 DoH 域名:' + self.host)
Beispiel #2
0
 def set_server(self, host, port, path):
     self.host = host
     self.port = port
     self.path = '%s?%s' % (path, self.query)
     self.url = 'https://%s%s' % (host, self.path)
     self.headers = {'Accept': 'application/dns-json'}
     action, target = get_action('https', host, path, self.url)
     if target and action in ('do_DIRECT', 'do_FORWARD'):
         iporname, profile = target
     else:
         iporname, profile = None, None
     if iporname is None and host not in dns:
         logging.warning('无法找到 DoH 域名 %r 的自定义 IP 列表,尝试使用系统 DNS 设置解析。', host)
         dns[host] = dns_system_resolve(host)
     self.hostname = set_dns(host, iporname)
     if self.hostname is None:
         logging.error('无法解析 DoH 域名:' + host)