diff --git a/src/Argon.Api/Argon.Api.csproj b/src/Argon.Api/Argon.Api.csproj
index d8864895..75fab0df 100644
--- a/src/Argon.Api/Argon.Api.csproj
+++ b/src/Argon.Api/Argon.Api.csproj
@@ -18,20 +18,20 @@
-
+
-
-
-
-
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
@@ -59,7 +59,7 @@
-
+
diff --git a/src/Argon.Api/Features/Rpc/RpcServiceCollectionExtensions.cs b/src/Argon.Api/Features/Rpc/RpcServiceCollectionExtensions.cs
index fb77309a..b0408d37 100644
--- a/src/Argon.Api/Features/Rpc/RpcServiceCollectionExtensions.cs
+++ b/src/Argon.Api/Features/Rpc/RpcServiceCollectionExtensions.cs
@@ -2,6 +2,15 @@ namespace Argon.Services;
public static class RpcServiceCollectionExtensions
{
+ public static void MapArgonTransport(this WebApplication app)
+ {
+ app.MapGrpcService().EnableGrpcWeb();
+ app.UseGrpcWeb(new GrpcWebOptions
+ {
+ DefaultEnabled = true
+ });
+ }
+
public static void AddArgonTransport(this WebApplicationBuilder builder, Action onRegistration)
{
var col = builder.Services;
diff --git a/src/Argon.Api/GlobalUsings.cs b/src/Argon.Api/GlobalUsings.cs
index 4894ca90..2bce9c28 100644
--- a/src/Argon.Api/GlobalUsings.cs
+++ b/src/Argon.Api/GlobalUsings.cs
@@ -1,7 +1,24 @@
// Global using directives
+global using System.Collections.Concurrent;
+global using System.ComponentModel;
+global using System.Reflection;
global using System.Runtime.Serialization;
global using System.Security.Cryptography;
global using System.Text;
+global using ActualLab.Collections;
+global using ActualLab.Text;
+global using Argon;
+global using Argon.ArchetypeModel;
+global using Argon.Entities;
+global using Argon.Extensions;
+global using Argon.Features;
+global using Argon.Grains.Interfaces;
+global using Argon.Streaming;
+global using Argon.Streaming.Events;
+global using Argon.Users;
global using MemoryPack;
-global using MessagePack;
\ No newline at end of file
+global using MessagePack;
+global using Microsoft.AspNetCore.Authorization;
+global using Microsoft.EntityFrameworkCore;
+global using Microsoft.Extensions.Options;
\ No newline at end of file
diff --git a/src/Argon.Api/GlobalVersion.cs b/src/Argon.Api/GlobalVersion.cs
index cdc7d636..53f07ea6 100644
--- a/src/Argon.Api/GlobalVersion.cs
+++ b/src/Argon.Api/GlobalVersion.cs
@@ -1,4 +1,4 @@
-namespace Argon.Api;
+namespace Argon;
public static class GlobalVersion
{
diff --git a/src/Argon.Api/Program.cs b/src/Argon.Api/Program.cs
index 7b664c44..43adce6f 100644
--- a/src/Argon.Api/Program.cs
+++ b/src/Argon.Api/Program.cs
@@ -1,30 +1,29 @@
-using ActualLab.Fusion;
-using ActualLab.Rpc;
-using ActualLab.Rpc.Server;
-using Argon.Api;
-using Argon.Api.Entities;
-using Argon.Api.Extensions;
-using Argon.Api.Features;
-using Argon.Api.Features.Captcha;
-using Argon.Api.Features.EF;
-using Argon.Api.Features.Env;
-using Argon.Api.Features.Jwt;
-using Argon.Api.Features.MediaStorage;
-using Argon.Api.Features.OrleansStreamingProviders;
-using Argon.Api.Features.Otp;
-using Argon.Api.Features.Pex;
-using Argon.Api.Features.Repositories;
-using Argon.Api.Features.Template;
-using Argon.Api.Grains.Interfaces;
-using Argon.Api.Migrations;
-using Argon.Api.Services;
-using Argon.Api.Services.Fusion;
-using Argon.Contracts;
+using Argon.Features.Captcha;
+using Argon.Features.EF;
+using Argon.Features.Env;
+using Argon.Features.Jwt;
+using Argon.Features.MediaStorage;
+using Argon.Features.OrleansStreamingProviders;
+using Argon.Features.Otp;
+using Argon.Features.Pex;
+using Argon.Features.Repositories;
+using Argon.Features.Template;
+using Argon.Migrations;
+using Argon.Services;
using Argon.Sfu;
-using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Converters;
var builder = WebApplication.CreateBuilder(args);
+
+builder.WebHost.ConfigureKestrel(options => {
+ options.Limits.KeepAliveTimeout = TimeSpan.FromSeconds(400);
+ options.AddServerHeader = false;
+ options.Limits.Http2.MaxStreamsPerConnection = 100;
+ options.Limits.Http2.InitialConnectionWindowSize = 65535;
+ options.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(30);
+ options.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(10);
+});
+
builder.AddSentry(builder.Configuration.GetConnectionString("Sentry"));
builder.Services.Configure(builder.Configuration.GetSection("Smtp"));
builder.AddServiceDefaults();
@@ -32,7 +31,9 @@
builder.AddRedisClient("cache");
builder.AddNatsStreaming();
builder.Services.AddDbContext(x => x
- .EnableDetailedErrors().EnableSensitiveDataLogging().UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection"))
+ .EnableDetailedErrors()
+ .EnableSensitiveDataLogging()
+ .UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection"))
.AddInterceptors(new TimeStampAndSoftDeleteInterceptor()));
builder.Services.AddSingleton();
@@ -51,27 +52,26 @@
z.AllowAnyMethod();
});
});
- builder.Services.AddFusion(RpcServiceMode.Server, true).Rpc
- .AddWebSocketServer(true).Rpc
- .AddServer()
- .AddServer()
- .AddServer()
- .AddServer();
builder.AddSwaggerWithAuthHeader();
builder.Services.AddAuthorization();
- builder.AddContentDeliveryNetwork();
+ builder.AddArgonTransport(x =>
+ {
+ x.AddService();
+ x.AddService();
+ x.AddService();
+ });
}
-
+builder.AddContentDeliveryNetwork();
builder.AddArgonPermissions();
builder.AddSelectiveForwardingUnit();
builder.Services.AddTransient();
-builder.Services.AddSingleton();
builder.AddOtpCodes();
builder.AddOrleans();
builder.AddTemplateEngine();
builder.AddEfRepositories();
builder.AddKubeResources();
builder.AddCaptchaFeature();
+builder.Services.AddSignalR();
builder.Services.AddDataProtection();
var app = builder.Build();
@@ -81,11 +81,10 @@
app.UseAuthentication();
app.UseAuthorization();
app.UseWebSockets();
- app.MapRpcWebSocketServer();
app.UseSwagger();
app.UseSwaggerUI();
- app.UseHttpsRedirection();
app.MapControllers();
+ app.MapArgonTransport();
}
app.MapDefaultEndpoints();
diff --git a/src/Argon.Contracts/Argon.Shared.csproj b/src/Argon.Contracts/Argon.Shared.csproj
index 8a34aa36..66707357 100644
--- a/src/Argon.Contracts/Argon.Shared.csproj
+++ b/src/Argon.Contracts/Argon.Shared.csproj
@@ -1,30 +1,30 @@
-
+
net8.0
enable
enable
-
-
-
+
+
+
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/Argon.Entry/GlobalUsings.cs b/src/Argon.Entry/GlobalUsings.cs
new file mode 100644
index 00000000..fd0c46ac
--- /dev/null
+++ b/src/Argon.Entry/GlobalUsings.cs
@@ -0,0 +1,3 @@
+// Global using directives
+
+global using ActualLab.Serialization;
\ No newline at end of file
diff --git a/src/Argon.Entry/Program.cs b/src/Argon.Entry/Program.cs
index 62703174..2aa9495d 100644
--- a/src/Argon.Entry/Program.cs
+++ b/src/Argon.Entry/Program.cs
@@ -1,16 +1,10 @@
-using ActualLab.Fusion;
-using ActualLab.Rpc;
-using ActualLab.Rpc.Server;
-using ActualLab.Serialization;
-using Argon.Api;
-using Argon.Api.Controllers;
-using Argon.Api.Entities;
-using Argon.Api.Extensions;
-using Argon.Api.Features.Jwt;
-using Argon.Api.Features.Pex;
-using Argon.Api.Services;
-using Argon.Api.Services.Fusion;
-using Argon.Contracts;
+using Argon;
+using Argon.Controllers;
+using Argon.Extensions;
+using Argon.Features.Jwt;
+using Argon.Features.MediaStorage;
+using Argon.Services;
+using Argon.Streaming;
using Newtonsoft.Json.Converters;
using Orleans.Clustering.Kubernetes;
using Orleans.Configuration;
@@ -27,12 +21,11 @@
options.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(30);
options.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(10);
});
-
-builder.AddArgonPermissions();
+builder.AddContentDeliveryNetwork();
builder.AddServiceDefaults();
builder.AddJwt();
builder.Services.AddControllers()
- .AddApplicationPart(typeof(AuthorizationController).Assembly)
+ .AddApplicationPart(typeof(FilesController).Assembly)
.AddNewtonsoftJson(x => x.SerializerSettings.Converters.Add(new StringEnumConverter()));
builder.Services.AddCors(x =>
{
@@ -43,29 +36,29 @@
z.AllowAnyMethod();
});
});
-builder.Services.AddFusion(RpcServiceMode.Server, true)
- .Rpc.AddWebSocketServer(true).Rpc
- .AddServer()
- .AddServer()
- .AddServer()
- .AddServer();
builder.AddSwaggerWithAuthHeader();
builder.Services.AddSerializer(x => x.AddMessagePackSerializer(null, null, MessagePackByteSerializer.Default.Options))
.AddOrleansClient(x =>
{
- x.Configure(builder.Configuration.GetSection("Orleans")).AddStreaming();
+ x.Configure(builder.Configuration.GetSection("Orleans"))
+ .AddStreaming()
+ .AddBroadcastChannel(IArgonEvent.Broadcast);
if (builder.Environment.IsProduction())
x.UseKubeGatewayListProvider();
else
x.UseLocalhostClustering();
});
+builder.AddArgonTransport(x =>
+{
+ x.AddService();
+ x.AddService();
+ x.AddService();
+});
builder.Services.AddAuthorization();
-builder.Services.AddSingleton();
var app = builder.Build();
app.UseCors();
app.UseWebSockets();
-app.MapRpcWebSocketServer();
app.UseSwagger();
app.UseSwaggerUI();
app.UseHttpsRedirection();
@@ -73,6 +66,7 @@
app.UseAuthorization();
app.MapControllers();
app.MapDefaultEndpoints();
+app.MapArgonTransport();
app.MapGet("/", () => new
{