Browse Source

修正tcping逻辑

* 当IP地址存在反向解析结果(例 [xxx].members.linode.com),会连接反向域名的IP地址池,可能导致测速IPv4服务器时连接到IPv6地址并且失败。
pull/453/head
YFdyh000 5 years ago
parent
commit
a62f375f5b
  1. 8
      v2rayN/v2rayN/Handler/SpeedtestHandler.cs

8
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();

Loading…
Cancel
Save