取消不必要的预加载
This commit is contained in:
parent
d3f5a46753
commit
3f01444f2d
@ -25,18 +25,7 @@ namespace FastGithub.DomainResolve
|
||||
public DomainResolver(DnsClient dnsClient)
|
||||
{
|
||||
this.dnsClient = dnsClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 预加载
|
||||
/// </summary>
|
||||
/// <param name="domain">域名</param>
|
||||
public void Prefetch(string domain)
|
||||
{
|
||||
const int HTTPS_PORT = 443;
|
||||
var dnsEndPoint = new DnsEndPoint(domain, HTTPS_PORT);
|
||||
this.dnsEndPointAddressElapseds.TryAdd(dnsEndPoint, IPAddressElapsedCollection.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析ip
|
||||
|
||||
@ -10,12 +10,6 @@ namespace FastGithub.DomainResolve
|
||||
/// </summary>
|
||||
public interface IDomainResolver
|
||||
{
|
||||
/// <summary>
|
||||
/// 预加载
|
||||
/// </summary>
|
||||
/// <param name="domain">域名</param>
|
||||
void Prefetch(string domain);
|
||||
|
||||
/// <summary>
|
||||
/// 解析ip
|
||||
/// </summary>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
using DNS.Protocol;
|
||||
using DNS.Protocol.ResourceRecords;
|
||||
using FastGithub.Configuration;
|
||||
using FastGithub.DomainResolve;
|
||||
using FastGithub.WinDiverts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
@ -26,7 +25,6 @@ namespace FastGithub.PacketIntercept.Dns
|
||||
private const string DNS_FILTER = "udp.DstPort == 53";
|
||||
|
||||
private readonly FastGithubConfig fastGithubConfig;
|
||||
private readonly IDomainResolver domainResolver;
|
||||
private readonly ILogger<DnsInterceptor> logger;
|
||||
|
||||
private readonly TimeSpan ttl = TimeSpan.FromMinutes(10d);
|
||||
@ -41,18 +39,16 @@ namespace FastGithub.PacketIntercept.Dns
|
||||
/// dns拦截器
|
||||
/// </summary>
|
||||
/// <param name="fastGithubConfig"></param>
|
||||
/// <param name="domainResolver"></param>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="options"></param>
|
||||
public DnsInterceptor(
|
||||
FastGithubConfig fastGithubConfig,
|
||||
IDomainResolver domainResolver,
|
||||
ILogger<DnsInterceptor> logger,
|
||||
IOptionsMonitor<FastGithubOptions> options)
|
||||
{
|
||||
this.fastGithubConfig = fastGithubConfig;
|
||||
this.logger = logger;
|
||||
this.domainResolver = domainResolver;
|
||||
|
||||
options.OnChange(_ => DnsFlushResolverCache());
|
||||
}
|
||||
|
||||
@ -135,9 +131,6 @@ namespace FastGithub.PacketIntercept.Dns
|
||||
return;
|
||||
}
|
||||
|
||||
// dns预加载
|
||||
this.domainResolver.Prefetch(domain.ToString());
|
||||
|
||||
// dns响应数据
|
||||
var response = Response.FromRequest(request);
|
||||
var record = new IPAddressResourceRecord(domain, IPAddress.Loopback, this.ttl);
|
||||
|
||||
@ -14,6 +14,5 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FastGithub.Configuration\FastGithub.Configuration.csproj" />
|
||||
<ProjectReference Include="..\FastGithub.DomainResolve\FastGithub.DomainResolve.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user