This commit is contained in:
Gui.H 2023-01-02 00:16:35 +08:00
parent 5cfe7dad78
commit 46a979d84e
8 changed files with 39 additions and 1 deletions

23
Dockerfile.Client Normal file
View File

@ -0,0 +1,23 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["FastTunnel.Client/FastTunnel.Client.csproj", "FastTunnel.Client/"]
COPY ["FastTunnel.Core.Client/FastTunnel.Core.Client.csproj", "FastTunnel.Core.Client/"]
RUN dotnet restore "FastTunnel.Client/FastTunnel.Client.csproj"
COPY . .
WORKDIR "/src/FastTunnel.Client"
RUN dotnet build "FastTunnel.Client.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "FastTunnel.Client.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "FastTunnel.Client.dll"]

View File

@ -20,7 +20,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace FastTunnel.Core.Handlers.Server
namespace FastTunnel.Core.Handlers
{
public class ForwardDispatcher
{

View File

@ -4,6 +4,7 @@
// https://github.com/FastTunnel/FastTunnel/edit/v2/LICENSE
// Copyright (c) 2019 Gui.H
using FastTunnel.Core.Handlers;
using FastTunnel.Core.Handlers.Server;
using Microsoft.Extensions.Logging;
using System;

View File

@ -48,8 +48,11 @@ public class TunnelClient
this.fastTunnelServer = fastTunnelServer;
this.loginHandler = loginHandler;
this.RemoteIpAddress = remoteIpAddress;
StartTime = DateTime.Now;
}
public DateTime StartTime { get; }
internal void AddWeb(WebInfo info)
{
webInfos.Add(info);

View File

@ -97,4 +97,15 @@ public class SystemController : BaseController
ApiResponse.data = fastTunnelServer.ConnectedClientCount;
return ApiResponse;
}
[HttpGet]
public ApiResponse Clients()
{
ApiResponse.data = fastTunnelServer.Clients.Select(x => new
{
RemoteIpAddress = x.RemoteIpAddress.ToString(),
StartTime = x.StartTime.ToString("yyyyy-MM-dd HH:mm:ss")
});
return ApiResponse;
}
}