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