diff --git a/FastGithub.ReverseProxy/NoSniHttpClientHanlder.cs b/FastGithub.ReverseProxy/NoSniHttpClientHanlder.cs index fc23c62..6d2bf0d 100644 --- a/FastGithub.ReverseProxy/NoSniHttpClientHanlder.cs +++ b/FastGithub.ReverseProxy/NoSniHttpClientHanlder.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Extensions.Logging; +using System; using System.Net.Http; using System.Net.Security; using System.Net.Sockets; @@ -13,14 +14,18 @@ namespace FastGithub.ReverseProxy class NoSniHttpClientHanlder : DelegatingHandler { private readonly TrustedResolver trustedDomainResolver; + private readonly ILogger logger; /// /// 不发送NoSni的HttpClientHandler /// /// - public NoSniHttpClientHanlder(TrustedResolver trustedDomainResolver) + public NoSniHttpClientHanlder( + TrustedResolver trustedDomainResolver, + ILogger logger) { this.trustedDomainResolver = trustedDomainResolver; + this.logger = logger; this.InnerHandler = CreateNoneSniHttpHandler(); } @@ -69,6 +74,8 @@ namespace FastGithub.ReverseProxy if (uri != null && uri.HostNameType == UriHostNameType.Dns) { var address = await this.trustedDomainResolver.ResolveAsync(uri.Host, cancellationToken); + this.logger.LogInformation($"[{address}--NoSni->{uri.Host}]"); + var builder = new UriBuilder(uri) { Scheme = Uri.UriSchemeHttp, diff --git a/FastGithub.ReverseProxy/TrustedResolver.cs b/FastGithub.ReverseProxy/TrustedResolver.cs index 8bd57d5..d050e47 100644 --- a/FastGithub.ReverseProxy/TrustedResolver.cs +++ b/FastGithub.ReverseProxy/TrustedResolver.cs @@ -1,6 +1,5 @@ using DNS.Client; using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; using System.Linq; @@ -18,7 +17,6 @@ namespace FastGithub.ReverseProxy private readonly IMemoryCache memoryCache; private readonly TimeSpan cacheTimeSpan = TimeSpan.FromSeconds(10d); private readonly IOptionsMonitor options; - private readonly ILogger logger; /// /// 受信任的域名解析器 @@ -26,12 +24,10 @@ namespace FastGithub.ReverseProxy /// public TrustedResolver( IMemoryCache memoryCache, - IOptionsMonitor options, - ILogger logger) + IOptionsMonitor options) { this.memoryCache = memoryCache; this.options = options; - this.logger = logger; } /// @@ -48,8 +44,6 @@ namespace FastGithub.ReverseProxy e.SetAbsoluteExpiration(this.cacheTimeSpan); return this.LookupAsync(domain, cancellationToken); }); - - this.logger.LogInformation($"[{address}->{domain}]"); return address; } diff --git a/FastGithub/appsettings.json b/FastGithub/appsettings.json index 251f6fb..0cb14bb 100644 --- a/FastGithub/appsettings.json +++ b/FastGithub/appsettings.json @@ -10,11 +10,13 @@ }, "DomainMatches": [ // *ʾ0nַ "github.com", + "githubstatus.com", "*.github.com", "*.github.io", "*.githubapp.com", "*.githubassets.com", - "*.githubusercontent.com" + "*.githubusercontent.com", + "*github*.s3.amazonaws.com" ] }, "Logging": {