RCON server for ASP.NET Core
$ dotnet add package Rcon.AspNetCore.ServerRcon.AspNetCore.Server is a library for building RCON (Remote Console) servers on ASP.NET Core, featuring authentication, command processing, and efficient buffer serialization.
ConnectionHandlerIBufferWriter<T>using Microsoft.AspNetCore.Connections;
using Microsoft.Extensions.Logging;
using Rcon.AspNetCore.Server;
// Implement your custom RCON server logic
public class MyRconServer : IRconServer
{
public string Password => "my_secret_password";
public Task<string> ExecuteAsync(string command, CancellationToken cancellationToken)
{
// Your command processing logic (e.g. game server management)
return Task.FromResult($"Executed: {command}");
}
}
// Register the handler and configure Kestrel in your Startup/Program.cs
builder.Services
.AddSingleton<IRconServer, MyRconServer>();
builder.WebHost
.ConfigureKestrel(options => options
.ListenAnyIP(1234, v => v.UseConnectionHandler<RconConnectionHandler>()));
Handles connections according to the RCON protocol:
IRconServerEnum representing RCON packet types:
AuthRequest — Authentication requestAuthResponse — Authentication responseCommandRequest — Command execution requestCommandResponse — Command responseInterface for user-provided authentication and command handling:
public interface IRconServer
{
string Password { get; }
Task<string> ExecuteAsync(string command, CancellationToken cancellationToken);
}
Utilities for efficient serialization/deserialization of primitives and strings into buffers, optimized for network protocol handling.
AuthRequest)CommandRequest)CommandResponse)You can use ARRCON or other Source RCON-compatible tools for testing.
For integration testing, the project uses the external RCON client ARRCON, licensed under GNU GPLv3.
It is not included with the library and is used only as a separate CLI tool during test execution.
MIT
Rcon.AspNetCore.Server is a lightweight foundation for integrating RCON into your .NET servers and game projects.