Skip to content
/ orion Public

Orion: A modern, multi-transport IRC server implemented in C#. Features secure connections via TCP, SSL/TLS, and WebSockets with a modular architecture.

License

Notifications You must be signed in to change notification settings

tgiachi/orion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Orion IRC Server

Version License .NET

IRC is not dead, long live IRC!

Orion Logo

Orion (Orione in italiano) is my cat and this project is dedicated to him.

Docker Image

Orion is a modern, scalable IRC server built with .NET 9.0, designed to provide robust functionality while maintaining performance and flexibility.

🌟 Features

  • πŸ”’ Secure connections with SSL/TLS support
  • 🌐 IPv4 and IPv6 support
  • πŸ› οΈ Completely modular and extensible architecture
  • πŸ“ Scripting support via JavaScript engine (Jint)
  • πŸ“Š Performance metrics and diagnostics
  • πŸ“œ Text templating with Scriban
  • 🧩 Plugin system
  • 🐳 Docker support
  • πŸŒ‰ Planning to create bridges for Discord, Matrix, and other platforms

πŸ“‹ Project Structure

Orion is built as a collection of modular components:

  • Orion.Core: Base utilities, extensions and common functionality
  • Orion.Core.Server: Server-side core functionality
  • Orion.Core.Server.Web: Web API and HTTP interface
  • Orion.Irc.Core: IRC protocol implementation
  • Orion.Network.Core: Networking abstractions
  • Orion.Network.Tcp: TCP implementation for network transports
  • Orion.Server: Main application entry point

πŸ”§ Configuration

Orion uses YAML for configuration. On first run, a default configuration file is created at the specified path. Key configuration sections include:

# Server identification
server:
  id: auto-generated
  host: irc.orion.io
  network: OrionNet
  description: Orion IRC server
  admin:
    name: Orion Admin
    email: [email protected]
    nickname: OrionAdmin

# Network settings
network:
  ssl:
    certificate_path: path/to/certificate
    password: certificate_password
  binds:
    - host: 0.0.0.0
      ports: 6660-6669,6670
      network_type: clients
      secure: false
      use_web_socket: false

# Web HTTP API
web_http:
  is_enabled: true
  listen_address: 0.0.0.0
  listen_port: 23021
  jwt_auth:
    issuer: Orion
    audience: Orion
    expiration_in_minutes: 44640  # 31 days
    refresh_token_expiry_days: 1

πŸš€ Getting Started

Prerequisites

  • .NET 9.0 SDK
  • SSL certificate (optional, for secure connections)

Installation

  1. Clone the repository:
    git clone https://github.com/tgiachi/orion.git
    cd orion

Docker

You can run Orion using Docker:

docker pull tgiachi/orionirc-server
docker run -p 6667:6667 -p 23021:23021 tgiachi/orionirc-server
  1. Build the solution:

    dotnet build
  2. Run the server:

    dotnet run --project src/Orion.Server

Command Line Options

-c, --config           Path to configuration file (default: orion.yml)
-r, --root-directory   Root directory for the server
-s, --show-header      Show header in console (default: true)
-l, --log-level        Log level (Trace, Debug, Information, Warning, Error)
-v, --verbose          Enable verbose output

πŸ“ Scripting

Orion includes a JavaScript engine that allows you to extend functionality through scripts. Scripts are stored in the scripts directory and can use the modules registered with the server.

Example:

// Access the logger module
logger.info("Server is running!");

// Define event handlers
function onStarted() {
    logger.info("Server has started successfully");
    // Custom initialization code here
}

The script engine automatically generates TypeScript definitions (index.d.ts) to provide code completion and documentation for available modules and functions.

πŸ‘· Development

Adding New IRC Commands

To implement a new IRC command:

  1. Create a class that inherits from BaseIrcCommand
  2. Implement the Parse and Write methods
  3. Register the command with the IrcCommandParser service

Example:

public class MyCommand : BaseIrcCommand
{
    public MyCommand() : base("MYCMD") { }

    public override void Parse(string line)
    {
        // Parse command logic
    }

    public override string Write()
    {
        // Serialize command logic
        return $"MYCMD :parameters";
    }
}

Creating Command Handlers

To handle IRC commands:

  1. Create a class that inherits from BaseIrcCommandListener
  2. Implement the IIrcCommandHandler<T> interface
  3. Register the handler for specific server network types

Example:

public class MyCommandHandler : BaseIrcCommandListener, IIrcCommandHandler<MyCommand>
{
    public MyCommandHandler(
        ILogger<BaseIrcCommandListener> logger,
        IIrcCommandService ircCommandService,
        IHyperPostmanService postmanService,
        IIrcSessionService sessionService
    ) : base(logger, ircCommandService, postmanService, sessionService)
    {
        RegisterCommandHandler<MyCommand>(this, ServerNetworkType.Clients);
    }

    public async Task OnCommandReceivedAsync(
        IrcUserSession session,
        ServerNetworkType serverNetworkType,
        MyCommand command
    )
    {
        // Handle the command
    }
}

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

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

πŸ“¬ Contact

Project Link: https://github.com/tgiachi/orion

About

Orion: A modern, multi-transport IRC server implemented in C#. Features secure connections via TCP, SSL/TLS, and WebSockets with a modular architecture.

Topics

Resources

License

Stars

Watchers

Forks

Packages