Skip to content

Commit 43aec6f

Browse files
committed
5.16.6 fix minor bugs #14127
1 parent 56abb31 commit 43aec6f

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

code/default/lib/noarch/front_base/ip_manager.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,7 @@ def get_ip_sni_host(self, to_recheck=False):
549549
self.ip_pointer += 1
550550
continue
551551

552-
handshake_time = self.ip_dict[ip_str]["handshake_time"]
553-
# self.logger.debug("get ip:%s t:%d", ip, handshake_time)
552+
# self.logger.debug("get ip:%s t:%d", ip, self.ip_dict[ip_str]["handshake_time"])
554553
self.append_ip_history(ip_str, "get")
555554
self.ip_dict[ip_str]['get_time'] = time_now
556555
if not to_recheck:
@@ -568,7 +567,7 @@ def get_ip_sni_host(self, to_recheck=False):
568567
finally:
569568
self.ip_lock.release()
570569

571-
return None, None, None
570+
return None
572571

573572
def add_ip(self, ip_str, handshake_time=100, domain=None, server='gws', fail_times=0, down_fail=0,
574573
scan_result=True):

code/default/smart_router/local/dns_query.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,17 +461,35 @@ def query(self, domain, dns_type=1):
461461

462462

463463
class DnsOverTlsQuery(DnsOverTcpQuery):
464-
def __init__(self, server_list=[b"1.1.1.1", b"9.9.9.9"]):
464+
def __init__(self, server_list=None):
465+
if not server_list:
466+
server_list = [
467+
{
468+
"domain": "one.one.one.one",
469+
"ipv4s": [b"1.1.1.1", b"1.0.0.1"],
470+
},
471+
{
472+
"domain": "dns.quad9.net",
473+
"ipv4s": [b"9.9.9.9", b"149.112.112.112"],
474+
}
475+
]
476+
465477
DnsOverTcpQuery.__init__(self, server_list=server_list, port=853)
466478
self.protocol = "DoT"
467479
self.ssl_context = ssl.create_default_context()
468480
self.ssl_context.check_hostname = False
469481
self.ssl_context.verify_mode = ssl.CERT_REQUIRED
470482

471483
def connect(self, host, port):
472-
s = super(DnsOverTlsQuery, self).connect(host, port)
473-
sock = self.ssl_context.wrap_socket(s, server_hostname=host)
474-
return sock
484+
domain = host["domain"]
485+
ipv4 = random.choice(host["ipv4s"])
486+
try:
487+
s = super(DnsOverTlsQuery, self).connect(ipv4, port)
488+
sock = self.ssl_context.wrap_socket(s, server_hostname=domain)
489+
return sock
490+
except Exception as e:
491+
xlog.warn("DnsOverTlsQuery connect %s %s:%d fail:%r", ipv4, domain, port, e)
492+
return None
475493

476494

477495
class DnsOverHttpsQuery(object):

code/default/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.16.5
1+
5.16.6

0 commit comments

Comments
 (0)