修正tcping逻辑

* 当IP地址存在反向解析结果(例 [xxx].members.linode.com),会连接反向域名的IP地址池,可能导致测速IPv4服务器时连接到IPv6地址并且失败。
pull/453/head
YFdyh000 2020-02-21 07:03:38 +08:00
parent 7cf6ab4b51
commit a62f375f5b
1 changed files with 6 additions and 2 deletions

View File

@ -253,8 +253,12 @@ namespace v2rayN.Handler
try try
{ {
IPHostEntry ipHostInfo = System.Net.Dns.GetHostEntry(url); IPAddress ipAddress;
IPAddress ipAddress = ipHostInfo.AddressList[0]; if (!System.Net.IPAddress.TryParse(url, out ipAddress))
{
IPHostEntry ipHostInfo = System.Net.Dns.GetHostEntry(url);
ipAddress = ipHostInfo.AddressList[0];
}
var timer = new Stopwatch(); var timer = new Stopwatch();
timer.Start(); timer.Start();