diff --git a/FastGithub.Dns/DnsInterceptor.cs b/FastGithub.Dns/DnsInterceptor.cs index e9ae3fb..f812ced 100644 --- a/FastGithub.Dns/DnsInterceptor.cs +++ b/FastGithub.Dns/DnsInterceptor.cs @@ -2,6 +2,7 @@ using DNS.Protocol.ResourceRecords; using FastGithub.Configuration; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using System; using System.Buffers.Binary; using System.Linq; @@ -29,18 +30,21 @@ namespace FastGithub.Dns /// [DllImport("dnsapi.dll", EntryPoint = "DnsFlushResolverCache", SetLastError = true)] private static extern void DnsFlushResolverCache(); - /// - /// dns投毒后台服务 + /// dns拦截器 /// /// /// + /// public DnsInterceptor( FastGithubConfig fastGithubConfig, - ILogger logger) + ILogger logger, + IOptionsMonitor options) { this.fastGithubConfig = fastGithubConfig; this.logger = logger; + + options.OnChange(_ => DnsFlushResolverCache()); } ///