From 52a26092391c5d9e2c4f67ee583afd4dcdd84724 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, 18 Jun 2021 15:50:10 +0800
Subject: [PATCH] =?UTF-8?q?Providers=E6=8E=92=E5=BA=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FastGithub.Scanner/DomainAddressFacotry.cs | 3 ++-
.../DomainAddressProviders/GithubMetaProvider.cs | 5 +++++
.../DomainAddressProviders/IPAddressComProvider.cs | 5 +++++
.../DomainAddressProviders/PublicDnsProvider.cs | 5 +++++
FastGithub.Scanner/IDomainAddressProvider.cs | 5 +++++
5 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/FastGithub.Scanner/DomainAddressFacotry.cs b/FastGithub.Scanner/DomainAddressFacotry.cs
index d82a691..cc16cc9 100644
--- a/FastGithub.Scanner/DomainAddressFacotry.cs
+++ b/FastGithub.Scanner/DomainAddressFacotry.cs
@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
namespace FastGithub.Scanner
@@ -18,7 +19,7 @@ namespace FastGithub.Scanner
///
public DomainAddressFacotry(IEnumerable providers)
{
- this.providers = providers;
+ this.providers = providers.OrderBy(item => item.Order);
}
///
diff --git a/FastGithub.Scanner/DomainAddressProviders/GithubMetaProvider.cs b/FastGithub.Scanner/DomainAddressProviders/GithubMetaProvider.cs
index 5b73f64..d7605bc 100644
--- a/FastGithub.Scanner/DomainAddressProviders/GithubMetaProvider.cs
+++ b/FastGithub.Scanner/DomainAddressProviders/GithubMetaProvider.cs
@@ -23,6 +23,11 @@ namespace FastGithub.Scanner.DomainAddressProviders
private readonly ILogger logger;
private const string META_URI = "https://api.github.com/meta";
+ ///
+ /// 获取排序
+ ///
+ public int Order => int.MaxValue;
+
///
/// Github公开的域名与ip关系提供者
///
diff --git a/FastGithub.Scanner/DomainAddressProviders/IPAddressComProvider.cs b/FastGithub.Scanner/DomainAddressProviders/IPAddressComProvider.cs
index e6bfc0e..0d530b8 100644
--- a/FastGithub.Scanner/DomainAddressProviders/IPAddressComProvider.cs
+++ b/FastGithub.Scanner/DomainAddressProviders/IPAddressComProvider.cs
@@ -22,6 +22,11 @@ namespace FastGithub.Scanner.DomainAddressProviders
private readonly ILogger logger;
private readonly Uri lookupUri = new("https://www.ipaddress.com/ip-lookup");
+ ///
+ /// 获取排序
+ ///
+ public int Order => default;
+
///
/// ipaddress.com的域名与ip关系提供者
///
diff --git a/FastGithub.Scanner/DomainAddressProviders/PublicDnsProvider.cs b/FastGithub.Scanner/DomainAddressProviders/PublicDnsProvider.cs
index e9417b9..b2ea8c6 100644
--- a/FastGithub.Scanner/DomainAddressProviders/PublicDnsProvider.cs
+++ b/FastGithub.Scanner/DomainAddressProviders/PublicDnsProvider.cs
@@ -19,6 +19,11 @@ namespace FastGithub.Scanner.DomainAddressProviders
private readonly IOptionsMonitor options;
private readonly ILogger logger;
+ ///
+ /// 获取排序
+ ///
+ public int Order => default;
+
///
/// 公共dns的域名与ip关系提供者
///
diff --git a/FastGithub.Scanner/IDomainAddressProvider.cs b/FastGithub.Scanner/IDomainAddressProvider.cs
index 1b06dc1..f08f707 100644
--- a/FastGithub.Scanner/IDomainAddressProvider.cs
+++ b/FastGithub.Scanner/IDomainAddressProvider.cs
@@ -8,6 +8,11 @@ namespace FastGithub.Scanner
///
interface IDomainAddressProvider
{
+ ///
+ /// 获取排序
+ ///
+ int Order { get; }
+
///
/// 创建域名与ip的关系
///