拆分配置文件

This commit is contained in:
陈国伟 2021-06-24 14:39:00 +08:00
parent f45b880232
commit b1f3a79122
12 changed files with 92 additions and 74 deletions

View File

@ -5,7 +5,7 @@ namespace FastGithub.Scanner
/// <summary>
/// 域名
/// </summary>
[Options("Github:Lookup")]
[Options("Lookup")]
sealed class GithubLookupFactoryOptions
{
/// <summary>

View File

@ -5,7 +5,7 @@ namespace FastGithub.Scanner
/// <summary>
/// 扫描选项
/// </summary>
[Options("Github:Scan")]
[Options("Scan")]
sealed class GithubScanOptions
{
/// <summary>

View File

@ -5,7 +5,7 @@ namespace FastGithub.Scanner.LookupProviders
/// <summary>
/// Github公开的域名与ip关系提供者选项
/// </summary>
[Options("Github:Lookup:GithubMetaProvider")]
[Options("Lookup:GithubMetaProvider")]
sealed class GithubMetaProviderOptions
{
/// <summary>

View File

@ -3,7 +3,7 @@
/// <summary>
/// ipaddress.com的域名与ip关系提供者选项
/// </summary>
[Options("Github:Lookup:IPAddressComProvider")]
[Options("Lookup:IPAddressComProvider")]
sealed class IPAddressComProviderOptions
{
/// <summary>

View File

@ -5,7 +5,7 @@ namespace FastGithub.Scanner.LookupProviders
/// <summary>
/// 公共dns的域名与ip关系提供者选项
/// </summary>
[Options("Github:Lookup:PublicDnsProvider")]
[Options("Lookup:PublicDnsProvider")]
sealed class PublicDnsProviderOptions
{
/// <summary>

View File

@ -6,7 +6,7 @@ namespace FastGithub.Scanner.ScanMiddlewares
/// <summary>
/// https扫描选项
/// </summary>
[Options("Github:Scan:HttpsScan")]
[Options("Scan:HttpsScan")]
sealed class HttpsScanOptions
{
/// <summary>

View File

@ -5,7 +5,7 @@ namespace FastGithub.Scanner.ScanMiddlewares
/// <summary>
/// tcp扫描选项
/// </summary>
[Options("Github:Scan:TcpScan")]
[Options("Scan:TcpScan")]
sealed class TcpScanOptions
{
/// <summary>

View File

@ -23,6 +23,9 @@
</ItemGroup>
<ItemGroup>
<None Update="appsettings.github.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View File

@ -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();

View File

@ -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 // 卸载并删除服务

View File

@ -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"
}
}
}
}
}

View File

@ -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, // githubip
"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, // githubip
"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": {