nirc-rs/readme.md

153 lines
4.6 KiB
Markdown
Executable File

# nirc-rs
nirc-rs is a multi-protocol terminal chat client written in Rust. It provides a
unified TUI interface for IRC, Matrix, Discord, ADC/DC++, BitChat (P2P via
libp2p), Revolt/Stout, Spacebar, and Nerimity — all in a single ncurses-style
terminal window.
## Features
- **Multi-protocol**: IRC (with TLS/SASL), Matrix (megolm E2EE), Discord
(Gateway + REST), ADC/DC++, BitChat (P2P Gossipsub), Stout, Spacebar, Nerimity
- **naim-style TUI**: Right-side window list panel, chat area with
naim-compatible formatting, status bar, input bar, debug console overlay
- **HTML-like message markup**: Bold, italic, underline, color, monospace,
links, custom emoji themes
- **File transfers**: P2P file send via libp2p request-response (BitChat),
progress bars, SHA-256 verification, cancellation
- **Plugin system**: Dynamic .so plugin loading for custom commands
- **Per-channel logging**: naim-format log files per channel/protocol
- **Encrypted tunnels**: Noise protocol tunnels between peers
- **Multiplexed streams**: yamux-based stream multiplexing for concurrent
file transfers and tunnels
## Supported Protocols
| Protocol | Tag | Description |
|-----------|-----|------------------------------------------|
| IRC | IRC | Classic IRC with TLS, SASL, ISUPPORT |
| Matrix | Mtx | Matrix.org with megolm E2EE |
| Discord | Dsc | Discord Gateway + REST API |
| ADC/DC++ | ADC | Direct Connect hub client |
| BitChat | P2P | P2P chat via libp2p Gossipsub |
| Stout | Sto | Revolt/Stout REST + WebSocket |
| Spacebar | Spc | Spacebar REST + WebSocket |
| Nerimity | Ner | Nerimity REST + WebSocket |
## Building
Requires Rust 1.75+ and a C compiler (for dependencies like `sha2`, `ring`).
```bash
# Clone
git clone https://git.dcos.net/dcosnet/nirc-rs.git
cd nirc-rs
# Build (release)
cargo build --release
# Or use the provided build script
./build.sh # release
./build.sh debug # debug
./build.sh check # cargo check only
./build.sh test # run tests
./build.sh clippy # lint
```
The binary is output to `target/release/nirc-rs` (or `target/debug/nirc-rs`).
## Configuration
nirc-rs reads configuration from `~/.nirc/config.toml`. Create it manually
or let the first run generate a template:
```bash
mkdir -p ~/.nirc
nirc-rs # generates a template config on first run
```
### Server entries
Each protocol connection is defined as a `[[servers]]` block:
```toml
# IRC example
[[servers]]
name = "libera"
protocol = "irc"
address = "irc.libera.chat:6697"
tls = true
nick = "myuser"
[servers.extra]
password = "optional_nickserv_pass"
# Matrix example
[[servers]]
name = "matrix"
protocol = "matrix"
address = "https://matrix.org"
user_id = "@you:matrix.org"
[servers.extra]
password = "your_password"
# Discord example
[[servers]]
name = "discord"
protocol = "discord"
address = "https://discord.com/api"
bot_token = "your_bot_token_here"
# BitChat (P2P) example
[[servers]]
name = "bitchat"
protocol = "bitchat"
address = "/ip4/0.0.0.0/tcp/9394"
[servers.extra]
bootstrap = "/ip4/1.2.3.4/tcp/9394/p2p/QmSomePeerId"
nickname = "myhandle"
```
## Usage
```
nirc-rs [config-path]
```
### Key bindings
| Key | Action |
|------------|----------------------------------|
| Ctrl+N | Next window |
| Ctrl+P | Previous window |
| Alt+1-9 | Switch to window 1-9 |
| Page Up/Down| Scroll chat history |
| Tab | Cycle nickname completions |
| /command | Enter command mode |
| Ctrl+^ | Toggle debug console overlay |
| Ctrl+L | Redraw screen |
### Commands
- `/connect <server>` — Connect to a configured server
- `/join <channel>` — Join a channel
- `/part` — Leave current channel
- `/msg <target> <text>` — Send a direct message
- `/me <text>` — Send an action/emote
- `/quit` — Exit nirc-rs
- `/bitchat peers` — List discovered P2P peers
- `/matrix verify <user>` — Start SAS device verification
## Architecture
- `src/main.rs` — Application entry, event loop, TUI rendering
- `src/config.rs` — TOML config parser
- `src/core/` — Core types: App, ChatMessage, ProtocolType, commands
- `src/protocols/` — Protocol backends (IRC, Matrix, Discord, etc.)
- `src/engine/` — Dispatcher, crypto tunnels, multiplexer
- `src/tui/` — Terminal UI: chat view, winlist, input bar, console
- `src/transfer/` — File transfer engine and state management
- `src/plugins/` — Dynamic plugin loader (.so)
## License
MIT — see [LICENSE](LICENSE) for details.