![]() |
VOOZH | about |
dotnet add package Orion.Network.Core --version 0.30.1
NuGet\Install-Package Orion.Network.Core -Version 0.30.1
<PackageReference Include="Orion.Network.Core" Version="0.30.1" />
<PackageVersion Include="Orion.Network.Core" Version="0.30.1" />Directory.Packages.props
<PackageReference Include="Orion.Network.Core" />Project file
paket add Orion.Network.Core --version 0.30.1
#r "nuget: Orion.Network.Core, 0.30.1"
#:package Orion.Network.Core@0.30.1
#addin nuget:?package=Orion.Network.Core&version=0.30.1Install as a Cake Addin
#tool nuget:?package=Orion.Network.Core&version=0.30.1Install as a Cake Tool
👁 NuGet Version
👁 License
👁 .NET
Networking abstractions for the Orion IRC Server project.
IRC is not dead, long live IRC!
Orion.Network.Core provides the foundational networking abstraction layer for Orion IRC Server. This library offers a transport-agnostic approach to network communication, allowing the IRC server to work with different transport mechanisms (TCP, WebSockets, etc.) through a unified interface.
dotnet add package Orion.Network.Core
Or using the Package Manager Console:
Install-Package Orion.Network.Core
Orion.Network.Core defines a transport system through the INetworkTransport interface, allowing different implementations to provide network connectivity:
public interface INetworkTransport
{
event ClientConnectedHandler ClientConnected;
event ClientDisconnectedHandler ClientDisconnected;
event MessageReceivedHandler MessageReceived;
string Id { get; }
string Name { get; }
NetworkProtocolType Protocol { get; }
NetworkSecurityType Security { get; }
ServerNetworkType ServerNetworkType { get; }
string IpAddress { get; }
int Port { get; }
Task StartAsync();
Task StopAsync();
Task SendAsync(string sessionId, byte[] message, CancellationToken cancellationToken = default);
bool HaveSession(string sessionId);
}
using Orion.Network.Core.Interfaces.Services;
using Orion.Network.Core.Data;
using System.Text;
public class NetworkExample
{
private readonly INetworkTransportManager _transportManager;
public NetworkExample(INetworkTransportManager transportManager)
{
_transportManager = transportManager;
// Subscribe to incoming messages
_transportManager.IncomingMessages.Subscribe(HandleIncomingMessage);
// Handle connection events
_transportManager.ClientConnected += OnClientConnected;
_transportManager.ClientDisconnected += OnClientDisconnected;
}
private void OnClientConnected(string transportId, string sessionId, string endpoint)
{
Console.WriteLine($"Client connected: {sessionId} from {endpoint} via {transportId}");
}
private void OnClientDisconnected(string transportId, string sessionId, string endpoint)
{
Console.WriteLine($"Client disconnected: {sessionId} from {endpoint} via {transportId}");
}
private async Task HandleIncomingMessage(NetworkMessageData message)
{
Console.WriteLine($"Message from {message.SessionId}: {message.Message}");
// Send a response
await _transportManager.EnqueueMessageAsync(
new NetworkMessageData(message.SessionId, "Echo: " + message.Message, message.ServerNetworkType)
);
}
}
using Orion.Core.Types;
using Orion.Network.Core.Interfaces.Transports;
using Orion.Network.Core.Types;
public class MyCustomTransport : INetworkTransport
{
public event INetworkTransport.ClientConnectedHandler ClientConnected;
public event INetworkTransport.ClientDisconnectedHandler ClientDisconnected;
public event INetworkTransport.MessageReceivedHandler MessageReceived;
public string Id { get; } = Guid.NewGuid().ToString();
public string Name { get; } = "MyCustomTransport";
public NetworkProtocolType Protocol => NetworkProtocolType.Custom;
public NetworkSecurityType Security => NetworkSecurityType.None;
public ServerNetworkType ServerNetworkType { get; }
public string IpAddress { get; }
public int Port { get; }
private readonly Dictionary<string, MyClient> _clients = new();
public MyCustomTransport(ServerNetworkType serverNetworkType, string ipAddress, int port)
{
ServerNetworkType = serverNetworkType;
IpAddress = ipAddress;
Port = port;
}
public Task StartAsync()
{
// Initialize transport
return Task.CompletedTask;
}
public Task StopAsync()
{
// Shutdown transport
return Task.CompletedTask;
}
public Task SendAsync(string sessionId, byte[] message, CancellationToken cancellationToken = default)
{
if (_clients.TryGetValue(sessionId, out var client))
{
return client.SendAsync(message);
}
throw new InvalidOperationException($"Session {sessionId} not found.");
}
public bool HaveSession(string sessionId)
{
return _clients.ContainsKey(sessionId);
}
// Helper class for the example
private class MyClient
{
public Task SendAsync(byte[] message) => Task.CompletedTask;
}
}
using Orion.Network.Core.Parsers;
// Parse messages from byte buffer
byte[] buffer = Encoding.UTF8.GetBytes("NICK user1\r\nUSER user1 0 * :Real Name\r\n");
var messages = NewLineMessageParser.ParseMessages(buffer);
foreach (var message in messages)
{
Console.WriteLine($"Parsed message: {message}");
}
This project is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on Orion.Network.Core:
| Package | Downloads |
|---|---|
|
Orion.Network.Tcp
TCP implementation for Orion IRC Server networking |
|
|
Orion.Core.Server
Server-side core functionality for Orion IRC Server |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.30.1 | 439 | 5/15/2025 |
| 0.30.0 | 327 | 5/13/2025 |
| 0.29.0 | 350 | 5/12/2025 |
| 0.28.4 | 321 | 5/12/2025 |
| 0.28.3 | 320 | 5/12/2025 |
| 0.28.2 | 352 | 5/12/2025 |
| 0.28.1 | 254 | 5/11/2025 |
| 0.28.0 | 165 | 5/10/2025 |
| 0.27.1 | 276 | 5/8/2025 |
| 0.27.0 | 266 | 5/8/2025 |
| 0.26.0 | 264 | 5/8/2025 |
| 0.25.2 | 268 | 5/8/2025 |
| 0.25.1 | 253 | 5/8/2025 |
| 0.25.0 | 256 | 5/8/2025 |
| 0.24.0 | 269 | 5/6/2025 |
| 0.23.0 | 253 | 5/6/2025 |
| 0.22.3 | 235 | 5/6/2025 |
| 0.22.2 | 252 | 5/5/2025 |
| 0.22.0 | 217 | 5/2/2025 |
| 0.21.0 | 225 | 5/2/2025 |