mirror of
https://github.com/xljiulang/KestrelApp.git
synced 2026-10-22 15:16:22 +08:00
26 lines
830 B
C#
26 lines
830 B
C#
using KestrelApp.Middleware.HttpProxy;
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection
|
|
{
|
|
/// <summary>
|
|
/// ServiceCollection扩展
|
|
/// </summary>
|
|
public static partial class ServiceCollectionExtensions
|
|
{
|
|
/// <summary>
|
|
/// 添加http代理
|
|
/// </summary>
|
|
/// <param name="services"></param>
|
|
/// <returns></returns>
|
|
public static IServiceCollection AddHttproxy(this IServiceCollection services)
|
|
{
|
|
services.TryAddSingleton<IHttpProxyAuthenticationHandler, HttpProxyAuthenticationHandler>();
|
|
return services
|
|
.AddSingleton<ProxyMiddleware>()
|
|
.AddSingleton<TunnelProxyMiddleware>()
|
|
.AddHttpForwarder();
|
|
}
|
|
}
|
|
}
|