From c066e153be4349bd54832d187d2bb8e82cdcfc7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E4=B9=9D?= <366193849@qq.com> Date: Sun, 19 Sep 2021 13:55:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8F=98=E5=8C=96=E5=88=B7?= =?UTF-8?q?=E6=96=B0dns=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.Dns/DnsInterceptor.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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()); } ///