From a62f375f5b64eaab27c53a5367db88aff6048069 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Fri, 21 Feb 2020 07:03:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3tcping=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 当IP地址存在反向解析结果(例 [xxx].members.linode.com),会连接反向域名的IP地址池,可能导致测速IPv4服务器时连接到IPv6地址并且失败。 --- v2rayN/v2rayN/Handler/SpeedtestHandler.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs b/v2rayN/v2rayN/Handler/SpeedtestHandler.cs index dad221e8..69bc5a9c 100644 --- a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs +++ b/v2rayN/v2rayN/Handler/SpeedtestHandler.cs @@ -253,8 +253,12 @@ namespace v2rayN.Handler try { - IPHostEntry ipHostInfo = System.Net.Dns.GetHostEntry(url); - IPAddress ipAddress = ipHostInfo.AddressList[0]; + IPAddress ipAddress; + if (!System.Net.IPAddress.TryParse(url, out ipAddress)) + { + IPHostEntry ipHostInfo = System.Net.Dns.GetHostEntry(url); + ipAddress = ipHostInfo.AddressList[0]; + } var timer = new Stopwatch(); timer.Start();