From 3dc9a7e7b38b2f496e210d16f4ae76a49d1cceb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=9B=BD=E4=BC=9F?= <366193849@qq.com> Date: Fri, 25 Jun 2021 15:39:30 +0800 Subject: [PATCH] =?UTF-8?q?FindBestAddress=E7=9F=AD=E8=B7=AF=E6=9F=A5?= =?UTF-8?q?=E6=89=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.Scanner/GithubScanResults.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/FastGithub.Scanner/GithubScanResults.cs b/FastGithub.Scanner/GithubScanResults.cs index f274003..32f7771 100644 --- a/FastGithub.Scanner/GithubScanResults.cs +++ b/FastGithub.Scanner/GithubScanResults.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; using System.Collections.Generic; using System.Linq; using System.Net; @@ -13,6 +14,12 @@ namespace FastGithub.Scanner { private readonly object syncRoot = new(); private readonly List contexts = new(); + private readonly IOptionsMonitor options; + + public GithubScanResults(IOptionsMonitor options) + { + this.options = options; + } /// /// 添加GithubContext @@ -51,6 +58,11 @@ namespace FastGithub.Scanner /// public IPAddress? FindBestAddress(string domain) { + if (this.options.CurrentValue.Domains.Contains(domain) == false) + { + return default; + } + lock (this.syncRoot) { return this.contexts