VOOZH about

URL: https://www.nuget.org/packages/Orion.Network.Core/

⇱ NuGet Gallery | Orion.Network.Core 0.30.1




👁 Image
Orion.Network.Core 0.30.1

dotnet add package Orion.Network.Core --version 0.30.1
 
 
NuGet\Install-Package Orion.Network.Core -Version 0.30.1
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Orion.Network.Core" Version="0.30.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Orion.Network.Core" Version="0.30.1" />
 
Directory.Packages.props
<PackageReference Include="Orion.Network.Core" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Orion.Network.Core --version 0.30.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Orion.Network.Core, 0.30.1"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Orion.Network.Core@0.30.1
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Orion.Network.Core&version=0.30.1
 
Install as a Cake Addin
#tool nuget:?package=Orion.Network.Core&version=0.30.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Orion.Network.Core

👁 NuGet Version
👁 License
👁 .NET

Networking abstractions for the Orion IRC Server project.

IRC is not dead, long live IRC!

About

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.

Installation

dotnet add package Orion.Network.Core

Or using the Package Manager Console:

Install-Package Orion.Network.Core

Key Features

  • Transport Abstraction: Interface-based design for network transports
  • Message Handling: Unified message reception and dispatch
  • Connection Management: Client connection tracking and lifecycle
  • Reactive Design: Event-based communication using System.Reactive
  • Protocol-Independent: Works with various network protocols
  • Network Data Types: Strong typing for network messages and structures
  • Message Parsers: Tools for parsing and processing network messages

Transport System

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);
}

Examples

Working with the Transport Manager

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)
 );
 }
}

Implementing a Custom Transport

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 the Message Parser

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}");
}

Dependencies

  • Orion.Core: Core utilities and extensions
  • Orion.Irc.Core: IRC protocol implementation
  • System.Reactive: Reactive programming support
  • Microsoft.Extensions.Logging.Abstractions: Logging infrastructure

Related Packages

  • Orion.Network.Tcp: TCP implementation for network transports
  • Orion.Core.Server: Server-side core functionality

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project Links

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

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

GitHub repositories

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
Loading failed