rIRCd

An IRC server that remembers. Accounts, history and channel ownership live in the server itself — no NickServ, no ChanServ, no services package bolted on the side — and it speaks the IRCv3 extensions a modern client needs. Written in Rust.

Rust · tokio · rustls · MariaDB · one static binary, no OpenSSL · BSD-3-Clause

;; on a plain IRC client, no services to /msg
/REGISTER * * hunter2-but-longer
REGISTER SUCCESS kara :Account successfully registered

/JOIN #mine
:irc.example.net MODE #mine +o kara        ;; you made it, you own it

/CHANOWN #mine
#mine belongs to kara

;; a week later, from a different client, under a different nick —
;; the room was empty in between. It is still yours.
/JOIN #mine
:irc.example.net MODE #mine +o kara

No services

What NickServ and ChanServ did, the server does.

Most IRC networks run a separate services package beside the server — a pile of bots you /msg to register a nick or claim a channel. rIRCd has none. Everything a services package did is a command the server answers itself, backed by MariaDB.

Services did thisrIRCd does this
Nick registrationREGISTER / VERIFY (draft/account-registration), with optional email verification
IdentifySASL PLAIN, SCRAM-SHA-256 or EXTERNAL — no /msg NickServ
Nick protectionA registered nick is reserved for its account
Nick recoveryGHOST <nick> closes a stale session of your own, wherever on the network it is
Password changePASSWD <current> <new> — the current one is asked for even while logged in
Password recoveryRESETPASS <account> mails a code; using it closes every login to the account
Dropping an accountDROPACCOUNT <password> removes the account and everything that named it
Channel founderThe account that creates a channel. Always opped on join, never shut out by its own +b/+i/+k/+l, not kickable or deoppable in it
Channel transferCHANOWN #channel <account> — by the founder, or by an operator, said out loud in the channel
Access listsMODE +o / +v on an account is remembered and restored on the next join, under any nick
Channel modes, topic, keyPersisted; kept when an owned channel empties, restored on startup
Ban lists+b, +e, +I and +q masks persisted and restored
Network bansKLINE / DLINE, persisted, enforced on connect, and carried across server links
Grouped nicksGROUP reserves the nick you are wearing for your account — the work nick, the phone nick — so being logged in is enough to use any of them. You have to be using a nick to group it: reserving names you have never been seen under is squatting
What is held about youACCOUNTINFO — when the account was registered and last seen, the address on it, every nick grouped to it, the channels it founded
Changing the addressSETEMAIL asks two things: the password, which says it is you, and a code read at the new address, which says you can receive there
Server-side ignoreSILENCE +mask — somebody who does not exist to you, and nothing tells them so
VhostsAutomatic HMAC cloaking of every connecting address; SETHOST for operators

Owning a channel

A channel belongs to somebody.

Whoever creates a channel while logged in is its founder — an account, not a nick, so whoever is logged in as it owns the channel on any connection and under any name. A founder is opped whenever they come back, cannot be kicked out of their own channel, cannot be deopped in it, and is not shut out by its own modes. An operator turning on the person who appointed them is how a channel gets stolen, and none of those doors opens that way.

The three commands

CHANOWN #channel              who it belongs to
CHANOWN #channel <account>    hand it on
CHANACCESS #channel           who has access
CHANDROP #channel             give it up

A ladder with a top

The founder wears ^ (+x) and can put somebody above the operators as & (+a). Status is given and taken only by people who have some of their own, and nobody reaches above themselves. The founder’s ^ comes from the registration rather than from a MODE, so it is true again every time they walk in — on every server.

Said out loud

A network operator may hand on any channel — one whose founder has vanished, or whose founder is the problem, has no other way out. But an operator doing it is announced in the channel as an operator and logged by name. What keeps an operator honest is not being unable to act; it is being unable to act quietly.

Still yours when the room empties

A channel that belongs to somebody stays known when the last person walks out — modes, bans, topic and access lists intact. A channel nobody owns is forgotten when it empties, the way a name two people used for an afternoon should be.

Every channel owned from its first moment

channel_creation = "accounts" means only somebody logged in may bring a new channel into being. It gates making one, never joining one, so no channel on the network is ever nobody’s.

It remembers

Close the client. Come back. Read what you missed.

Running a network

The tools every other server has, and then some.

A ban that does not announce itself

A K-line closes the connection, which tells whoever was behind it to come back from another address. SHUN leaves them connected and lets nothing they say reach anybody — no error, no numeric, no hint. They may listen, answer a PING and leave. Nobody is told but the operators. A shun that announced itself would just be a slower kill.

Patterns nobody wants to see again

