降低log等级
This commit is contained in:
parent
c9a2ea3dda
commit
3cbe2ff347
@ -119,18 +119,18 @@ namespace FastGithub.DomainResolve
|
|||||||
this.dnsCache.Set(key, result.Addresses, result.TimeToLive);
|
this.dnsCache.Set(key, result.Addresses, result.TimeToLive);
|
||||||
|
|
||||||
var items = string.Join(", ", result.Addresses.Select(item => item.ToString()));
|
var items = string.Join(", ", result.Addresses.Select(item => item.ToString()));
|
||||||
this.logger.LogInformation($"dns://{dns}:{endPoint}->[{items}]");
|
this.logger.LogInformation($"dns://{dns}:{endPoint.Host}->[{items}]");
|
||||||
|
|
||||||
return result.Addresses;
|
return result.Addresses;
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
this.logger.LogInformation($"dns://{dns}无法解析{endPoint}:请求超时");
|
this.logger.LogInformation($"dns://{dns}无法解析{endPoint.Host}:请求超时");
|
||||||
return Array.Empty<IPAddress>();
|
return Array.Empty<IPAddress>();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.logger.LogWarning($"dns://{dns}无法解析{endPoint}:{ex.Message}");
|
this.logger.LogInformation($"dns://{dns}无法解析{endPoint.Host}:{ex.Message}");
|
||||||
return Array.Empty<IPAddress>();
|
return Array.Empty<IPAddress>();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@ -19,7 +19,7 @@ namespace FastGithub.HttpServer
|
|||||||
private const int HTTP_PORT = 80;
|
private const int HTTP_PORT = 80;
|
||||||
private const int HTTPS_PORT = 443;
|
private const int HTTPS_PORT = 443;
|
||||||
|
|
||||||
private static readonly DomainConfig sniDomainConfig = new() { TlsSni = true };
|
private static readonly DomainConfig defaultDomainConfig = new() { TlsSni = true };
|
||||||
|
|
||||||
private readonly IHttpForwarder httpForwarder;
|
private readonly IHttpForwarder httpForwarder;
|
||||||
private readonly IHttpClientFactory httpClientFactory;
|
private readonly IHttpClientFactory httpClientFactory;
|
||||||
@ -95,7 +95,8 @@ namespace FastGithub.HttpServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 未配置的域名,但dns污染解析为127.0.0.1的域名
|
// 未配置的域名,但dns污染解析为127.0.0.1的域名
|
||||||
domainConfig = sniDomainConfig;
|
this.logger.LogWarning($"检测到{host.Host}可能遭遇了dns污染");
|
||||||
|
domainConfig = defaultDomainConfig;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user