mirror of
https://github.com/FastTunnel/FastTunnel.git
synced 2025-02-08 02:39:29 +08:00
精简客户端代码
This commit is contained in:
parent
f64ab45332
commit
8a1d14dfd0
|
@ -9,6 +9,7 @@ using FastTunnel.Core.Config;
|
|||
using FastTunnel.Core.Handlers.Client;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Web;
|
||||
using FastTunnel.Core.Extensions;
|
||||
|
||||
namespace FastTunnel.Client
|
||||
{
|
||||
|
@ -39,13 +40,7 @@ namespace FastTunnel.Client
|
|||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
// -------------------FastTunnel START------------------
|
||||
services.AddSingleton<FastTunnelClient>()
|
||||
.AddSingleton<ClientHeartHandler>()
|
||||
.AddSingleton<LogHandler>()
|
||||
.AddSingleton<HttpRequestHandler>()
|
||||
.AddSingleton<NewSSHHandler>();
|
||||
|
||||
services.AddHostedService<ServiceFastTunnelClient>();
|
||||
services.AddFastTunnelClient();
|
||||
// -------------------FastTunnel EDN--------------------
|
||||
})
|
||||
.ConfigureLogging((HostBuilderContext context, ILoggingBuilder logging) =>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"Logging": {
|
||||
"LogLevel": {
|
||||
// Trace Debug Information Warning Error
|
||||
"Default": "Trace",
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
using FastTunnel.Core.Filters;
|
||||
using FastTunnel.Core.Core;
|
||||
using FastTunnel.Core.Filters;
|
||||
using FastTunnel.Core.Handlers.Client;
|
||||
using FastTunnel.Core.Services;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -8,9 +11,21 @@ namespace FastTunnel.Core.Extensions
|
|||
{
|
||||
public static class ServicesExtensions
|
||||
{
|
||||
public static void AddFastTunnel(this IServiceCollection service)
|
||||
public static void AddFastTunnelServer(this IServiceCollection services)
|
||||
{
|
||||
service.AddTransient<IAuthenticationFilter, DefaultAuthenticationFilter>();
|
||||
services.AddTransient<IAuthenticationFilter, DefaultAuthenticationFilter>();
|
||||
|
||||
services.AddHostedService<ServiceFastTunnelServer>();
|
||||
}
|
||||
|
||||
public static void AddFastTunnelClient(this IServiceCollection services) {
|
||||
services.AddSingleton<FastTunnelClient>()
|
||||
.AddSingleton<ClientHeartHandler>()
|
||||
.AddSingleton<LogHandler>()
|
||||
.AddSingleton<HttpRequestHandler>()
|
||||
.AddSingleton<NewSSHHandler>();
|
||||
|
||||
services.AddHostedService<ServiceFastTunnelClient>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,7 @@ namespace FastTunnel.Server
|
|||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
// -------------------FastTunnel START------------------
|
||||
services.AddFastTunnel();
|
||||
services.AddHostedService<ServiceFastTunnelServer>();
|
||||
services.AddFastTunnelServer();
|
||||
// -------------------FastTunnel END--------------------
|
||||
})
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
|
|
Loading…
Reference in New Issue
Block a user