Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| f2a6a67165 |
39 changed files with 244 additions and 281 deletions
|
|
@ -7,7 +7,10 @@
|
||||||
<AssemblyName>Insight.Agent.Assets</AssemblyName>
|
<AssemblyName>Insight.Agent.Assets</AssemblyName>
|
||||||
<RootNamespace>Insight.Agent</RootNamespace>
|
<RootNamespace>Insight.Agent</RootNamespace>
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<AssemblyVersion>2023.9.14.0</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|
@ -19,8 +22,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Vaitr.Network" Version="2023.9.13" />
|
<PackageReference Include="Vaitr.Network.MemoryPack" Version="2025.2.24" />
|
||||||
<PackageReference Include="Vaitr.Snmp" Version="2023.3.3" />
|
<PackageReference Include="Vaitr.Snmp" Version="2024.5.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,16 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
<RootNamespace>Insight.Agent</RootNamespace>
|
<RootNamespace>Insight.Agent</RootNamespace>
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<AssemblyName>agent</AssemblyName>
|
<AssemblyName>agent</AssemblyName>
|
||||||
<AssemblyVersion>2023.9.14.0</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|
|
||||||
|
|
@ -1,57 +1,30 @@
|
||||||
using Insight.Agent.Interfaces;
|
using Insight.Agent.Interfaces;
|
||||||
using Insight.Agent.Messages;
|
using Insight.Agent.Messages;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Net.Sockets;
|
||||||
using Vaitr.Network;
|
using Vaitr.Network;
|
||||||
|
|
||||||
namespace Insight.Agent.Network
|
namespace Insight.Agent.Network;
|
||||||
|
|
||||||
|
public class AgentSession(IEnumerable<IAgentMessageHandler<AgentSession>> handlers, Socket socket, Stream stream, TcpConnectionOptions options, MemPackSerializer serializer, ILogger<AgentSession> logger)
|
||||||
|
: TcpSession<MemPackSerializer, IAgentMessage>(socket, stream, options, serializer, logger)
|
||||||
{
|
{
|
||||||
public class AgentSession : TcpSession<IAgentMessage>
|
private readonly IEnumerable<IAgentMessageHandler<AgentSession>> _handlers = handlers;
|
||||||
|
|
||||||
|
protected override async ValueTask OnReceivedAsync(PacketContext<IAgentMessage> context, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
private readonly IEnumerable<IAgentMessageHandler<AgentSession>> _handlers;
|
await base.OnReceivedAsync(context, cancellationToken);
|
||||||
|
|
||||||
public AgentSession(IEnumerable<IAgentMessageHandler<AgentSession>> handlers, ISerializer<IAgentMessage> serializer, ILogger<AgentSession> logger) : base(serializer, logger)
|
foreach (var handler in _handlers)
|
||||||
{
|
{
|
||||||
_handlers = handlers;
|
try
|
||||||
}
|
|
||||||
|
|
||||||
protected override ValueTask OnConnectedAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Agent ({ep?}) connected", RemoteEndPoint);
|
|
||||||
return default;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override ValueTask OnDisconnectedAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Agent ({ep?}) disconnected", RemoteEndPoint);
|
|
||||||
return default;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override ValueTask OnSentAsync(IPacketContext<IAgentMessage> context, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
return base.OnSentAsync(context, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async ValueTask OnReceivedAsync(IPacketContext<IAgentMessage> context, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await base.OnReceivedAsync(context, cancellationToken);
|
|
||||||
|
|
||||||
foreach (var handler in _handlers)
|
|
||||||
{
|
{
|
||||||
try
|
await handler.HandleAsync(this, context.Data, cancellationToken);
|
||||||
{
|
}
|
||||||
await handler.HandleAsync(this, context.Packet, cancellationToken);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
_logger.LogWarning("Agent ({ep?}) {ex}", RemoteEndPoint, ex.ToString());
|
||||||
{
|
|
||||||
_logger.LogWarning("Agent ({ep?}) {ex}", RemoteEndPoint, ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected override ValueTask OnHeartbeatAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Agent ({ep?}) Heartbeat", RemoteEndPoint);
|
|
||||||
return default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,6 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Vaitr.Network;
|
using Vaitr.Network;
|
||||||
using Vaitr.Network.Hosting;
|
|
||||||
|
|
||||||
namespace Insight.Agent.Windows
|
namespace Insight.Agent.Windows
|
||||||
{
|
{
|
||||||
|
|
@ -52,15 +51,20 @@ namespace Insight.Agent.Windows
|
||||||
if (OperatingSystem.IsWindows()) services.AddHostedService<EventService>();
|
if (OperatingSystem.IsWindows()) services.AddHostedService<EventService>();
|
||||||
|
|
||||||
// AGENT NETWORKING
|
// AGENT NETWORKING
|
||||||
services.UseHostedClient<AgentSession, IAgentMessage>(options =>
|
services.UseHostedTcpClient<AgentSession, MemPackSerializer, IAgentMessage>(options =>
|
||||||
{
|
{
|
||||||
options.Host = host.Configuration.GetValue<string?>(Appsettings.ServerHost) ?? throw new Exception($"{Appsettings.ServerHost} value not set (appsettings)");
|
options.Host = host.Configuration.GetValue<string?>(Appsettings.ServerHost) ?? throw new Exception($"{Appsettings.ServerHost} value not set (appsettings)");
|
||||||
options.Port = host.Configuration.GetValue<int?>(Appsettings.ServerPort) ?? throw new Exception($"{Appsettings.ServerPort} value not set (appsettings)");
|
options.Port = host.Configuration.GetValue<int?>(Appsettings.ServerPort) ?? throw new Exception($"{Appsettings.ServerPort} value not set (appsettings)");
|
||||||
options.Keepalive = 10000;
|
options.Buffer = 1024 * 1024;
|
||||||
|
options.KeepAlive = 10000;
|
||||||
options.Timeout = 30000;
|
options.Timeout = 30000;
|
||||||
|
options.Parallelism = 0;
|
||||||
|
options.Compression = Compression.None;
|
||||||
options.Encryption = Encryption.Tls12;
|
options.Encryption = Encryption.Tls12;
|
||||||
|
options.SslPolicy = SslPolicy.None;
|
||||||
|
|
||||||
options.UseSerializer<MemPackSerializer<IAgentMessage>, IAgentMessage>();
|
//options.InputRateLimit = 1024 * 1024 * 100;
|
||||||
|
//options.OutputRateLimit = 1024 * 1024 * 100;
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, AuthenticationHandler>();
|
services.AddSingleton<IAgentMessageHandler<AgentSession>, AuthenticationHandler>();
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ namespace Insight.Agent.Services
|
||||||
internal class EventService : BackgroundService
|
internal class EventService : BackgroundService
|
||||||
{
|
{
|
||||||
private readonly Channel<Event> _queue;
|
private readonly Channel<Event> _queue;
|
||||||
private readonly ISessionPool<AgentSession, IAgentMessage> _pool;
|
private readonly TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> _pool;
|
||||||
private readonly ILogger<EventService> _logger;
|
private readonly ILogger<EventService> _logger;
|
||||||
|
|
||||||
public EventService(ISessionPool<AgentSession, IAgentMessage> pool, ILogger<EventService> logger)
|
public EventService(TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> pool, ILogger<EventService> logger)
|
||||||
{
|
{
|
||||||
_pool = pool;
|
_pool = pool;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ namespace Insight.Agent.Services
|
||||||
|
|
||||||
|
|
||||||
private readonly int _port;
|
private readonly int _port;
|
||||||
private readonly ISessionPool<AgentSession, IAgentMessage> _pool;
|
private readonly TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> _pool;
|
||||||
private readonly ILogger<TrapService> _logger;
|
private readonly ILogger<TrapService> _logger;
|
||||||
|
|
||||||
public TrapService(ISessionPool<AgentSession, IAgentMessage> pool, IConfiguration configuration, ILogger<TrapService> logger)
|
public TrapService(TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> pool, IConfiguration configuration, ILogger<TrapService> logger)
|
||||||
{
|
{
|
||||||
_port = configuration.GetValue<int?>(Appsettings.TrapPort) ?? throw new Exception($"{Appsettings.TrapPort} value not set (appsettings)");
|
_port = configuration.GetValue<int?>(Appsettings.TrapPort) ?? throw new Exception($"{Appsettings.TrapPort} value not set (appsettings)");
|
||||||
_pool = pool;
|
_pool = pool;
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<AssemblyName>api</AssemblyName>
|
<AssemblyName>api</AssemblyName>
|
||||||
<AssemblyVersion>2023.8.23.1</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
<RootNamespace>Insight.Api</RootNamespace>
|
<RootNamespace>Insight.Api</RootNamespace>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
<UserSecretsId>4ae1d3bf-869e-4963-8a19-35634507d3b3</UserSecretsId>
|
<UserSecretsId>4ae1d3bf-869e-4963-8a19-35634507d3b3</UserSecretsId>
|
||||||
|
|
||||||
<PublishAot>false</PublishAot>
|
<PublishAot>false</PublishAot>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"Urls": "http://127.0.0.1:5000",
|
"Urls": "http://127.0.0.1:5000",
|
||||||
"database": "mongodb://db.insight.local:27017",
|
"database": "mongodb://10.22.70.40:32768",
|
||||||
"jwt.key": "x5dcaE8fiBmHfgsNrwIEtSWzZkz6gpouzKOIgEiVjxJnW28V1aUnYXF19IcnF5x",
|
"jwt.key": "x5dcaE8fiBmHfgsNrwIEtSWzZkz6gpouzKOIgEiVjxJnW28V1aUnYXF19IcnF5x",
|
||||||
"jwt.exp": 3600,
|
"jwt.exp": 3600,
|
||||||
"jwt.audience": "http://127.0.0.1:5000",
|
"jwt.audience": "http://127.0.0.1:5000",
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RootNamespace>Insight.Domain</RootNamespace>
|
<RootNamespace>Insight.Domain</RootNamespace>
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<AssemblyVersion>2023.7.3.0</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
public static class Monitoring
|
public static class Monitoring
|
||||||
{
|
{
|
||||||
public static readonly Uri StatusUri = new("https://admin.webmatic.de/monitoring/computer/send/status");
|
public static readonly Uri StatusUri = new("https://nexus.webmatic.de/rest/monitoring/send/status");
|
||||||
public static readonly Uri LogUri = new("https://admin.webmatic.de/monitoring/computer/send/log");
|
public static readonly Uri LogUri = new("https://nexus.webmatic.de/rest/monitoring/send/log");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,9 +4,12 @@
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<RootNamespace>Insight.Infrastructure</RootNamespace>
|
<RootNamespace>Insight.Infrastructure</RootNamespace>
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<AssemblyVersion>2023.7.12.0</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
<ImplicitUsings>true</ImplicitUsings>
|
<ImplicitUsings>true</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,16 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<AssemblyName>server</AssemblyName>
|
<AssemblyName>server</AssemblyName>
|
||||||
<AssemblyVersion>2023.9.14.0</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
<RootNamespace>Insight.Server</RootNamespace>
|
<RootNamespace>Insight.Server</RootNamespace>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|
@ -49,7 +53,7 @@
|
||||||
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
|
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
|
||||||
<PackageReference Include="System.Threading" Version="4.3.0" />
|
<PackageReference Include="System.Threading" Version="4.3.0" />
|
||||||
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
|
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
|
||||||
<PackageReference Include="Vaitr.Bus" Version="0.1.3" />
|
<PackageReference Include="Vaitr.MemoryBus" Version="2024.5.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -2,88 +2,79 @@
|
||||||
using Insight.Agent.Messages;
|
using Insight.Agent.Messages;
|
||||||
using Insight.Server.Network.Handlers.Agent;
|
using Insight.Server.Network.Handlers.Agent;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Net.Sockets;
|
||||||
using Vaitr.Network;
|
using Vaitr.Network;
|
||||||
|
|
||||||
namespace Insight.Server.Network
|
namespace Insight.Server.Network;
|
||||||
|
|
||||||
|
public class AgentSession(AgentHandler agentHandler, IEnumerable<IAgentMessageHandler<AgentSession>> handlers, Socket socket, Stream stream, TcpConnectionOptions options, MemPackSerializer serializer, ILogger<AgentSession> logger)
|
||||||
|
: TcpSession<MemPackSerializer, IAgentMessage>(socket, stream, options, serializer, logger)
|
||||||
{
|
{
|
||||||
public class AgentSession : TcpSession<IAgentMessage>
|
public string? Id { get; set; }
|
||||||
|
|
||||||
|
private readonly AgentHandler _agentHandler = agentHandler;
|
||||||
|
private readonly IEnumerable<IAgentMessageHandler<AgentSession>> _handlers = handlers;
|
||||||
|
|
||||||
|
protected override async ValueTask OnConnectedAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
public string? Id { get; set; }
|
_logger.LogInformation("Agent ({ep?}) connected", RemoteEndPoint);
|
||||||
|
|
||||||
private readonly AgentHandler _agentHandler;
|
var request = new AuthenticationRequest();
|
||||||
private readonly IEnumerable<IAgentMessageHandler<AgentSession>> _handlers;
|
|
||||||
|
|
||||||
public AgentSession(AgentHandler agentHandler, IEnumerable<IAgentMessageHandler<AgentSession>> handlers, ISerializer<IAgentMessage> serializer, ILogger<AgentSession> logger) : base(serializer, logger)
|
foreach (var handler in _handlers)
|
||||||
{
|
{
|
||||||
_agentHandler = agentHandler;
|
await handler.HandleAsync(this, request, cancellationToken);
|
||||||
_handlers = handlers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async ValueTask OnConnectedAsync(CancellationToken cancellationToken)
|
await _agentHandler.ConnectedAsync(this, default);
|
||||||
|
await _agentHandler.StatisticUpdateAsync(this, default);
|
||||||
|
|
||||||
|
_logger.LogInformation("Agent ({ep?}) ID: {id}", RemoteEndPoint, Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async ValueTask OnDisconnectedAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Agent ({ep?}) disconnected", RemoteEndPoint);
|
||||||
|
|
||||||
|
await _agentHandler.StatisticUpdateAsync(this, default);
|
||||||
|
await _agentHandler.DisconnectedAsync(this, default);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async ValueTask OnSentAsync(PacketContext<IAgentMessage> context, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
await _agentHandler.StatisticUpdateAsync(this, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async ValueTask OnReceivedAsync(PacketContext<IAgentMessage> context, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
if (Id is null && context.Data is not Authentication) return;
|
||||||
|
|
||||||
|
await _agentHandler.StatisticUpdateAsync(this, cancellationToken);
|
||||||
|
|
||||||
|
foreach (var handler in _handlers)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Agent ({ep?}) connected", RemoteEndPoint);
|
try
|
||||||
|
|
||||||
var request = new AuthenticationRequest();
|
|
||||||
|
|
||||||
foreach (var handler in _handlers)
|
|
||||||
{
|
{
|
||||||
await handler.HandleAsync(this, request, cancellationToken);
|
await handler.HandleAsync(this, context.Data, cancellationToken);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
await _agentHandler.ConnectedAsync(this, default);
|
|
||||||
await _agentHandler.StatisticUpdateAsync(this, default);
|
|
||||||
|
|
||||||
_logger.LogInformation("Agent ({ep?}) ID: {id}", RemoteEndPoint, Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async ValueTask OnDisconnectedAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Agent ({ep?}) disconnected", RemoteEndPoint);
|
|
||||||
|
|
||||||
await _agentHandler.StatisticUpdateAsync(this, default);
|
|
||||||
await _agentHandler.DisconnectedAsync(this, default);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async ValueTask OnSentAsync(IPacketContext<IAgentMessage> context, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await base.OnSentAsync(context, cancellationToken);
|
|
||||||
|
|
||||||
await _agentHandler.StatisticUpdateAsync(this, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async ValueTask OnReceivedAsync(IPacketContext<IAgentMessage> context, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await base.OnReceivedAsync(context, cancellationToken);
|
|
||||||
|
|
||||||
if (Id is null && context.Packet is not Authentication) return;
|
|
||||||
|
|
||||||
await _agentHandler.StatisticUpdateAsync(this, cancellationToken);
|
|
||||||
|
|
||||||
foreach (var handler in _handlers)
|
|
||||||
{
|
{
|
||||||
try
|
_logger.LogWarning("Agent ({ep?}) {ex}", RemoteEndPoint, ex.ToString());
|
||||||
{
|
|
||||||
await handler.HandleAsync(this, context.Packet, cancellationToken);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Agent ({ep?}) {ex}", RemoteEndPoint, ex.ToString());
|
|
||||||
|
|
||||||
//await _mediator.Send(new AgentLog(new AgentLogEntity
|
//await _mediator.Send(new AgentLog(new AgentLogEntity
|
||||||
//{
|
//{
|
||||||
// Category = CategoryEnum.Network.ToString(),
|
// Category = CategoryEnum.Network.ToString(),
|
||||||
// Status = StatusEnum.Error.ToString(),
|
// Status = StatusEnum.Error.ToString(),
|
||||||
// Message = e.StackTrace
|
// Message = e.StackTrace
|
||||||
//}, this), cancellationToken).ConfigureAwait(false);
|
//}, this), cancellationToken).ConfigureAwait(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
protected override async ValueTask OnHeartbeatAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
protected override async ValueTask OnKeepAliveAsync(CancellationToken cancellationToken)
|
||||||
_logger.LogInformation("Agent ({ep?}) Heartbeat", RemoteEndPoint);
|
{
|
||||||
|
_logger.LogInformation("Agent ({ep?}) Heartbeat", RemoteEndPoint);
|
||||||
await _agentHandler.StatisticUpdateAsync(this, cancellationToken);
|
|
||||||
}
|
await _agentHandler.StatisticUpdateAsync(this, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -143,10 +143,10 @@ namespace Insight.Server.Network.Handlers.Agent
|
||||||
.Update
|
.Update
|
||||||
.Set(p => p.Update, DateTime.Now)
|
.Set(p => p.Update, DateTime.Now)
|
||||||
.Set(p => p.Activity, session.Activity)
|
.Set(p => p.Activity, session.Activity)
|
||||||
.Set(p => p.SentBytes, session.SentBytes)
|
.Set(p => p.SentBytes, session.TotalOutputBytes)
|
||||||
.Set(p => p.ReceivedBytes, session.ReceivedBytes)
|
.Set(p => p.ReceivedBytes, session.TotalInputBytes)
|
||||||
.Set(p => p.SentPackets, session.SentPackets)
|
.Set(p => p.SentPackets, session.TotalOutputPackets)
|
||||||
.Set(p => p.ReceivedPackets, session.ReceivedPackets), null, cancellationToken)
|
.Set(p => p.ReceivedPackets, session.TotalInputPackets), null, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@ namespace Insight.Server.Network.Handlers.Agent
|
||||||
{
|
{
|
||||||
public class ConsoleHandler : IAgentMessageHandler<AgentSession>
|
public class ConsoleHandler : IAgentMessageHandler<AgentSession>
|
||||||
{
|
{
|
||||||
private readonly ISessionPool<WebSession, IWebMessage> _webPool;
|
private readonly TcpSessionPool<WebSession, MemPackSerializer, IWebMessage> _webPool;
|
||||||
private readonly IMongoDatabase _database;
|
private readonly IMongoDatabase _database;
|
||||||
private readonly ILogger<ConsoleHandler> _logger;
|
private readonly ILogger<ConsoleHandler> _logger;
|
||||||
|
|
||||||
public ConsoleHandler(
|
public ConsoleHandler(
|
||||||
ISessionPool<WebSession, IWebMessage> webPool,
|
TcpSessionPool<WebSession, MemPackSerializer, IWebMessage> webPool,
|
||||||
IMongoDatabase database,
|
IMongoDatabase database,
|
||||||
ILogger<ConsoleHandler> logger)
|
ILogger<ConsoleHandler> logger)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using Insight.Web.Interfaces;
|
||||||
using Insight.Web.Messages;
|
using Insight.Web.Messages;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
using Vaitr.Network;
|
using Vaitr.Network;
|
||||||
|
|
||||||
namespace Insight.Server.Network.Handlers.Web
|
namespace Insight.Server.Network.Handlers.Web
|
||||||
|
|
@ -14,17 +14,17 @@ namespace Insight.Server.Network.Handlers.Web
|
||||||
{
|
{
|
||||||
private readonly List<IDisposable> _subscriptions = new();
|
private readonly List<IDisposable> _subscriptions = new();
|
||||||
|
|
||||||
private readonly ISessionPool<AgentSession, IAgentMessage> _agentPool;
|
private readonly TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> _agentPool;
|
||||||
private readonly ISessionPool<WebSession, IWebMessage> _webPool;
|
private readonly TcpSessionPool<WebSession, MemPackSerializer, IWebMessage> _webPool;
|
||||||
private readonly IMongoDatabase _database;
|
private readonly IMongoDatabase _database;
|
||||||
private readonly Bus _bus;
|
private readonly IMemoryBus _bus;
|
||||||
private readonly ILogger<ConsoleProxyHandler> _logger;
|
private readonly ILogger<ConsoleProxyHandler> _logger;
|
||||||
|
|
||||||
public ConsoleProxyHandler(
|
public ConsoleProxyHandler(
|
||||||
ISessionPool<AgentSession, IAgentMessage> agentPool,
|
TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> agentPool,
|
||||||
ISessionPool<WebSession, IWebMessage> webPool,
|
TcpSessionPool<WebSession, MemPackSerializer, IWebMessage> webPool,
|
||||||
IMongoDatabase database,
|
IMongoDatabase database,
|
||||||
Bus bus,
|
IMemoryBus bus,
|
||||||
ILogger<ConsoleProxyHandler> logger)
|
ILogger<ConsoleProxyHandler> logger)
|
||||||
{
|
{
|
||||||
_agentPool = agentPool;
|
_agentPool = agentPool;
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,25 @@
|
||||||
using Insight.Web.Interfaces;
|
using Insight.Web.Interfaces;
|
||||||
using Insight.Web.Messages;
|
using Insight.Web.Messages;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Net.Sockets;
|
||||||
using Vaitr.Network;
|
using Vaitr.Network;
|
||||||
|
|
||||||
namespace Insight.Server.Network;
|
namespace Insight.Server.Network;
|
||||||
|
|
||||||
public class WebSession : TcpSession<IWebMessage>
|
public class WebSession(IEnumerable<IWebMessageHandler<WebSession>> handlers, Socket socket, Stream stream, TcpConnectionOptions options, MemPackSerializer serializer, ILogger<WebSession> logger)
|
||||||
|
: TcpSession<MemPackSerializer, IWebMessage>(socket, stream, options, serializer, logger)
|
||||||
{
|
{
|
||||||
public string? Id { get; set; }
|
public string? Id { get; set; }
|
||||||
|
|
||||||
private readonly IEnumerable<IWebMessageHandler<WebSession>> _handlers;
|
private readonly IEnumerable<IWebMessageHandler<WebSession>> _handlers = handlers;
|
||||||
|
|
||||||
public WebSession(IEnumerable<IWebMessageHandler<WebSession>> handlers, ISerializer<IWebMessage> serializer, ILogger<WebSession> logger) : base(serializer, logger)
|
protected override async ValueTask OnReceivedAsync(PacketContext<IWebMessage> context, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_handlers = handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async ValueTask OnConnectedAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Web ({ep?}) connected", RemoteEndPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async ValueTask OnDisconnectedAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Web ({ep?}) disconnected", RemoteEndPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async ValueTask OnSentAsync(IPacketContext<IWebMessage> context, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await base.OnSentAsync(context, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async ValueTask OnReceivedAsync(IPacketContext<IWebMessage> context, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await base.OnReceivedAsync(context, cancellationToken);
|
|
||||||
|
|
||||||
foreach (var handler in _handlers)
|
foreach (var handler in _handlers)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await handler.HandleAsync(this, context.Packet, cancellationToken);
|
await handler.HandleAsync(this, context.Data, cancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -47,9 +27,4 @@ public class WebSession : TcpSession<IWebMessage>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async ValueTask OnHeartbeatAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Web ({ep?}) Heartbeat", RemoteEndPoint);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -14,9 +14,8 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus.Hosting;
|
||||||
using Vaitr.Network;
|
using Vaitr.Network;
|
||||||
using Vaitr.Network.Hosting;
|
|
||||||
|
|
||||||
namespace Insight.Server
|
namespace Insight.Server
|
||||||
{
|
{
|
||||||
|
|
@ -60,19 +59,23 @@ namespace Insight.Server
|
||||||
services.AddDatabase(host.Configuration);
|
services.AddDatabase(host.Configuration);
|
||||||
|
|
||||||
// AGENT SERVER
|
// AGENT SERVER
|
||||||
services.UseHostedServer<AgentSession, IAgentMessage>(options =>
|
services.UseHostedTcpServer<AgentSession, MemPackSerializer, IAgentMessage>(options =>
|
||||||
{
|
{
|
||||||
options.Address = IPAddress.Any;
|
options.Address = IPAddress.Any;
|
||||||
options.Port = host.Configuration.GetValue<int?>(Appsettings.AgentServerPort) ?? throw new Exception($"{Appsettings.AgentServerPort} value not set (appsettings)");
|
options.Port = host.Configuration.GetValue<int?>(Appsettings.AgentServerPort) ?? throw new Exception($"{Appsettings.AgentServerPort} value not set (appsettings)");
|
||||||
options.Keepalive = 10000;
|
options.KeepAlive = 10000;
|
||||||
options.Timeout = 30000;
|
options.Timeout = 30000;
|
||||||
options.Backlog = 128;
|
options.Backlog = 128;
|
||||||
|
options.Buffer = 1024 * 1024;
|
||||||
options.Encryption = Encryption.Tls12;
|
options.Parallelism = 0;
|
||||||
options.Certificate = host.Configuration.GetValue<string?>(Appsettings.AgentServerCertificate) ?? throw new Exception($"{Appsettings.AgentServerCertificate} value not set (appsettings)");
|
options.Certificate = host.Configuration.GetValue<string?>(Appsettings.AgentServerCertificate) ?? throw new Exception($"{Appsettings.AgentServerCertificate} value not set (appsettings)");
|
||||||
options.CertificatePassword = host.Configuration.GetValue<string?>(Appsettings.AgentServerCertificatePassword) ?? throw new Exception($"{Appsettings.AgentServerCertificatePassword} value not set (appsettings)");
|
options.CertificatePassword = host.Configuration.GetValue<string?>(Appsettings.AgentServerCertificatePassword) ?? throw new Exception($"{Appsettings.AgentServerCertificatePassword} value not set (appsettings)");
|
||||||
|
options.Compression = Compression.None;
|
||||||
|
options.Encryption = Encryption.Tls12;
|
||||||
|
options.SslPolicy = SslPolicy.None;
|
||||||
|
|
||||||
options.UseSerializer<MemPackSerializer<IAgentMessage>, IAgentMessage>();
|
//options.InputRateLimit = 1024 * 1024;
|
||||||
|
//options.OutputRateLimit = 1024 * 1024;
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddSingleton<AgentHandler>();
|
services.AddSingleton<AgentHandler>();
|
||||||
|
|
@ -98,19 +101,23 @@ namespace Insight.Server
|
||||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, ConsoleHandler>();
|
services.AddSingleton<IAgentMessageHandler<AgentSession>, ConsoleHandler>();
|
||||||
|
|
||||||
// WEB (FRONTEND-PROXY) SERVER
|
// WEB (FRONTEND-PROXY) SERVER
|
||||||
services.UseHostedServer<WebSession, IWebMessage>(options =>
|
services.UseHostedTcpServer<WebSession, MemPackSerializer, IWebMessage>(options =>
|
||||||
{
|
{
|
||||||
options.Address = IPAddress.Any;
|
options.Address = IPAddress.Any;
|
||||||
options.Port = host.Configuration.GetValue<int?>(Appsettings.WebServerPort) ?? throw new Exception($"{Appsettings.WebServerPort} value not set (appsettings)");
|
options.Port = host.Configuration.GetValue<int?>(Appsettings.WebServerPort) ?? throw new Exception($"{Appsettings.WebServerPort} value not set (appsettings)");
|
||||||
options.Keepalive = 10000;
|
options.KeepAlive = 10000;
|
||||||
options.Timeout = 30000;
|
options.Timeout = 30000;
|
||||||
options.Backlog = 128;
|
options.Backlog = 128;
|
||||||
|
options.Buffer = 1024 * 1024;
|
||||||
options.Encryption = Encryption.Tls12;
|
options.Parallelism = 0;
|
||||||
options.Certificate = host.Configuration.GetValue<string?>(Appsettings.WebServerCertificate) ?? throw new Exception($"{Appsettings.WebServerCertificate} value not set (appsettings)");
|
options.Certificate = host.Configuration.GetValue<string?>(Appsettings.WebServerCertificate) ?? throw new Exception($"{Appsettings.WebServerCertificate} value not set (appsettings)");
|
||||||
options.CertificatePassword = host.Configuration.GetValue<string?>(Appsettings.WebServerCertificatePassword) ?? throw new Exception($"{Appsettings.WebServerCertificatePassword} value not set (appsettings)");
|
options.CertificatePassword = host.Configuration.GetValue<string?>(Appsettings.WebServerCertificatePassword) ?? throw new Exception($"{Appsettings.WebServerCertificatePassword} value not set (appsettings)");
|
||||||
|
options.Compression = Compression.None;
|
||||||
|
options.Encryption = Encryption.Tls12;
|
||||||
|
options.SslPolicy = SslPolicy.None;
|
||||||
|
|
||||||
options.UseSerializer<MemPackSerializer<IWebMessage>, IWebMessage>();
|
//options.InputRateLimit = 1024 * 1024;
|
||||||
|
//options.OutputRateLimit = 1024 * 1024;
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddSingleton<IWebMessageHandler<WebSession>, ConsoleProxyHandler>();
|
services.AddSingleton<IWebMessageHandler<WebSession>, ConsoleProxyHandler>();
|
||||||
|
|
@ -120,7 +127,7 @@ namespace Insight.Server
|
||||||
services.AddHostedService<DispatchService>();
|
services.AddHostedService<DispatchService>();
|
||||||
|
|
||||||
// GLOBAL DEPENDENCIES
|
// GLOBAL DEPENDENCIES
|
||||||
services.AddSingleton<Bus>();
|
services.AddMemoryBus();
|
||||||
services.AddTransient(provider => new HttpClient(new HttpClientHandler
|
services.AddTransient(provider => new HttpClient(new HttpClientHandler
|
||||||
{
|
{
|
||||||
ClientCertificateOptions = ClientCertificateOption.Manual,
|
ClientCertificateOptions = ClientCertificateOption.Manual,
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@ namespace Insight.Server.Services
|
||||||
{
|
{
|
||||||
internal class JobService : BackgroundService
|
internal class JobService : BackgroundService
|
||||||
{
|
{
|
||||||
private readonly ISessionPool<AgentSession, IAgentMessage> _agentPool;
|
private readonly TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> _agentPool;
|
||||||
private readonly IMongoDatabase _database;
|
private readonly IMongoDatabase _database;
|
||||||
private readonly ILogger<JobService> _logger;
|
private readonly ILogger<JobService> _logger;
|
||||||
|
|
||||||
public JobService(ISessionPool<AgentSession, IAgentMessage> agentPool, IMongoDatabase database, ILogger<JobService> logger)
|
public JobService(TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> agentPool, IMongoDatabase database, ILogger<JobService> logger)
|
||||||
{
|
{
|
||||||
_agentPool = agentPool;
|
_agentPool = agentPool;
|
||||||
_database = database;
|
_database = database;
|
||||||
|
|
@ -27,6 +27,8 @@ namespace Insight.Server.Services
|
||||||
{
|
{
|
||||||
_logger.LogTrace("ExecuteAsync");
|
_logger.LogTrace("ExecuteAsync");
|
||||||
|
|
||||||
|
await Task.Delay(TimeSpan.FromMinutes(1), cancellationToken);
|
||||||
|
|
||||||
var jobs = new List<Task>
|
var jobs = new List<Task>
|
||||||
{
|
{
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"database": "mongodb://db.insight.local:27017",
|
"database": "mongodb://10.22.70.40:32768",
|
||||||
"agent.server.port": 3002,
|
"agent.server.port": 3002,
|
||||||
"agent.server.certificate": "localhost.pfx",
|
"agent.server.certificate": "localhost.pfx",
|
||||||
"agent.server.certificate.password": "Webmatic12",
|
"agent.server.certificate.password": "Webmatic12",
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@
|
||||||
<AssemblyName>setup</AssemblyName>
|
<AssemblyName>setup</AssemblyName>
|
||||||
<RootNamespace>Insight.Setup</RootNamespace>
|
<RootNamespace>Insight.Setup</RootNamespace>
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<AssemblyVersion>2023.7.3.0</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,12 @@
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<RootNamespace>Insight.Updater</RootNamespace>
|
<RootNamespace>Insight.Updater</RootNamespace>
|
||||||
<AssemblyName>updater</AssemblyName>
|
<AssemblyName>updater</AssemblyName>
|
||||||
<AssemblyVersion>2023.7.3.0</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,15 @@
|
||||||
<AssemblyName>Insight.Web.Assets</AssemblyName>
|
<AssemblyName>Insight.Web.Assets</AssemblyName>
|
||||||
<RootNamespace>Insight.Web</RootNamespace>
|
<RootNamespace>Insight.Web</RootNamespace>
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<AssemblyVersion>2023.9.14.0</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MongoDB.Bson" Version="2.21.0" />
|
<PackageReference Include="MongoDB.Bson" Version="2.21.0" />
|
||||||
<PackageReference Include="Vaitr.Network" Version="2023.9.13" />
|
<PackageReference Include="Vaitr.Network.MemoryPack" Version="2025.2.24" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@ using Microsoft.AspNetCore.SignalR.Client;
|
||||||
using Microsoft.JSInterop;
|
using Microsoft.JSInterop;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using MudBlazor;
|
using MudBlazor;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
using static Insight.Web.Constants.Events.Chat;
|
using static Insight.Web.Constants.Events.Chat;
|
||||||
|
|
||||||
namespace Insight.Web.Components.Dialogs;
|
namespace Insight.Web.Components.Dialogs;
|
||||||
|
|
||||||
public partial class ChatDialog
|
public partial class ChatDialog
|
||||||
{
|
{
|
||||||
[Inject] private Bus Bus { get; init; } = default!;
|
[Inject] private IMemoryBus Bus { get; init; } = default!;
|
||||||
[Inject] private ChatService ChatService { get; init; } = default!;
|
[Inject] private ChatService ChatService { get; init; } = default!;
|
||||||
[Inject] private SessionPool SessionCache { get; init; } = default!;
|
[Inject] private SessionPool SessionCache { get; init; } = default!;
|
||||||
[Inject] private SessionHandler SessionHandler { get; init; } = default!;
|
[Inject] private SessionHandler SessionHandler { get; init; } = default!;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
@using Vaitr.Bus;
|
@using Vaitr.MemoryBus;
|
||||||
|
|
||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
|
|
||||||
@inject Bus Bus
|
@inject IMemoryBus Bus
|
||||||
|
|
||||||
<MudSnackbarProvider />
|
<MudSnackbarProvider />
|
||||||
<MudDialogProvider />
|
<MudDialogProvider />
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using Insight.Web.Constants;
|
using Insight.Web.Constants;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
|
|
||||||
namespace Insight.Web.Components.Navbars;
|
namespace Insight.Web.Components.Navbars;
|
||||||
|
|
||||||
|
|
@ -11,7 +11,7 @@ public partial class Customer
|
||||||
[CascadingParameter] public IReadOnlyDictionary<string, object>? RouteValues { get; set; }
|
[CascadingParameter] public IReadOnlyDictionary<string, object>? RouteValues { get; set; }
|
||||||
|
|
||||||
[Inject] private IMongoDatabase Database { get; set; } = default!;
|
[Inject] private IMongoDatabase Database { get; set; } = default!;
|
||||||
[Inject] private Bus Bus { get; init; } = default!;
|
[Inject] private IMemoryBus Bus { get; init; } = default!;
|
||||||
|
|
||||||
private string Title { get; set; } = "Customer";
|
private string Title { get; set; } = "Customer";
|
||||||
private string? Id { get; set; }
|
private string? Id { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ using Insight.Infrastructure.Entities;
|
||||||
using Insight.Web.Constants;
|
using Insight.Web.Constants;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
|
|
||||||
namespace Insight.Web.Components.Navbars;
|
namespace Insight.Web.Components.Navbars;
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@ public partial class Host : IDisposable
|
||||||
[CascadingParameter] public IReadOnlyDictionary<string, object>? RouteValues { get; set; }
|
[CascadingParameter] public IReadOnlyDictionary<string, object>? RouteValues { get; set; }
|
||||||
|
|
||||||
[Inject] private IMongoDatabase Database { get; init; } = default!;
|
[Inject] private IMongoDatabase Database { get; init; } = default!;
|
||||||
[Inject] private Bus Bus { get; init; } = default!;
|
[Inject] private IMemoryBus Bus { get; init; } = default!;
|
||||||
|
|
||||||
private CustomerEntity? CustomerEntity { get; set; }
|
private CustomerEntity? CustomerEntity { get; set; }
|
||||||
private HostEntity HostEntity { get; set; }
|
private HostEntity HostEntity { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
using Insight.Web.Constants;
|
using Insight.Web.Constants;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
|
|
||||||
namespace Insight.Web.Components.Navbars;
|
namespace Insight.Web.Components.Navbars;
|
||||||
|
|
||||||
public partial class Main : IDisposable
|
public partial class Main : IDisposable
|
||||||
{
|
{
|
||||||
[Inject] private Bus Bus { get; init; } = default!;
|
[Inject] private IMemoryBus Bus { get; init; } = default!;
|
||||||
[Inject] private NavigationManager NavigationManager { get; init; } = default!;
|
[Inject] private NavigationManager NavigationManager { get; init; } = default!;
|
||||||
|
|
||||||
private string Uri { get; set; } = string.Empty;
|
private string Uri { get; set; } = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using Insight.Web.Constants;
|
using Insight.Web.Constants;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
|
|
||||||
namespace Insight.Web.Components.Navbars;
|
namespace Insight.Web.Components.Navbars;
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@ public partial class NavSwitch : IDisposable
|
||||||
[CascadingParameter] public IReadOnlyDictionary<string, object>? RouteValues { get; set; }
|
[CascadingParameter] public IReadOnlyDictionary<string, object>? RouteValues { get; set; }
|
||||||
|
|
||||||
[Inject] private NavigationManager NavigationManager { get; init; } = default!;
|
[Inject] private NavigationManager NavigationManager { get; init; } = default!;
|
||||||
[Inject] private Bus Bus { get; init; } = default!;
|
[Inject] private IMemoryBus Bus { get; init; } = default!;
|
||||||
|
|
||||||
public string Url { get; set; } = string.Empty;
|
public string Url { get; set; } = string.Empty;
|
||||||
private IDisposable? Token { get; set; }
|
private IDisposable? Token { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
@using System.Collections.Concurrent;
|
@using System.Collections.Concurrent;
|
||||||
@using Vaitr.Bus;
|
@using Vaitr.MemoryBus;
|
||||||
@using static Insight.Web.Constants.Events.Chat;
|
@using static Insight.Web.Constants.Events.Chat;
|
||||||
|
|
||||||
@inject Bus Bus
|
@inject IMemoryBus Bus
|
||||||
@inject SessionHandler SessionHandler
|
@inject SessionHandler SessionHandler
|
||||||
|
|
||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
@using Vaitr.Bus;
|
@using Vaitr.MemoryBus;
|
||||||
|
|
||||||
@inject SessionHandler SessionHandler
|
@inject SessionHandler SessionHandler
|
||||||
@inject Bus Bus
|
@inject IMemoryBus Bus
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,18 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
<Product>Insight</Product>
|
<Product>Insight</Product>
|
||||||
<AssemblyName>web</AssemblyName>
|
<AssemblyName>web</AssemblyName>
|
||||||
<AssemblyVersion>2023.9.18.0</AssemblyVersion>
|
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||||
|
<FileVersion>2025.2.24.0</FileVersion>
|
||||||
<RootNamespace>Insight.Web</RootNamespace>
|
<RootNamespace>Insight.Web</RootNamespace>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<PublishAot>false</PublishAot>
|
<PublishAot>false</PublishAot>
|
||||||
<PublishTrimmed>false</PublishTrimmed>
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
|
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
<!--<ServerGarbageCollection>false</ServerGarbageCollection>
|
<!--<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||||
<ConcurrentGarbageCollection>false</ConcurrentGarbageCollection>-->
|
<ConcurrentGarbageCollection>false</ConcurrentGarbageCollection>-->
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -30,7 +34,6 @@
|
||||||
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
|
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.11" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.11" />
|
||||||
<PackageReference Include="MudBlazor" Version="6.10.0" />
|
<PackageReference Include="MudBlazor" Version="6.10.0" />
|
||||||
<PackageReference Include="Vaitr.Bus" Version="0.1.3" />
|
|
||||||
<!--Unix Serilog stuff-->
|
<!--Unix Serilog stuff-->
|
||||||
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
|
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
|
||||||
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
|
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
|
||||||
|
|
@ -39,6 +42,7 @@
|
||||||
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
|
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
|
||||||
<PackageReference Include="System.Threading" Version="4.3.0" />
|
<PackageReference Include="System.Threading" Version="4.3.0" />
|
||||||
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
|
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
|
||||||
|
<PackageReference Include="Vaitr.MemoryBus" Version="2024.5.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
using Insight.Web.Interfaces;
|
using Insight.Web.Interfaces;
|
||||||
using Insight.Web.Messages;
|
using Insight.Web.Messages;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
|
|
||||||
namespace Insight.Web.Network.Handlers
|
namespace Insight.Web.Network.Handlers
|
||||||
{
|
{
|
||||||
public class ConsoleHandler : IWebMessageHandler<WebSession>
|
public class ConsoleHandler : IWebMessageHandler<WebSession>
|
||||||
{
|
{
|
||||||
private readonly Bus _bus;
|
private readonly IMemoryBus _bus;
|
||||||
|
|
||||||
public ConsoleHandler(Bus bus)
|
public ConsoleHandler(IMemoryBus bus)
|
||||||
{
|
{
|
||||||
_bus = bus;
|
_bus = bus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,56 +1,29 @@
|
||||||
using Insight.Web.Interfaces;
|
using Insight.Web.Interfaces;
|
||||||
using Insight.Web.Messages;
|
using Insight.Web.Messages;
|
||||||
|
using System.Net.Sockets;
|
||||||
using Vaitr.Network;
|
using Vaitr.Network;
|
||||||
|
|
||||||
namespace Insight.Web.Network
|
namespace Insight.Web.Network;
|
||||||
|
|
||||||
|
public class WebSession(IEnumerable<IWebMessageHandler<WebSession>> handlers, Socket socket, Stream stream, TcpConnectionOptions options, MemPackSerializer serializer, ILogger<WebSession> logger)
|
||||||
|
: TcpSession<MemPackSerializer, IWebMessage>(socket, stream, options, serializer, logger)
|
||||||
{
|
{
|
||||||
public class WebSession : TcpSession<IWebMessage>
|
private readonly IEnumerable<IWebMessageHandler<WebSession>> _handlers = handlers;
|
||||||
|
|
||||||
|
protected override async ValueTask OnReceivedAsync(PacketContext<IWebMessage> context, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
private readonly IEnumerable<IWebMessageHandler<WebSession>> _handlers;
|
await base.OnReceivedAsync(context, cancellationToken);
|
||||||
|
|
||||||
public WebSession(IEnumerable<IWebMessageHandler<WebSession>> handlers, ISerializer<IWebMessage> serializer, ILogger<WebSession> logger) : base(serializer, logger)
|
foreach (var handler in _handlers)
|
||||||
{
|
{
|
||||||
_handlers = handlers;
|
try
|
||||||
}
|
|
||||||
|
|
||||||
protected override ValueTask OnConnectedAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Web ({ep?}) connected", RemoteEndPoint);
|
|
||||||
return default;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override ValueTask OnDisconnectedAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Web ({ep?}) disconnected", RemoteEndPoint);
|
|
||||||
return default;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override ValueTask OnSentAsync(IPacketContext<IWebMessage> context, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
return base.OnSentAsync(context, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async ValueTask OnReceivedAsync(IPacketContext<IWebMessage> context, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await base.OnReceivedAsync(context, cancellationToken);
|
|
||||||
|
|
||||||
foreach (var handler in _handlers)
|
|
||||||
{
|
{
|
||||||
try
|
await handler.HandleAsync(this, context.Data, cancellationToken);
|
||||||
{
|
}
|
||||||
await handler.HandleAsync(this, context.Packet, cancellationToken);
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
_logger.LogWarning("Web ({ep?}) {ex}", RemoteEndPoint, ex.ToString());
|
||||||
{
|
|
||||||
_logger.LogWarning("Web ({ep?}) {ex}", RemoteEndPoint, ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected override ValueTask OnHeartbeatAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Web ({ep?}) Heartbeat", RemoteEndPoint);
|
|
||||||
return default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Components;
|
||||||
using MongoDB.Bson;
|
using MongoDB.Bson;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using MudBlazor;
|
using MudBlazor;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
using Vaitr.Network;
|
using Vaitr.Network;
|
||||||
|
|
||||||
namespace Insight.Web.Pages.Management.Hosts.Actions.Console;
|
namespace Insight.Web.Pages.Management.Hosts.Actions.Console;
|
||||||
|
|
@ -17,10 +17,10 @@ public partial class Index
|
||||||
{
|
{
|
||||||
[Parameter] public string? HostId { get; set; }
|
[Parameter] public string? HostId { get; set; }
|
||||||
|
|
||||||
[Inject] private ISessionPool<WebSession, IWebMessage> WebPool { get; init; } = default!;
|
[Inject] private TcpSessionPool<WebSession, MemPackSerializer, IWebMessage> WebPool { get; init; } = default!;
|
||||||
[Inject] private IMongoDatabase Database { get; init; } = default!;
|
[Inject] private IMongoDatabase Database { get; init; } = default!;
|
||||||
[Inject] private ISnackbar Snackbar { get; init; } = default!;
|
[Inject] private ISnackbar Snackbar { get; init; } = default!;
|
||||||
[Inject] private Bus Bus { get; init; } = default!;
|
[Inject] private IMemoryBus Bus { get; init; } = default!;
|
||||||
[Inject] private NavigationManager NavigationManager { get; init; } = default!;
|
[Inject] private NavigationManager NavigationManager { get; init; } = default!;
|
||||||
|
|
||||||
private string Title { get; set; } = Global.Name;
|
private string Title { get; set; } = Global.Name;
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ using Insight.Web.Messages;
|
||||||
using Insight.Web.Middleware;
|
using Insight.Web.Middleware;
|
||||||
using Insight.Web.Network;
|
using Insight.Web.Network;
|
||||||
using Insight.Web.Network.Handlers;
|
using Insight.Web.Network.Handlers;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus.Hosting;
|
||||||
using Vaitr.Network;
|
using Vaitr.Network;
|
||||||
using Vaitr.Network.Hosting;
|
using static Insight.Web.Constants.Navigation.Management.Hosts.Systems;
|
||||||
|
|
||||||
namespace Insight.Web;
|
namespace Insight.Web;
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class Program
|
||||||
// IDENTITY
|
// IDENTITY
|
||||||
builder.Services.AddIdentityServices(builder.Configuration);
|
builder.Services.AddIdentityServices(builder.Configuration);
|
||||||
builder.Services.AddCustomAuthentication(builder.Configuration);
|
builder.Services.AddCustomAuthentication(builder.Configuration);
|
||||||
builder.Services.AddSingleton<Bus>();
|
builder.Services.AddMemoryBus();
|
||||||
|
|
||||||
// SECURITY
|
// SECURITY
|
||||||
builder.Services.AddAuthorization();
|
builder.Services.AddAuthorization();
|
||||||
|
|
@ -60,18 +60,23 @@ public class Program
|
||||||
});
|
});
|
||||||
|
|
||||||
// NETWORKING
|
// NETWORKING
|
||||||
builder.Services.UseHostedClient<WebSession, IWebMessage>(options =>
|
//builder.Services.UseHostedTcpClient<WebSession, MemPackSerializer, IWebMessage>(options =>
|
||||||
{
|
//{
|
||||||
options.Host = builder.Configuration.GetValue<string?>(Appsettings.ServerHost) ?? throw new Exception($"{Appsettings.ServerHost} value not set (appsettings)");
|
// options.Host = builder.Configuration.GetValue<string?>(Appsettings.ServerHost) ?? throw new Exception($"{Appsettings.ServerHost} value not set (appsettings)");
|
||||||
options.Port = builder.Configuration.GetValue<int?>(Appsettings.ServerPort) ?? throw new Exception($"{Appsettings.ServerPort} value not set (appsettings)");
|
// options.Port = builder.Configuration.GetValue<int?>(Appsettings.ServerPort) ?? throw new Exception($"{Appsettings.ServerPort} value not set (appsettings)");
|
||||||
options.Keepalive = 10000;
|
// options.KeepAlive = 10000;
|
||||||
options.Timeout = 30000;
|
// options.Timeout = 30000;
|
||||||
options.Encryption = Encryption.Tls12;
|
// options.Buffer = 1024 * 1024;
|
||||||
|
// options.Parallelism = 0;
|
||||||
|
// options.Compression = Compression.None;
|
||||||
|
// options.Encryption = Encryption.Tls12;
|
||||||
|
// options.SslPolicy = SslPolicy.None;
|
||||||
|
|
||||||
options.UseSerializer<MemPackSerializer<IWebMessage>, IWebMessage>();
|
// //options.InputRateLimit = 1024 * 1024 * 100;
|
||||||
});
|
// //options.OutputRateLimit = 1024 * 1024 * 100;
|
||||||
|
//});
|
||||||
|
|
||||||
builder.Services.AddSingleton<IWebMessageHandler<WebSession>, ConsoleHandler>();
|
//builder.Services.AddSingleton<IWebMessageHandler<WebSession>, ConsoleHandler>();
|
||||||
|
|
||||||
// WEB:APP
|
// WEB:APP
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ using Insight.Web.Models;
|
||||||
using MongoDB.Bson;
|
using MongoDB.Bson;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
using static Insight.Web.Constants.Events.Chat;
|
using static Insight.Web.Constants.Events.Chat;
|
||||||
|
|
||||||
namespace Insight.Web.Services;
|
namespace Insight.Web.Services;
|
||||||
|
|
@ -13,11 +13,11 @@ public class ChatService
|
||||||
public readonly ConcurrentDictionary<ChatUser, List<string>> Users = new();
|
public readonly ConcurrentDictionary<ChatUser, List<string>> Users = new();
|
||||||
public readonly ConcurrentDictionary<ObjectId, ChatSession> Sessions = new();
|
public readonly ConcurrentDictionary<ObjectId, ChatSession> Sessions = new();
|
||||||
|
|
||||||
private readonly Bus _bus;
|
private readonly IMemoryBus _bus;
|
||||||
private readonly IMongoDatabase _database;
|
private readonly IMongoDatabase _database;
|
||||||
private readonly ILogger<ChatService> _logger;
|
private readonly ILogger<ChatService> _logger;
|
||||||
|
|
||||||
public ChatService(Bus bus, IMongoDatabase database, ILogger<ChatService> logger)
|
public ChatService(IMemoryBus bus, IMongoDatabase database, ILogger<ChatService> logger)
|
||||||
{
|
{
|
||||||
_bus = bus;
|
_bus = bus;
|
||||||
_database = database;
|
_database = database;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using Insight.Web.Constants;
|
using Insight.Web.Constants;
|
||||||
using Insight.Web.Models;
|
using Insight.Web.Models;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using Vaitr.Bus;
|
using Vaitr.MemoryBus;
|
||||||
|
|
||||||
namespace Insight.Web.Services;
|
namespace Insight.Web.Services;
|
||||||
|
|
||||||
|
|
@ -9,10 +9,10 @@ public class SessionPool
|
||||||
{
|
{
|
||||||
public readonly ConcurrentDictionary<string, SessionState> Sessions = new();
|
public readonly ConcurrentDictionary<string, SessionState> Sessions = new();
|
||||||
|
|
||||||
private readonly Bus _bus;
|
private readonly IMemoryBus _bus;
|
||||||
private readonly ILogger<SessionPool> _logger;
|
private readonly ILogger<SessionPool> _logger;
|
||||||
|
|
||||||
public SessionPool(Bus bus, ILogger<SessionPool> logger)
|
public SessionPool(IMemoryBus bus, ILogger<SessionPool> logger)
|
||||||
{
|
{
|
||||||
_bus = bus;
|
_bus = bus;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"Urls": "http://127.0.0.1:5001",
|
"Urls": "http://127.0.0.1:5001",
|
||||||
"database": "mongodb://db.insight.local:27017",
|
"database": "mongodb://10.22.70.40:32768",
|
||||||
"database0": "mongodb://insight.webmatic.de:27017",
|
"database0": "mongodb://insight.webmatic.de:27017",
|
||||||
"server.host": "insight.local",
|
"server.host": "insight.local",
|
||||||
"server.port": 3001
|
"server.port": 3001
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue