From 844ab4d24a78d866073de30f6f7788026ddcdb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=9B=BD=E4=BC=9F?= <366193849@qq.com> Date: Wed, 17 Nov 2021 10:06:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.DomainResolve/DomainResolver.cs | 3 ++- FastGithub.DomainResolve/IPAddressElapsedCollection.cs | 2 +- FastGithub.PacketIntercept/Dns/DnsInterceptor.cs | 6 +++++- FastGithub/appsettings.json | 3 +-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/FastGithub.DomainResolve/DomainResolver.cs b/FastGithub.DomainResolve/DomainResolver.cs index e205413..2c66b5b 100644 --- a/FastGithub.DomainResolve/DomainResolver.cs +++ b/FastGithub.DomainResolve/DomainResolver.cs @@ -56,7 +56,7 @@ namespace FastGithub.DomainResolve { if (this.dnsEndPointAddressElapseds.TryGetValue(endPoint, out var addressElapseds) && addressElapseds.IsEmpty == false) { - this.logger.LogInformation($"{endPoint.Host}: {addressElapseds}"); + this.logger.LogInformation($"{endPoint.Host}->{addressElapseds}"); foreach (var addressElapsed in addressElapseds) { yield return addressElapsed.Adddress; @@ -67,6 +67,7 @@ namespace FastGithub.DomainResolve this.dnsEndPointAddressElapseds.TryAdd(endPoint, IPAddressElapsedCollection.Empty); await foreach (var adddress in this.dnsClient.ResolveAsync(endPoint, cancellationToken)) { + this.logger.LogInformation($"{endPoint.Host}->{adddress}"); yield return adddress; } } diff --git a/FastGithub.DomainResolve/IPAddressElapsedCollection.cs b/FastGithub.DomainResolve/IPAddressElapsedCollection.cs index 09fcf04..f05295b 100644 --- a/FastGithub.DomainResolve/IPAddressElapsedCollection.cs +++ b/FastGithub.DomainResolve/IPAddressElapsedCollection.cs @@ -79,7 +79,7 @@ namespace FastGithub.DomainResolve public override string ToString() { - return $"[{string.Join(',', this.addressElapseds.Select(item => item.Adddress))}]"; + return $"[{string.Join(", ", this.addressElapseds.Select(item => item.Adddress))}]"; } } } diff --git a/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs b/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs index dda6a2c..a16d4d9 100644 --- a/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs +++ b/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs @@ -146,6 +146,11 @@ namespace FastGithub.PacketIntercept.Dns { var record = new IPAddressResourceRecord(domain, IPAddress.Loopback, this.ttl); response.AnswerRecords.Add(record); + this.logger.LogInformation($"{domain}->{IPAddress.Loopback}"); + } + else + { + this.logger.LogInformation($"{domain}->NULL"); } var responsePayload = response.ToArray(); @@ -182,7 +187,6 @@ namespace FastGithub.PacketIntercept.Dns : WinDivertDirection.Inbound; WinDivert.WinDivertHelperCalcChecksums(winDivertBuffer, packetLength, ref winDivertAddress, WinDivertChecksumHelperParam.All); - this.logger.LogInformation($"已拦截向dns://{destAddress}:{destPort}查询{domain}"); } diff --git a/FastGithub/appsettings.json b/FastGithub/appsettings.json index 8aef856..09711b5 100644 --- a/FastGithub/appsettings.json +++ b/FastGithub/appsettings.json @@ -4,8 +4,7 @@ "HttpProxyPort": 38457, // http代理端口,linux/osx平台使用 "FallbackDns": [ // 以下dns必须要支持tcp "114.114.114.114:53", - "119.29.29.29:53", - "208.67.222.222:53" + "119.29.29.29:53" ], "DomainConfigs": { "*.fastgithub.com": { // 域名的*表示除.之外0到多个任意字符