mirror of
https://github.com/FastTunnel/FastTunnel.git
synced 2025-02-08 02:39:29 +08:00
1.0.21
This commit is contained in:
parent
49020ede15
commit
856f19c6a6
|
@ -18,7 +18,7 @@
|
|||
<RepositoryType>git</RepositoryType>
|
||||
<PackageTags>FastTunnel.Core</PackageTags>
|
||||
<PackageReleaseNotes>FastTunnel.Core</PackageReleaseNotes>
|
||||
<Version>1.0.2</Version>
|
||||
<Version>1.0.21</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace FastTunnel.Core.Global
|
|||
{
|
||||
static IList<IFastTunntlfilter> m_filters = new List<IFastTunntlfilter>();
|
||||
|
||||
static Dictionary<Type, object> m_customHandlers = new Dictionary<Type, object>();
|
||||
|
||||
public static void AddFilter(IFastTunntlfilter filter)
|
||||
{
|
||||
m_filters.Add(filter);
|
||||
|
@ -19,5 +21,19 @@ namespace FastTunnel.Core.Global
|
|||
{
|
||||
return m_filters.Where(x => { return x.GetType().GetInterfaces().Contains(type); });
|
||||
}
|
||||
|
||||
public static void AddCustomHandler<Tbase, Impl>(Impl _impl)
|
||||
where Impl : class, Tbase
|
||||
{
|
||||
m_customHandlers.Add(typeof(Tbase), _impl);
|
||||
}
|
||||
|
||||
public static Tbase GetCustomHandler<Tbase>()
|
||||
where Tbase : class
|
||||
{
|
||||
object custom;
|
||||
m_customHandlers.TryGetValue(typeof(Tbase), out custom);
|
||||
return (Tbase)custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using FastTunnel.Core.Core;
|
||||
using FastTunnel.Core.Extensions;
|
||||
using FastTunnel.Core.Filters;
|
||||
using FastTunnel.Core.Global;
|
||||
using FastTunnel.Core.Handlers.Server;
|
||||
using FastTunnel.Core.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -23,7 +24,8 @@ namespace FastTunnel.Core.Handlers
|
|||
public LoginMessageHandler(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_configHandler = new ConfigHandler();
|
||||
var custome = FastTunnelGlobal.GetCustomHandler<IConfigHandler>();
|
||||
_configHandler = custome == null ? new ConfigHandler() : custome;
|
||||
}
|
||||
|
||||
public LogInMassage GetConfig(JObject content)
|
||||
|
|
|
@ -13,8 +13,16 @@ namespace FastTunnel.Core.Logger
|
|||
var config = new LoggingConfiguration();
|
||||
|
||||
// Targets where to log to: File and Console
|
||||
var logfile = new NLog.Targets.FileTarget("file") { FileName = "${basedir}/Logs/${shortdate}.${level}.log", Layout = "${longdate} ${logger} ${message}${exception:format=ToString}" };
|
||||
var logconsole = new NLog.Targets.ConsoleTarget("console") { Layout = "${date}|${level:uppercase=true}|${message} ${exception} ${all-event-properties}" };
|
||||
var logfile = new NLog.Targets.FileTarget("file")
|
||||
{
|
||||
FileName = "${basedir}/Logs/${shortdate}.${level}.log",
|
||||
Layout = "${longdate} ${logger} ${message}${exception:format=ToString}"
|
||||
};
|
||||
|
||||
var logconsole = new NLog.Targets.ConsoleTarget("console")
|
||||
{
|
||||
Layout = "${date}|${level:uppercase=true}|${message} ${exception} ${all-event-properties}"
|
||||
};
|
||||
|
||||
// Rules for mapping loggers to targets
|
||||
config.AddRule(LogLevel.Debug, LogLevel.Fatal, logconsole);
|
||||
|
|
|
@ -5,11 +5,6 @@
|
|||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<UserSecretsId>17e7d83b-9640-4fba-8e72-2b6b022a01b0</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Program.cs.BASE.cs" />
|
||||
<Compile Remove="Program.cs.LOCAL.cs" />
|
||||
<Compile Remove="Program.cs.REMOTE.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.0" />
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NLog.Extensions.Logging;
|
||||
using FastTunnel.Core.Core;
|
||||
using FastTunnel.Core.Handlers;
|
||||
using FastTunnel.Core.Handlers.Server;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using FastTunnel.Server.Service;
|
||||
using FastTunnel.Core.Logger;
|
||||
using FastTunnel.Core.Config;
|
||||
using FastTunnel.Server.Filters;
|
||||
|
||||
namespace FastTunnel.Server
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug", // Information
|
||||
"Default": "Information", // Information
|
||||
"Microsoft": "Error",
|
||||
"Microsoft.Hosting.Lifetime": "Error"
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
|||
"WebHasNginxProxy": false,
|
||||
|
||||
// 可选,访问白名单,不在白名单的ip拒绝
|
||||
"WebAllowAccessIps": [ "192.168.0.99", "127.0.0.1" ],
|
||||
"WebAllowAccessIps": [],
|
||||
|
||||
// 可选,是否开启SSH,禁用后不处理SSH类型端口转发.默认false。
|
||||
"SSHEnabled": true
|
||||
|
|
Loading…
Reference in New Issue
Block a user