SPAMFILTER is a pattern, where it is looked for — private messages, channels, nicks, topics, quit reasons, real names — and what happens when it is found: warn, block, kill, or ban the address. Globs or regular expressions, and SPAMFILTER TEST tries one before it is set.

Names the network keeps

RESV holds a name. Somebody who asks for a reserved channel or nick is told why — which is the difference between this and a spam filter. A filter is quiet on purpose, because telling a spammer what caught them hands them the way around it. A reservation is a rule people are meant to be able to read.

Who the bans do not apply to

Every blocklist eventually lists somebody who belongs here — a shared address, a VPN, an exit node. ELINE vouches for one while the rest of the list stands, instead of the two blunt alternatives: stop believing it for everybody, or stop asking. It covers the blocklist and a D-line at the door, and a K-line or shun once there is a nick. It is not a promise about behaviour: KILL still works, and so does a channel ban.

An operator’s hand

SAJOIN, SAPART and SAMODE put somebody in a channel, take them out, or set modes without holding ops there. TESTMASK says how many people a ban would hit before anybody sets it, and MAP draws the network. Server notice masks let each operator choose what they hear.

Not every client is the same client

A gateway carrying two hundred people from one address, a bot that must not be pinged out while it thinks, and somebody on a phone are not the same thing. [[classes]] gives each a set of numbers — connections, ping interval, flood allowance, send queue — instead of tuning one set for whichever it would rather lose.

A harder OPER prompt

An operator block’s hostmask is enforced on the real address rather than the cloak. require_tls refuses OPER over a connection that is not encrypted, so the password never crosses a wire in the clear, and certfp can be a second factor — or the whole ceremony, with no password at all.

Built for a modern client

The IRCv3 a client like Switchboard asks for.

AuthenticationSASL PLAIN, SCRAM-SHA-256, EXTERNAL (client certificate) · STS · draft/account-registration · register-before-connect
Historydraft/chathistory (channels and DMs) · draft/event-playback · draft/read-marker · draft/message-edit · draft/message-redaction
Messagingmessage-tags · msgid · server-time · echo-message · batch · labeled-response · standard-replies · draft/multiline · draft/react / unreact · typing · reply · draft/channel-context
Peopleaccount-notify · account-tag · away-notify · chghost · setname · extended-join · multi-prefix · userhost-in-names · monitor · extended-monitor · invite-notify · bot · WHOX · draft/metadata-2 / -3 · draft/pre-away
Channelsdraft/channel-rename · no-implicit-names · STATUSMSG · account and mute extbans · UTF8ONLY
Beyond the socketdraft/webpush (VAPID, aes128gcm) · draft/filehost · draft/network-icon · WebSocket transport (text.ircv3.net) · WebIRC

Running one

A database, a build, a prompt.

# MariaDB or MySQL. The schema is created on first start — no migrations to run.
cargo build --release
sudo cp target/release/rircd /usr/local/bin/
sudo rircd init          # asks the questions, writes /etc/rIRCd/config.toml
sudo rircd run

Measured, not claimed

Numbers from a run, not from a feeling.

tests/smoke/throughput.py puts every client in one channel, so each message a sender posts is delivered to every receiver, and reads the server’s own CPU out of /proc around the burst alone — steady-state delivery, not the cost of setting the connections up. On a quiet sixteen-core machine over loopback, 500 receivers in one channel and 5 senders:

Deliveries~126,000 a second
One message to all 500p50 9.7 ms · p99 19.2 ms

ISUPPORT is a promise, too. A client that reads NICKLEN=32 will not offer a longer one. Each of those numbers lives in one place — the token the server sends and the code that enforces it read the same constant — and a test suite reads the expectations out of the server’s own ISUPPORT rather than having them written down, so it checks that the numbers it gives out are the numbers it keeps.

On Tor

Behind an onion, everybody is 127.0.0.1.

Every client reaching the server through a hidden service arrives from the same address, so a per-address connection limit silently becomes “this many people may use Tor at once” — a rule nobody meant to write, and one that cannot be fixed by counting more carefully. rIRCd lets the onion have a listener of its own, capped as a whole rather than per address: a weaker promise, and the strongest one available.

[server]
listen = ["0.0.0.0:6667", "127.0.0.1:6668"]   # 6668 is the one Tor forwards to

[limits]
max_connections_per_ip = 16                   # still true of the public port
shared_address_listeners = ["127.0.0.1:6668"]
max_clients_behind_one_address = 256

Documentation

Written once, in the README.

The docs are generated from the README of the release that is running, so they cannot describe a server that no longer exists. Every configuration key, every command, every mode, and the whole IRCv3 table.

The rest of the household