diff --git a/Netch/Utils/DnsUtils.cs b/Netch/Utils/DnsUtils.cs index 5664da91..5f67400f 100644 --- a/Netch/Utils/DnsUtils.cs +++ b/Netch/Utils/DnsUtils.cs @@ -13,12 +13,7 @@ namespace Netch.Utils /// private static readonly Hashtable Cache = new(); - /// - /// 查询 - /// - /// 主机名 - /// - public static IPAddress? Lookup(string hostname) + public static IPAddress? Lookup(string hostname, int timeout = 3000) { try { @@ -26,7 +21,7 @@ namespace Netch.Utils return Cache[hostname] as IPAddress; var task = Dns.GetHostAddressesAsync(hostname); - if (!task.Wait(1000)) + if (!task.Wait(timeout)) return null; if (task.Result.Length == 0)