FastGithub/FastGithub.ReverseProxy/ReverseProxyServiceCollectionExtensions.cs
xljiulang ec4d8d5607 增加https端口占用检测功能;
修复dns端口占用可能检测不到的问题;
2021-07-24 16:27:40 +08:00

28 lines
846 B
C#

using FastGithub.ReverseProxy;
using Microsoft.Extensions.DependencyInjection;
namespace FastGithub
{
/// <summary>
/// https反向代理的服务注册扩展
/// </summary>
public static class ReverseProxyServiceCollectionExtensions
{
/// <summary>
/// 添加https反向代理
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddReverseProxy(this IServiceCollection services)
{
return services
.AddMemoryCache()
.AddHttpForwarder()
.AddHttpClient()
.AddSingleton<RequestLoggingMilldeware>()
.AddSingleton<ReverseProxyMiddleware>()
.AddHostedService<ReverseProxyHostedService>();
}
}
}