diff --git a/FastGithub.Scanner/GithubLookupFactoryOptions.cs b/FastGithub.Scanner/GithubLookupFactoryOptions.cs
index dca3ec6..3b70056 100644
--- a/FastGithub.Scanner/GithubLookupFactoryOptions.cs
+++ b/FastGithub.Scanner/GithubLookupFactoryOptions.cs
@@ -5,7 +5,7 @@ namespace FastGithub.Scanner
///
/// 域名
///
- [Options("Github:Lookup")]
+ [Options("Lookup")]
sealed class GithubLookupFactoryOptions
{
///
diff --git a/FastGithub.Scanner/GithubScanOptions.cs b/FastGithub.Scanner/GithubScanOptions.cs
index 6d1b284..dc673f4 100644
--- a/FastGithub.Scanner/GithubScanOptions.cs
+++ b/FastGithub.Scanner/GithubScanOptions.cs
@@ -5,7 +5,7 @@ namespace FastGithub.Scanner
///
/// 扫描选项
///
- [Options("Github:Scan")]
+ [Options("Scan")]
sealed class GithubScanOptions
{
///
diff --git a/FastGithub.Scanner/LookupProviders/GithubMetaProviderOptions.cs b/FastGithub.Scanner/LookupProviders/GithubMetaProviderOptions.cs
index 9539134..d5385ea 100644
--- a/FastGithub.Scanner/LookupProviders/GithubMetaProviderOptions.cs
+++ b/FastGithub.Scanner/LookupProviders/GithubMetaProviderOptions.cs
@@ -5,7 +5,7 @@ namespace FastGithub.Scanner.LookupProviders
///
/// Github公开的域名与ip关系提供者选项
///
- [Options("Github:Lookup:GithubMetaProvider")]
+ [Options("Lookup:GithubMetaProvider")]
sealed class GithubMetaProviderOptions
{
///
diff --git a/FastGithub.Scanner/LookupProviders/IPAddressComProviderOptions.cs b/FastGithub.Scanner/LookupProviders/IPAddressComProviderOptions.cs
index 1985cc6..177370d 100644
--- a/FastGithub.Scanner/LookupProviders/IPAddressComProviderOptions.cs
+++ b/FastGithub.Scanner/LookupProviders/IPAddressComProviderOptions.cs
@@ -3,7 +3,7 @@
///
/// ipaddress.com的域名与ip关系提供者选项
///
- [Options("Github:Lookup:IPAddressComProvider")]
+ [Options("Lookup:IPAddressComProvider")]
sealed class IPAddressComProviderOptions
{
///
diff --git a/FastGithub.Scanner/LookupProviders/PublicDnsProviderOptions.cs b/FastGithub.Scanner/LookupProviders/PublicDnsProviderOptions.cs
index e707c1c..ab81a7a 100644
--- a/FastGithub.Scanner/LookupProviders/PublicDnsProviderOptions.cs
+++ b/FastGithub.Scanner/LookupProviders/PublicDnsProviderOptions.cs
@@ -5,7 +5,7 @@ namespace FastGithub.Scanner.LookupProviders
///
/// 公共dns的域名与ip关系提供者选项
///
- [Options("Github:Lookup:PublicDnsProvider")]
+ [Options("Lookup:PublicDnsProvider")]
sealed class PublicDnsProviderOptions
{
///
diff --git a/FastGithub.Scanner/ScanMiddlewares/HttpsScanOptions.cs b/FastGithub.Scanner/ScanMiddlewares/HttpsScanOptions.cs
index f5af2b6..d5f67b2 100644
--- a/FastGithub.Scanner/ScanMiddlewares/HttpsScanOptions.cs
+++ b/FastGithub.Scanner/ScanMiddlewares/HttpsScanOptions.cs
@@ -6,7 +6,7 @@ namespace FastGithub.Scanner.ScanMiddlewares
///
/// https扫描选项
///
- [Options("Github:Scan:HttpsScan")]
+ [Options("Scan:HttpsScan")]
sealed class HttpsScanOptions
{
///
diff --git a/FastGithub.Scanner/ScanMiddlewares/TcpScanOptions.cs b/FastGithub.Scanner/ScanMiddlewares/TcpScanOptions.cs
index bb26fd5..e63dbaf 100644
--- a/FastGithub.Scanner/ScanMiddlewares/TcpScanOptions.cs
+++ b/FastGithub.Scanner/ScanMiddlewares/TcpScanOptions.cs
@@ -5,7 +5,7 @@ namespace FastGithub.Scanner.ScanMiddlewares
///
/// tcp扫描选项
///
- [Options("Github:Scan:TcpScan")]
+ [Options("Scan:TcpScan")]
sealed class TcpScanOptions
{
///
diff --git a/FastGithub/FastGithub.csproj b/FastGithub/FastGithub.csproj
index 781c80a..7367b53 100644
--- a/FastGithub/FastGithub.csproj
+++ b/FastGithub/FastGithub.csproj
@@ -23,6 +23,9 @@
+
+ PreserveNewest
+
PreserveNewest
diff --git a/FastGithub/Program.cs b/FastGithub/Program.cs
index bfd09cc..7f64ae8 100644
--- a/FastGithub/Program.cs
+++ b/FastGithub/Program.cs
@@ -1,4 +1,6 @@
-using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Hosting;
+using System.IO;
namespace FastGithub
{
@@ -24,6 +26,13 @@ namespace FastGithub
.CreateDefaultBuilder(args)
.UseWindowsService()
.UseBinaryPathContentRoot()
+ .ConfigureAppConfiguration(c =>
+ {
+ foreach (var jsonFile in Directory.GetFiles(".", "appsettings.*.json"))
+ {
+ c.AddJsonFile(jsonFile, optional: true);
+ }
+ })
.ConfigureServices((ctx, services) =>
{
services.AddAppUpgrade();
diff --git a/FastGithub/README.MD b/FastGithub/README.MD
index 8569b24..a269691 100644
--- a/FastGithub/README.MD
+++ b/FastGithub/README.MD
@@ -12,4 +12,4 @@ github定制版的dns服务,解析github最优的ip
### 以windows服务运行
以管理员身份运行cmd,键入如下命令,其中D:\Softs为软件实际目录
* D:\Softs\FastGithub.exe start // 安装并启动服务
-* D:\Softs\FastGithub.exe stop // 卸载并删除服务
+* D:\Softs\FastGithub.exe stop // 卸载并删除服务
\ No newline at end of file
diff --git a/FastGithub/appsettings.github.json b/FastGithub/appsettings.github.json
new file mode 100644
index 0000000..b3c21c9
--- /dev/null
+++ b/FastGithub/appsettings.github.json
@@ -0,0 +1,39 @@
+{
+ "Lookup": { // ip
+ "Domains": [ // ҵgithubҪ
+ "github.com",
+ "api.github.com",
+ "collector.githubapp.com",
+ "github.githubassets.com",
+ "raw.githubusercontent.com",
+ "avatars.githubusercontent.com",
+ "favicons.githubusercontent.com"
+ ]
+ },
+ "Scan": {
+ "HttpsScan": {
+ "Rules": { // ɨȱʧĬHEADĸ·
+ "github.com": {
+ "Method": "HEAD",
+ "Path": "/xljiulang/FastGithub"
+ },
+ "github.githubassets.com": {
+ "Method": "HEAD",
+ "Path": "/favicons/favicon.png"
+ },
+ "raw.githubusercontent.com": {
+ "Method": "HEAD",
+ "Path": "/xljiulang/FastGithub/master/README.md"
+ },
+ "avatars.githubusercontent.com": {
+ "Method": "HEAD",
+ "Path": "/u/8308014?s=40&v=4"
+ },
+ "favicons.githubusercontent.com": {
+ "Method": "HEAD",
+ "Path": "/github.com"
+ }
+ }
+ }
+ }
+}
diff --git a/FastGithub/appsettings.json b/FastGithub/appsettings.json
index e18d86f..ee92ffe 100644
--- a/FastGithub/appsettings.json
+++ b/FastGithub/appsettings.json
@@ -4,72 +4,39 @@
"GithubTTL": "00:10:00", // githubĴʱ
"SetToLocalMachine": true // Ƿñʹôdns(֧windows)
},
- "Github": {
- "Lookup": { // ip
- "Domains": [ // ҵgithubҪ
- "github.com",
- "api.github.com",
- "collector.githubapp.com",
- "github.githubassets.com",
- "raw.githubusercontent.com",
- "avatars.githubusercontent.com",
- "favicons.githubusercontent.com"
- ],
- "IPAddressComProvider": {
- "Enable": true // Ǵôaddress.comip
- },
- "GithubMetaProvider": {
- "Enable": true, // Ƿgithubȡipб
- "MetaUri": "https://gitee.com/jiulang/fast-github/raw/master/FastGithub/meta.json"
- },
- "PublicDnsProvider": {
- "Enable": true, // ǷҪdnsip
- "Timeout": "00:00:00.100", // dnsѯʱʱ
- "Dnss": [ // dnsб
- "1.2.4.8",
- "8.8.8.8",
- "223.5.5.5",
- "123.125.81.6",
- "180.76.76.76",
- "119.29.29.29",
- "208.67.220.220",
- "114.114.114.114"
- ]
- }
+ "Lookup": { // ip
+ "IPAddressComProvider": {
+ "Enable": true // Ǵôaddress.comip
},
- "Scan": {
- "FullScanInterval": "02:00:00", // ɨʱ
- "ResultScanInterval": "00:01:00", // ɨʱ
- "TcpScan": {
- "Timeout": "00:00:01", // tcpɨ賬ʱʱ
- "CacheExpiration": "00:30:00" // ɨʱ
- },
- "HttpsScan": {
- "Timeout": "00:00:05", // httpsɨ賬ʱʱ
- "ConnectionClose": false, // Ƿʹhttps
- "Rules": { // ɨȱʧĬHEADĸ·
- "github.com": {
- "Method": "HEAD",
- "Path": "/xljiulang/FastGithub"
- },
- "github.githubassets.com": {
- "Method": "HEAD",
- "Path": "/favicons/favicon.png"
- },
- "raw.githubusercontent.com": {
- "Method": "HEAD",
- "Path": "/xljiulang/FastGithub/master/README.md"
- },
- "avatars.githubusercontent.com": {
- "Method": "HEAD",
- "Path": "/u/8308014?s=40&v=4"
- },
- "favicons.githubusercontent.com": {
- "Method": "HEAD",
- "Path": "/github.com"
- }
- }
- }
+ "GithubMetaProvider": {
+ "Enable": true, // Ƿgithubȡipб
+ "MetaUri": "https://gitee.com/jiulang/fast-github/raw/master/FastGithub/meta.json"
+ },
+ "PublicDnsProvider": {
+ "Enable": true, // ǷҪdnsip
+ "Timeout": "00:00:00.100", // dnsѯʱʱ
+ "Dnss": [ // dnsб
+ "1.2.4.8",
+ "8.8.8.8",
+ "223.5.5.5",
+ "123.125.81.6",
+ "180.76.76.76",
+ "119.29.29.29",
+ "208.67.220.220",
+ "114.114.114.114"
+ ]
+ }
+ },
+ "Scan": {
+ "FullScanInterval": "02:00:00", // ɨʱ
+ "ResultScanInterval": "00:01:00", // ɨʱ
+ "TcpScan": {
+ "Timeout": "00:00:01", // tcpɨ賬ʱʱ
+ "CacheExpiration": "00:30:00" // ɨʱ
+ },
+ "HttpsScan": {
+ "Timeout": "00:00:05", // httpsɨ賬ʱʱ
+ "ConnectionClose": false // Ƿʹhttps
}
},
"Logging": {