增加dns查询超时时长
This commit is contained in:
parent
0f7a384beb
commit
01b91b801c
@ -80,7 +80,10 @@ namespace FastGithub.Scanner.LookupProviders
|
||||
{
|
||||
try
|
||||
{
|
||||
var addresses = await client.Lookup(domain, cancellationToken: cancellationToken);
|
||||
using var timeoutTokenSource = new CancellationTokenSource(this.options.CurrentValue.Timeout);
|
||||
using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutTokenSource.Token, cancellationToken);
|
||||
|
||||
var addresses = await client.Lookup(domain, cancellationToken: linkedTokenSource.Token);
|
||||
foreach (var address in addresses)
|
||||
{
|
||||
if (address.AddressFamily == AddressFamily.InterNetwork)
|
||||
|
||||
@ -13,6 +13,11 @@ namespace FastGithub.Scanner.LookupProviders
|
||||
/// </summary>
|
||||
public bool Enable { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// dns查询超时时长
|
||||
/// </summary>
|
||||
public TimeSpan Timeout { get; set; } = TimeSpan.FromMilliseconds(100d);
|
||||
|
||||
/// <summary>
|
||||
/// dns列表
|
||||
/// </summary>
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
},
|
||||
"PublicDnsProvider": {
|
||||
"Enable": true, // 是否需要从dns服务器查找ip
|
||||
"Timeout": "00:00:00.100", // dns查询超时时长
|
||||
"Dnss": [ // dns服务器列表
|
||||
"1.2.4.8",
|
||||
"8.8.8.8",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user