mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
feat: Add IRC gateway functionality and update documentation
This commit is contained in:
@@ -5,5 +5,5 @@ Articles related to the EchoHub.Core shared library.
|
||||
## Topics
|
||||
|
||||
- Data models and DTOs
|
||||
- SignalR contract interface
|
||||
- Contract interfaces (IChatService, IChatBroadcaster, IEchoHubClient)
|
||||
- Validation constants and shared rules
|
||||
|
||||
+6
-2
@@ -10,8 +10,12 @@ Terminal.Gui v2 TUI application -- UI components, services, themes, and configur
|
||||
|
||||
### Core
|
||||
|
||||
Shared library -- DTOs, models, constants, and the SignalR client contract.
|
||||
Shared library -- DTOs, models, constants, and contracts (`IChatService`, `IChatBroadcaster`, `IEchoHubClient`).
|
||||
|
||||
### Server
|
||||
|
||||
ASP.NET Core server -- controllers, hubs, authentication, and data access.
|
||||
ASP.NET Core server -- controllers, hubs, ChatService, SignalRBroadcaster, authentication, and data access.
|
||||
|
||||
### Server.Irc
|
||||
|
||||
IRC protocol gateway -- TCP listener, command handler, IrcBroadcaster, and message formatter.
|
||||
|
||||
@@ -6,6 +6,8 @@ Articles related to the EchoHub server built with ASP.NET Core.
|
||||
|
||||
- Authentication and JWT tokens
|
||||
- SignalR hub and real-time messaging
|
||||
- IRC gateway and protocol bridging
|
||||
- ChatService and broadcaster pattern
|
||||
- File upload and validation
|
||||
- Rate limiting configuration
|
||||
- Database schema and migrations
|
||||
|
||||
@@ -16,3 +16,7 @@
|
||||
href: ../_api_meta/server/toc.yml
|
||||
- name: Articles
|
||||
href: server-articles/
|
||||
- name: Server.Irc
|
||||
items:
|
||||
- name: API Reference
|
||||
href: ../_api_meta/server-irc/toc.yml
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
|
||||
EchoHub follows a decentralized model where each server is fully independent. There is no central authority or account federation. Users create one account per server.
|
||||
|
||||
The server exposes two protocol interfaces to the same chat backend:
|
||||
|
||||
```text
|
||||
IRC Client ──► TCP :6667 ──► IrcGateway ──┐
|
||||
├──► ChatService ──► DB + PresenceTracker
|
||||
TUI Client ──► WebSocket ──► ChatHub ─────┘
|
||||
```
|
||||
|
||||
Both protocols call into a shared `IChatService` for business logic. Events fan out to all registered `IChatBroadcaster` implementations (SignalR and IRC).
|
||||
|
||||
## Components
|
||||
|
||||
### EchoHub.Core
|
||||
@@ -12,7 +22,7 @@ Shared library containing:
|
||||
|
||||
- **Models**: `User`, `Channel`, `Message`, `RefreshToken`
|
||||
- **DTOs**: Record types for API requests/responses
|
||||
- **Contracts**: `IEchoHubClient` -- the strongly-typed SignalR client interface
|
||||
- **Contracts**: `IChatService` (protocol-agnostic chat operations), `IChatBroadcaster` (event fan-out interface), `IEchoHubClient` (SignalR client interface)
|
||||
- **Constants**: `ValidationConstants` (shared regex patterns), `HubConstants`
|
||||
|
||||
### EchoHub.Server
|
||||
@@ -20,10 +30,21 @@ Shared library containing:
|
||||
ASP.NET Core web application:
|
||||
|
||||
- **Controllers**: REST API endpoints for auth, channels, users, files, server info
|
||||
- **Hubs**: SignalR `ChatHub` for real-time messaging
|
||||
- **Hubs**: SignalR `ChatHub` -- thin adapter delegating to `IChatService`
|
||||
- **Auth**: JWT token service (15-min access tokens, 30-day refresh tokens)
|
||||
- **Data**: EF Core with SQLite
|
||||
- **Services**: Presence tracking, file storage, image-to-ASCII conversion
|
||||
- **Services**: `ChatService` (core business logic), `SignalRBroadcaster`, presence tracking, file storage, image-to-ASCII conversion
|
||||
|
||||
### EchoHub.Server.Irc
|
||||
|
||||
IRC protocol gateway (separate project for clean separation of concerns):
|
||||
|
||||
- **IrcGatewayService**: `BackgroundService` with TCP listener on configured port(s), optional TLS
|
||||
- **IrcCommandHandler**: Per-client IRC command dispatch -- handles `CAP`/`SASL`, `NICK`/`USER`/`PASS`, `JOIN`/`PART`/`PRIVMSG`/`QUIT`, `NAMES`/`TOPIC`/`WHO`/`WHOIS`/`AWAY`/`LIST`/`MODE`/`MOTD`
|
||||
- **IrcBroadcaster**: `IChatBroadcaster` implementation that formats chat events as IRC protocol lines, with echo suppression (IRC convention)
|
||||
- **IrcMessageFormatter**: Converts `MessageDto` to IRC `PRIVMSG` lines -- splits long text at word boundaries (~400 byte chunks), sends images as ASCII art line-by-line
|
||||
|
||||
IRC users authenticate with existing EchoHub accounts via `PASS`/`NICK`/`USER` or SASL PLAIN (BCrypt verification against the database).
|
||||
|
||||
### EchoHub.Client
|
||||
|
||||
@@ -31,11 +52,22 @@ Terminal.Gui v2 TUI application:
|
||||
|
||||
- **UI**: Main window, dialogs, chat renderer with ANSI color support
|
||||
- **Services**: API client with automatic token refresh, SignalR connection wrapper
|
||||
- **Themes**: 6 built-in color themes
|
||||
- **Themes**: 13 built-in color themes
|
||||
- **Config**: Client configuration management
|
||||
|
||||
## Communication
|
||||
|
||||
- REST API for authentication, profile management, channel CRUD, file uploads
|
||||
- SignalR WebSocket for real-time messaging and presence updates
|
||||
- **REST API** for authentication, profile management, channel CRUD, file uploads
|
||||
- **SignalR WebSocket** for real-time messaging and presence updates (TUI client)
|
||||
- **IRC TCP** for real-time messaging via standard IRC protocol (IRC clients)
|
||||
- JWT tokens passed via query string for SignalR authentication
|
||||
- IRC authentication via PASS/SASL PLAIN against BCrypt password hashes
|
||||
|
||||
## Broadcaster Pattern
|
||||
|
||||
The `IChatBroadcaster` interface allows multiple protocols to receive chat events:
|
||||
|
||||
- **SignalRBroadcaster**: Wraps `IHubContext<ChatHub>`, filters out IRC connections
|
||||
- **IrcBroadcaster**: Iterates live IRC connections in a channel, formats events as IRC protocol lines
|
||||
|
||||
Both are registered in DI and called by `ChatService` when events occur. This means a message sent from an IRC client appears in the TUI client, and vice versa.
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
- [.NET 10 SDK](https://dotnet.microsoft.com/download)
|
||||
|
||||
Or grab a self-contained binary from [Releases](https://github.com/HueByte/EchoHub/releases) -- no runtime needed.
|
||||
|
||||
## Run the Server
|
||||
|
||||
```bash
|
||||
@@ -24,6 +26,37 @@ dotnet run --project src/EchoHub.Client
|
||||
|
||||
Connect to a server, register an account, and start chatting.
|
||||
|
||||
## Connect via IRC
|
||||
|
||||
Enable the IRC gateway in the server's `appsettings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"Irc": {
|
||||
"Enabled": true,
|
||||
"Port": 6667
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then connect with any standard IRC client:
|
||||
|
||||
```bash
|
||||
irssi -c localhost -p 6667 -w <password> -n <username>
|
||||
```
|
||||
|
||||
IRC users must have an existing EchoHub account. Authentication works via `PASS`/`NICK`/`USER` or SASL PLAIN. Messages flow bidirectionally between IRC and TUI clients.
|
||||
|
||||
For TLS, set `TlsEnabled: true`, `TlsPort: 6697`, and provide a PKCS#12 certificate path.
|
||||
|
||||
See the [Architecture](architecture.md) page for details on how the IRC gateway integrates with the chat service.
|
||||
|
||||
## Configuration
|
||||
|
||||
Server configuration is in `appsettings.json` (auto-generated on first run). See the [example config](https://github.com/HueByte/EchoHub/blob/master/src/EchoHub.Server/appsettings.example.json) for all available options.
|
||||
|
||||
To list your server on the [public directory](https://echohub.voidcube.cloud/servers), set `Server:PublicServer` to `true` and `Server:PublicHost` to your server's public address.
|
||||
|
||||
## Build from Source
|
||||
|
||||
```bash
|
||||
|
||||
@@ -4,5 +4,6 @@ Release history for EchoHub.
|
||||
|
||||
## Releases
|
||||
|
||||
- [v0.2.0](v0.2.0.md) - IRC Gateway
|
||||
- [v0.1.1](v0.1.1.md) - Directory Connection Self-Healing
|
||||
- [v0.1.0](v0.1.0.md) - Initial Release
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
- name: Overview
|
||||
href: index.md
|
||||
- name: v0.2.0
|
||||
href: v0.2.0.md
|
||||
- name: v0.1.1
|
||||
href: v0.1.1.md
|
||||
- name: v0.1.0
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# v0.2.0 - IRC Gateway
|
||||
|
||||
## Features
|
||||
|
||||
- **IRC protocol gateway** -- native IRC clients (irssi, WeeChat, HexChat, etc.) can connect to EchoHub servers
|
||||
- **Cross-protocol messaging** -- messages flow bidirectionally between IRC and TUI clients in real time
|
||||
- **SASL PLAIN authentication** -- IRC clients can authenticate via SASL or traditional PASS/NICK/USER
|
||||
- **Full IRC command support** -- JOIN, PART, PRIVMSG, QUIT, NAMES, TOPIC, WHO, WHOIS, AWAY, LIST, MODE, MOTD
|
||||
- **TLS support** -- optional encrypted IRC connections on port 6697
|
||||
- **Image-to-IRC formatting** -- images appear as ASCII art line-by-line with download URLs
|
||||
- **Message splitting** -- long messages automatically split at word boundaries (~400 byte chunks)
|
||||
- **Configurable MOTD** -- server message of the day for IRC clients
|
||||
|
||||
## Architecture Changes
|
||||
|
||||
- Extracted shared business logic from `ChatHub` into protocol-agnostic `IChatService`
|
||||
- Introduced `IChatBroadcaster` pattern for multi-protocol event fan-out
|
||||
- `ChatHub` refactored to thin adapter delegating to `IChatService`
|
||||
- `ChannelsController` updated to use `IChatService` for broadcasts
|
||||
- New `EchoHub.Server.Irc` project for clean separation of concerns
|
||||
- `IChatService` and `IChatBroadcaster` interfaces live in `EchoHub.Core/Contracts`
|
||||
@@ -30,6 +30,16 @@
|
||||
],
|
||||
"dest": "_api_meta/client",
|
||||
"filter": "filterConfig.yml"
|
||||
},
|
||||
{
|
||||
"src": [
|
||||
{
|
||||
"src": "../src/EchoHub.Server.Irc/bin/Release/net10.0",
|
||||
"files": ["EchoHub.Server.Irc.dll"]
|
||||
}
|
||||
],
|
||||
"dest": "_api_meta/server-irc",
|
||||
"filter": "filterConfig.yml"
|
||||
}
|
||||
],
|
||||
"build": {
|
||||
@@ -55,6 +65,12 @@
|
||||
"dest": "api/client",
|
||||
"files": ["*.yml"],
|
||||
"exclude": ["toc.yml"]
|
||||
},
|
||||
{
|
||||
"src": "_api_meta/server-irc",
|
||||
"dest": "api/server-irc",
|
||||
"files": ["*.yml"],
|
||||
"exclude": ["toc.yml"]
|
||||
}
|
||||
],
|
||||
"resource": [
|
||||
|
||||
+4
-2
@@ -4,11 +4,13 @@ _layout: landing
|
||||
|
||||
# EchoHub Documentation
|
||||
|
||||
Welcome to the EchoHub documentation. EchoHub is a decentralized, IRC-like chat application built with .NET 10 and SignalR.
|
||||
Welcome to the EchoHub documentation. EchoHub is a decentralized, IRC-style chat platform. Self-hosted, terminal-first, with a built-in IRC gateway so native IRC clients can connect alongside the TUI client.
|
||||
|
||||
**Website:** [echohub.voidcube.cloud](https://echohub.voidcube.cloud/) | **Public Servers:** [Server Directory](https://echohub.voidcube.cloud/servers)
|
||||
|
||||
## Quick Links
|
||||
|
||||
- [Getting Started](articles/getting-started.md) - Set up and run EchoHub
|
||||
- [Architecture](articles/architecture.md) - Understand the system design
|
||||
- [Architecture](articles/architecture.md) - System design and IRC gateway
|
||||
- [API Reference](api/index.md) - Generated C# API documentation
|
||||
- [Changelog](changelog/index.md) - Release history
|
||||
|
||||
Reference in New Issue
Block a user