Rcon.AspNetCore.Server is a library for building RCON (Remote Console) servers on ASP.NET Core, featuring authentication, command processing, and efficient buffer serialization.
- Asynchronous RCON connection handling based on
ConnectionHandler - Client authentication and command execution via a user-provided handler
- Full support for the standard Source RCON protocol
- Flexible packet serialization/deserialization (Little Endian, UTF-8)
- Efficient buffer operations via Span/Memory and
IBufferWriter<T> - Easy integration with ASP.NET Core logging
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:
- Reads and parses packets
- Authenticates clients
- Invokes commands via
IRconServer - Builds and sends responses
Enum representing RCON packet types:
AuthRequest— Authentication requestAuthResponse— Authentication responseCommandRequest— Command execution requestCommandResponse— Command response
Interface 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.
- Client connects to the server via TCP/QUIC (e.g., through Kestrel)
- Sends an authentication packet (
AuthRequest) - Upon successful authentication, client can send commands (
CommandRequest) - Server responds with results (
CommandResponse) - All packets use Little Endian byte order and UTF-8 for strings
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.
- .NET 8.0 or later
- ASP.NET Core (Kestrel)
MIT
Rcon.AspNetCore.Server is a lightweight foundation for integrating RCON into your .NET servers and game projects.