日志格式

This commit is contained in:
陈国伟 2021-11-17 10:06:13 +08:00
parent 7d7b67948b
commit 844ab4d24a
4 changed files with 9 additions and 5 deletions

View File

@ -56,7 +56,7 @@ namespace FastGithub.DomainResolve
{ {
if (this.dnsEndPointAddressElapseds.TryGetValue(endPoint, out var addressElapseds) && addressElapseds.IsEmpty == false) 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) foreach (var addressElapsed in addressElapseds)
{ {
yield return addressElapsed.Adddress; yield return addressElapsed.Adddress;
@ -67,6 +67,7 @@ namespace FastGithub.DomainResolve
this.dnsEndPointAddressElapseds.TryAdd(endPoint, IPAddressElapsedCollection.Empty); this.dnsEndPointAddressElapseds.TryAdd(endPoint, IPAddressElapsedCollection.Empty);
await foreach (var adddress in this.dnsClient.ResolveAsync(endPoint, cancellationToken)) await foreach (var adddress in this.dnsClient.ResolveAsync(endPoint, cancellationToken))
{ {
this.logger.LogInformation($"{endPoint.Host}->{adddress}");
yield return adddress; yield return adddress;
} }
} }

View File

@ -79,7 +79,7 @@ namespace FastGithub.DomainResolve
public override string ToString() public override string ToString()
{ {
return $"[{string.Join(',', this.addressElapseds.Select(item => item.Adddress))}]"; return $"[{string.Join(", ", this.addressElapseds.Select(item => item.Adddress))}]";
} }
} }
} }

View File

@ -146,6 +146,11 @@ namespace FastGithub.PacketIntercept.Dns
{ {
var record = new IPAddressResourceRecord(domain, IPAddress.Loopback, this.ttl); var record = new IPAddressResourceRecord(domain, IPAddress.Loopback, this.ttl);
response.AnswerRecords.Add(record); response.AnswerRecords.Add(record);
this.logger.LogInformation($"{domain}->{IPAddress.Loopback}");
}
else
{
this.logger.LogInformation($"{domain}->NULL");
} }
var responsePayload = response.ToArray(); var responsePayload = response.ToArray();
@ -182,7 +187,6 @@ namespace FastGithub.PacketIntercept.Dns
: WinDivertDirection.Inbound; : WinDivertDirection.Inbound;
WinDivert.WinDivertHelperCalcChecksums(winDivertBuffer, packetLength, ref winDivertAddress, WinDivertChecksumHelperParam.All); WinDivert.WinDivertHelperCalcChecksums(winDivertBuffer, packetLength, ref winDivertAddress, WinDivertChecksumHelperParam.All);
this.logger.LogInformation($"已拦截向dns://{destAddress}:{destPort}查询{domain}");
} }

View File

@ -4,8 +4,7 @@
"HttpProxyPort": 38457, // httplinux/osx使 "HttpProxyPort": 38457, // httplinux/osx使
"FallbackDns": [ // dnstcp "FallbackDns": [ // dnstcp
"114.114.114.114:53", "114.114.114.114:53",
"119.29.29.29:53", "119.29.29.29:53"
"208.67.222.222:53"
], ],
"DomainConfigs": { "DomainConfigs": {
"*.fastgithub.com": { // *.0 "*.fastgithub.com": { // *.0