项目重命名
This commit is contained in:
parent
696c0f9dd8
commit
04f8d77aaf
@ -2,7 +2,7 @@
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
namespace FastGithub
|
||||
namespace FastGithub.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// dns配置
|
||||
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace FastGithub
|
||||
namespace FastGithub.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// 域名配置
|
||||
@ -47,11 +47,11 @@ namespace FastGithub
|
||||
{
|
||||
if (this.TlsSni == false)
|
||||
{
|
||||
return FastGithub.TlsSniPattern.None;
|
||||
return Configuration.TlsSniPattern.None;
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.TlsSniPattern))
|
||||
{
|
||||
return FastGithub.TlsSniPattern.Domain;
|
||||
return Configuration.TlsSniPattern.Domain;
|
||||
}
|
||||
return new TlsSniPattern(this.TlsSniPattern);
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace FastGithub
|
||||
namespace FastGithub.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// 表示域名表达式
|
||||
8
FastGithub.Configuration/FastGithub.Configuration.csproj
Normal file
8
FastGithub.Configuration/FastGithub.Configuration.csproj
Normal file
@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0-*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
||||
namespace FastGithub
|
||||
namespace FastGithub.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// FastGithub配置
|
||||
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace FastGithub
|
||||
namespace FastGithub.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// 表示FastGithub异常
|
||||
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FastGithub
|
||||
namespace FastGithub.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// FastGithub的配置
|
||||
@ -1,4 +1,4 @@
|
||||
namespace FastGithub
|
||||
namespace FastGithub.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// 响应配置
|
||||
24
FastGithub.Configuration/ServiceCollectionExtensions.cs
Normal file
24
FastGithub.Configuration/ServiceCollectionExtensions.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using FastGithub.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace FastGithub
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务注册扩展
|
||||
/// </summary>
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加配置服务
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
public static OptionsBuilder<FastGithubOptions> AddConfiguration(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddSingleton<FastGithubConfig>();
|
||||
return services.AddOptions<FastGithubOptions>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace FastGithub
|
||||
namespace FastGithub.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Sni自定义值表达式
|
||||
@ -1,12 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>FastGithub</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0-*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using FastGithub.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
|
||||
@ -10,6 +10,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FastGithub.Core\FastGithub.Core.csproj" />
|
||||
<ProjectReference Include="..\FastGithub.Configuration\FastGithub.Configuration.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using FastGithub.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using DNS.Client.RequestResolver;
|
||||
using DNS.Protocol;
|
||||
using DNS.Protocol.ResourceRecords;
|
||||
using FastGithub.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
using FastGithub.Dns;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace FastGithub
|
||||
{
|
||||
/// <summary>
|
||||
/// dns服务注册扩展
|
||||
/// 服务注册扩展
|
||||
/// </summary>
|
||||
public static class DnsServiceCollectionExtensions
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 注册dns服务
|
||||
@ -15,11 +16,10 @@ namespace FastGithub
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection AddDnsServer(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddSingleton<RequestResolver>()
|
||||
.AddSingleton<DnsServer>()
|
||||
.AddSingleton<HostsFileValidator>()
|
||||
.AddHostedService<DnsHostedService>();
|
||||
services.TryAddSingleton<RequestResolver>();
|
||||
services.TryAddSingleton<DnsServer>();
|
||||
services.TryAddSingleton<HostsFileValidator>();
|
||||
return services.AddHostedService<DnsHostedService>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using FastGithub.Configuration;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using DNS.Client;
|
||||
using DNS.Protocol;
|
||||
using FastGithub.Configuration;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0-*" />
|
||||
<PackageReference Include="DNS" Version="6.1.0" />
|
||||
<ProjectReference Include="..\FastGithub.Core\FastGithub.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -31,4 +30,8 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FastGithub.Configuration\FastGithub.Configuration.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -5,9 +5,9 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
namespace FastGithub
|
||||
{
|
||||
/// <summary>
|
||||
/// 域名解析相关服务注册扩展
|
||||
/// 服务注册扩展
|
||||
/// </summary>
|
||||
public static class DomainResolveServiceCollectionExtensions
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 注册域名解析相关服务
|
||||
@ -19,8 +19,7 @@ namespace FastGithub
|
||||
services.AddMemoryCache();
|
||||
services.TryAddSingleton<IDomainResolver, DomainResolver>();
|
||||
services.TryAddSingleton<DnscryptProxyService>();
|
||||
services.AddHostedService<DnscryptProxyHostedService>();
|
||||
return services;
|
||||
return services.AddHostedService<DnscryptProxyHostedService>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Portable.BouncyCastle" Version="1.8.10" />
|
||||
<ProjectReference Include="..\FastGithub.Core\FastGithub.Core.csproj" />
|
||||
<ProjectReference Include="..\FastGithub.DomainResolve\FastGithub.DomainResolve.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using FastGithub.DomainResolve;
|
||||
using FastGithub.Configuration;
|
||||
using FastGithub.DomainResolve;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using FastGithub.DomainResolve;
|
||||
using FastGithub.Configuration;
|
||||
using FastGithub.DomainResolve;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace FastGithub.Http
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
namespace FastGithub.Http
|
||||
using FastGithub.Configuration;
|
||||
|
||||
namespace FastGithub.Http
|
||||
{
|
||||
/// <summary>
|
||||
/// httpClient工厂
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
namespace FastGithub.Http
|
||||
using FastGithub.Configuration;
|
||||
|
||||
namespace FastGithub.Http
|
||||
{
|
||||
/// <summary>
|
||||
/// 表示请求上下文
|
||||
|
||||
@ -5,9 +5,9 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
namespace FastGithub
|
||||
{
|
||||
/// <summary>
|
||||
/// httpClient的服务注册扩展
|
||||
/// 服务注册扩展
|
||||
/// </summary>
|
||||
public static class HttpClientServiceCollectionExtensions
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加HttpClient相关服务
|
||||
@ -11,7 +11,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FastGithub.Core\FastGithub.Core.csproj" />
|
||||
<ProjectReference Include="..\FastGithub.Http\FastGithub.Http.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using FastGithub.Http;
|
||||
using FastGithub.Configuration;
|
||||
using FastGithub.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FastGithub.Core\FastGithub.Core.csproj" />
|
||||
<ProjectReference Include="..\FastGithub.Http\FastGithub.Http.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
23
FastGithub.Upgrade/ServiceCollectionExtensions.cs
Normal file
23
FastGithub.Upgrade/ServiceCollectionExtensions.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using FastGithub.Upgrade;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace FastGithub
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务注册扩展
|
||||
/// </summary>
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加升级服务
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection AddUpgrade(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddSingleton<UpgradeService>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using FastGithub.DomainResolve;
|
||||
using FastGithub.Configuration;
|
||||
using FastGithub.DomainResolve;
|
||||
using FastGithub.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.31320.298
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub", "FastGithub\FastGithub.csproj", "{C1099390-6103-4917-A740-A3002B542FE0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub.Core", "FastGithub.Core\FastGithub.Core.csproj", "{4E4841D2-F743-40BB-BE28-729DB53775CC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub.Dns", "FastGithub.Dns\FastGithub.Dns.csproj", "{43FF9C79-51D5-4037-AA0B-CA3006E2A7E6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub.Upgrade", "FastGithub.Upgrade\FastGithub.Upgrade.csproj", "{8239A077-A84C-4FDF-A204-02A2DE4243F3}"
|
||||
@ -17,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub.Http", "FastGith
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub.DomainResolve", "FastGithub.DomainResolve\FastGithub.DomainResolve.csproj", "{5D26ABDD-F341-4EB7-9D08-FCB80F79B4B4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub.Configuration", "FastGithub.Configuration\FastGithub.Configuration.csproj", "{C63CEBB1-56DA-4AC3-BDC9-52424EC292A0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -27,10 +27,6 @@ Global
|
||||
{C1099390-6103-4917-A740-A3002B542FE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C1099390-6103-4917-A740-A3002B542FE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C1099390-6103-4917-A740-A3002B542FE0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4E4841D2-F743-40BB-BE28-729DB53775CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E4841D2-F743-40BB-BE28-729DB53775CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E4841D2-F743-40BB-BE28-729DB53775CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E4841D2-F743-40BB-BE28-729DB53775CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{43FF9C79-51D5-4037-AA0B-CA3006E2A7E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{43FF9C79-51D5-4037-AA0B-CA3006E2A7E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{43FF9C79-51D5-4037-AA0B-CA3006E2A7E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@ -51,6 +47,10 @@ Global
|
||||
{5D26ABDD-F341-4EB7-9D08-FCB80F79B4B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5D26ABDD-F341-4EB7-9D08-FCB80F79B4B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5D26ABDD-F341-4EB7-9D08-FCB80F79B4B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C63CEBB1-56DA-4AC3-BDC9-52424EC292A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C63CEBB1-56DA-4AC3-BDC9-52424EC292A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C63CEBB1-56DA-4AC3-BDC9-52424EC292A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C63CEBB1-56DA-4AC3-BDC9-52424EC292A0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
using FastGithub.Upgrade;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -27,15 +26,12 @@ namespace FastGithub
|
||||
/// <param name="services"></param>
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddConfiguration().Bind(this.Configuration.GetSection(nameof(FastGithub)));
|
||||
services.AddDnsServer();
|
||||
services.AddDomainResolve();
|
||||
services.AddHttpClient();
|
||||
services.AddReverseProxy();
|
||||
|
||||
services.AddSingleton<FastGithubConfig>();
|
||||
services.Configure<FastGithubOptions>(this.Configuration.GetSection(nameof(FastGithub)));
|
||||
|
||||
services.AddSingleton<UpgradeService>();
|
||||
services.AddUpgrade();
|
||||
services.AddHostedService<HostedService>();
|
||||
|
||||
services.AddControllersWithViews();
|
||||
@ -53,9 +49,7 @@ namespace FastGithub
|
||||
app.UseRouting();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user