diff --git a/FastGithub.DomainResolve/DnsClient.cs b/FastGithub.DomainResolve/DnsClient.cs index 9bc6290..589294f 100644 --- a/FastGithub.DomainResolve/DnsClient.cs +++ b/FastGithub.DomainResolve/DnsClient.cs @@ -119,18 +119,18 @@ namespace FastGithub.DomainResolve this.dnsCache.Set(key, result.Addresses, result.TimeToLive); 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; } catch (OperationCanceledException) { - this.logger.LogInformation($"dns://{dns}无法解析{endPoint}:请求超时"); + this.logger.LogInformation($"dns://{dns}无法解析{endPoint.Host}:请求超时"); return Array.Empty(); } catch (Exception ex) { - this.logger.LogWarning($"dns://{dns}无法解析{endPoint}:{ex.Message}"); + this.logger.LogInformation($"dns://{dns}无法解析{endPoint.Host}:{ex.Message}"); return Array.Empty(); } finally diff --git a/FastGithub.HttpServer/HttpReverseProxyMiddleware.cs b/FastGithub.HttpServer/HttpReverseProxyMiddleware.cs index a1d03f0..854315a 100644 --- a/FastGithub.HttpServer/HttpReverseProxyMiddleware.cs +++ b/FastGithub.HttpServer/HttpReverseProxyMiddleware.cs @@ -19,7 +19,7 @@ namespace FastGithub.HttpServer private const int HTTP_PORT = 80; 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 IHttpClientFactory httpClientFactory; @@ -95,7 +95,8 @@ namespace FastGithub.HttpServer } // 未配置的域名,但dns污染解析为127.0.0.1的域名 - domainConfig = sniDomainConfig; + this.logger.LogWarning($"检测到{host.Host}可能遭遇了dns污染"); + domainConfig = defaultDomainConfig; return true; }