mirror of
https://github.com/FastTunnel/FastTunnel.git
synced 2024-09-20 23:48:30 +08:00
1
This commit is contained in:
parent
5cfe7dad78
commit
46a979d84e
23
Dockerfile.Client
Normal file
23
Dockerfile.Client
Normal 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"]
|
|
@ -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
|
||||
{
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user