mirror of
https://github.com/FastTunnel/FastTunnel.git
synced 2025-02-08 10:59:31 +08:00
同步命名空间
This commit is contained in:
parent
e795e46fd5
commit
9b96dbaef3
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0</TargetFrameworks>
|
||||
<Version>1.1.0</Version>
|
||||
<PackageProjectUrl>https://github.com/FastTunnel/FastTunnel/tree/v2/FastTunnel.Api</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/FastTunnel/FastTunnel/tree/v2/FastTunnel.Api</RepositoryUrl>
|
||||
|
|
|
@ -8,9 +8,9 @@ using Microsoft.Extensions.Hosting;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using FastTunnel.Core;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
using FastTunnel.Core.Extensions;
|
||||
|
||||
namespace FastTunnel.Client;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"ClientSettings": {
|
||||
"Server": {
|
||||
// [必选] 服务端ip/域名(来自服务端配置文件的urls参数)
|
||||
"ServerAddr": "test.cc",
|
||||
"ServerAddr": "127.0.0.1",
|
||||
// [必选] 服务端监听的通信端口(来自服务端配置文件的urls参数)
|
||||
"ServerPort": 1270
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Licensed under the Apache License, Version 2.0 (the "License").
|
||||
// Licensed under the Apache License, Version 2.0 (the "License").
|
||||
// You may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// https://github.com/FastTunnel/FastTunnel/edit/v2/LICENSE
|
||||
|
@ -16,6 +16,7 @@ using FastTunnel.Core.Handlers.Client;
|
|||
using Microsoft.Extensions.Options;
|
||||
using System.Net.WebSockets;
|
||||
using FastTunnel.Core.Utilitys;
|
||||
using FastTunnel.Core.Models.Massage;
|
||||
|
||||
namespace FastTunnel.Core.Client
|
||||
{
|
||||
|
|
|
@ -9,12 +9,10 @@ using FastTunnel.Core.Config;
|
|||
using FastTunnel.Core.Forwarder.MiddleWare;
|
||||
using FastTunnel.Core.Forwarder;
|
||||
using FastTunnel.Core.Handlers.Client;
|
||||
using FastTunnel.Core.MiddleWares;
|
||||
using FastTunnel.Core.Services;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Yarp.ReverseProxy.Forwarder;
|
||||
using Yarp.Sample;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using FastTunnel.Core.Filters;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
@ -24,9 +22,23 @@ using Microsoft.AspNetCore.Routing;
|
|||
using Microsoft.Extensions.Options;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
|
||||
/* 项目“FastTunnel.Core (net5.0)”的未合并的更改
|
||||
在此之前:
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace FastTunnel.Core
|
||||
在此之后:
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using FastTunnel.Core.Extensions;
|
||||
using FastTunnel;
|
||||
using FastTunnel.Core;
|
||||
|
||||
namespace FastTunnel.Core
|
||||
*/
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace FastTunnel.Core.Extensions
|
||||
{
|
||||
public static class ServicesExtensions
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// Copyright (c) 2019 Gui.H
|
||||
|
||||
using FastTunnel.Core.Models;
|
||||
using FastTunnel.Core.Models.Massage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0</TargetFrameworks>
|
||||
<Version>2.1.0</Version>
|
||||
<PackageProjectUrl>https://github.com/SpringHgui/FastTunnel</PackageProjectUrl>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
|
@ -18,7 +18,9 @@
|
|||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageReleaseNotes>FastTunnel.Core</PackageReleaseNotes>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="5.0.0" />
|
||||
|
|
|
@ -9,7 +9,7 @@ using Microsoft.Extensions.Primitives;
|
|||
using Yarp.ReverseProxy.Configuration;
|
||||
using System.Linq;
|
||||
|
||||
namespace Yarp.Sample
|
||||
namespace FastTunnel.Core.Forwarder
|
||||
{
|
||||
/// <summary>
|
||||
/// Extends the IReverseProxyBuilder to support the InMemoryConfigProvider
|
||||
|
@ -19,7 +19,7 @@ namespace Yarp.Sample
|
|||
public static IReverseProxyBuilder LoadFromMemory(this IReverseProxyBuilder builder)
|
||||
{
|
||||
builder.Services.AddSingleton<IProxyConfigProvider>(
|
||||
new InMemoryConfigProvider(Array.Empty<RouteConfig>(), Array.Empty<ClusterConfig>()));
|
||||
new FastTunnelInMemoryConfigProvider(Array.Empty<RouteConfig>(), Array.Empty<ClusterConfig>()));
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
@ -28,13 +28,13 @@ namespace Yarp.Sample
|
|||
/// <summary>
|
||||
/// Provides an implementation of IProxyConfigProvider to support config being generated by code.
|
||||
/// </summary>
|
||||
public class InMemoryConfigProvider : IProxyConfigProvider
|
||||
public class FastTunnelInMemoryConfigProvider : IProxyConfigProvider
|
||||
{
|
||||
// Marked as volatile so that updates are atomic
|
||||
private volatile InMemoryConfig _config;
|
||||
private object locker = new object();
|
||||
|
||||
public InMemoryConfigProvider(IReadOnlyList<RouteConfig> routes, IReadOnlyList<ClusterConfig> clusters)
|
||||
public FastTunnelInMemoryConfigProvider(IReadOnlyList<RouteConfig> routes, IReadOnlyList<ClusterConfig> clusters)
|
||||
{
|
||||
_config = new InMemoryConfig(routes, clusters);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019-2022 Gui.H. https://github.com/FastTunnel/FastTunnel
|
||||
// Copyright (c) 2019-2022 Gui.H. https://github.com/FastTunnel/FastTunnel
|
||||
// The FastTunnel licenses this file to you under the Apache License Version 2.0.
|
||||
// For more details,You may obtain License file at: https://github.com/FastTunnel/FastTunnel/blob/v2/LICENSE
|
||||
|
||||
|
@ -13,7 +13,7 @@ using System.Net.WebSockets;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FastTunnel.Core.MiddleWares
|
||||
namespace FastTunnel.Core.Forwarder.MiddleWare
|
||||
{
|
||||
public class FastTunnelClientHandler
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ namespace FastTunnel.Core.MiddleWares
|
|||
|
||||
private bool checkToken(HttpContext context)
|
||||
{
|
||||
bool checkToken = false;
|
||||
var checkToken = false;
|
||||
if (fastTunnelServer.ServerOption.CurrentValue.Tokens != null && fastTunnelServer.ServerOption.CurrentValue.Tokens.Count != 0)
|
||||
{
|
||||
checkToken = true;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using FastTunnel.Core.Client;
|
||||
using FastTunnel.Core.Extensions;
|
||||
using FastTunnel.Core.MiddleWares;
|
||||
using Microsoft.AspNetCore.Connections.Features;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Copyright (c) 2019 Gui.H
|
||||
|
||||
using FastTunnel.Core.Client;
|
||||
using FastTunnel.Core.Dispatchers;
|
||||
using FastTunnel.Core.Exceptions;
|
||||
using FastTunnel.Core.Extensions;
|
||||
using FastTunnel.Core.Models;
|
||||
|
@ -21,7 +20,7 @@ using System.Text;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FastTunnel.Core.Dispatchers
|
||||
namespace FastTunnel.Core.Handlers.Server
|
||||
{
|
||||
public class ForwardDispatcher
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ using System.Net.WebSockets;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FastTunnel.Core.Handlers
|
||||
namespace FastTunnel.Core.Handlers.Server
|
||||
{
|
||||
public interface IClientMessageHandler
|
||||
{
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
// Copyright (c) 2019 Gui.H
|
||||
|
||||
using FastTunnel.Core.Client;
|
||||
using FastTunnel.Core.Dispatchers;
|
||||
using FastTunnel.Core.Extensions;
|
||||
using FastTunnel.Core.Forwarder;
|
||||
using FastTunnel.Core.Listener;
|
||||
using FastTunnel.Core.Models;
|
||||
using FastTunnel.Core.Models.Massage;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
@ -16,7 +17,6 @@ using System.Text.Json;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Yarp.ReverseProxy.Configuration;
|
||||
using Yarp.Sample;
|
||||
|
||||
namespace FastTunnel.Core.Handlers.Server
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ namespace FastTunnel.Core.Handlers.Server
|
|||
|
||||
logger.LogDebug($"new domain '{hostName}'");
|
||||
server.WebList.AddOrUpdate(hostName, info, (key, oldInfo) => { return info; });
|
||||
(proxyConfig as InMemoryConfigProvider).AddWeb(hostName);
|
||||
(proxyConfig as FastTunnelInMemoryConfigProvider).AddWeb(hostName);
|
||||
|
||||
await client.webSocket.SendCmdAsync(MessageType.Log, $" HTTP | http://{hostName}:{client.ConnectionPort} => {item.LocalIp}:{item.LocalPort}", CancellationToken.None);
|
||||
client.AddWeb(info);
|
||||
|
@ -61,7 +61,7 @@ namespace FastTunnel.Core.Handlers.Server
|
|||
// TODO:validateDomain
|
||||
hostName = www.Trim().ToLower();
|
||||
server.WebList.AddOrUpdate(www, info, (key, oldInfo) => { return info; });
|
||||
(proxyConfig as InMemoryConfigProvider).AddWeb(www);
|
||||
(proxyConfig as FastTunnelInMemoryConfigProvider).AddWeb(www);
|
||||
|
||||
await client.webSocket.SendCmdAsync(MessageType.Log, $" HTTP | http://{www}:{client.ConnectionPort} => {item.LocalIp}:{item.LocalPort}", CancellationToken.None);
|
||||
client.AddWeb(info);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// https://github.com/FastTunnel/FastTunnel/edit/v2/LICENSE
|
||||
// Copyright (c) 2019 Gui.H
|
||||
|
||||
using FastTunnel.Core.Dispatchers;
|
||||
using FastTunnel.Core.Handlers.Server;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Net;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FastTunnel.Core.Models
|
||||
namespace FastTunnel.Core.Models.Massage
|
||||
{
|
||||
public class LogInMassage : TunnelMassage
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// https://github.com/FastTunnel/FastTunnel/edit/v2/LICENSE
|
||||
// Copyright (c) 2019 Gui.H
|
||||
|
||||
namespace FastTunnel.Core.Models
|
||||
namespace FastTunnel.Core.Models.Massage
|
||||
{
|
||||
public class TunnelMassage
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// https://github.com/FastTunnel/FastTunnel/edit/v2/LICENSE
|
||||
// Copyright (c) 2019 Gui.H
|
||||
|
||||
using FastTunnel.Core;
|
||||
using FastTunnel.Core.Extensions;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
|
|
Loading…
Reference in New Issue
Block a user