Skip to content

Configuration Reference ​

The complete schema of ferrixd.toml. Every table and field, with types, defaults, and validation rules. For a guided walkthrough, see the configuration guide.

Unknown keys are errors

Configuration is fail-closed: every table rejects unknown keys. A typo prevents startup instead of being silently ignored. Validate with ferrixd check after every edit.

Conventions below: required fields have no default; everything else may be omitted. Durations are integer seconds; sizes are bytes.

[server] — required ​

Identity and listeners.

FieldTypeDefaultDescription
namestringrequiredadvertised server name, used in numerics and message prefixes
networkstring"ferrixnet"network name (ISUPPORT NETWORK=)
descriptionstringthe network namefree-text server description shown in LINKS and WHOIS and sent to linked servers
iconstringunsetnetwork icon URL (IRCv3 draft/network-icon), advertised as ISUPPORT draft/ICON=; use an HTTPS URL to a (square) image, optionally with a {size} template
chantypesstring"#&"accepted channel prefixes (CHANTYPES): any non-repeating subset of # (network), & (server-local, never linked), + (modeless)
casemapping"ascii" | "rfc1459""ascii"nick/channel case folding; must be identical network-wide
motdarray of string[]message of the day, one entry per line; REHASH-reloadable
cloak_keystringunsetHMAC key enabling host cloaking; omit to disable; keep secret and identical on linked servers
sidstring"42F"server ID for S2S; unique per network
link_bindsocket addressunsetinbound S2S listener, e.g. "0.0.0.0:6666"
tls_bindsocket addressrequiredprimary TLS listener, e.g. "0.0.0.0:6697"
plain_bindsocket addressunsetplaintext listener; loopback-only unless allow_plain_nonlocal
allow_plain_nonlocalboolfalsepermit a non-loopback plain_bind or ws_bind (e.g. behind a local TLS-terminating proxy)
wss_bindsocket addressunsetsecure WebSocket (wss://) listener; terminates TLS with the [tls] certificate, then negotiates the text.ircv3.net/binary.ircv3.net subprotocols
ws_bindsocket addressunsetplaintext WebSocket (ws://) listener; loopback-only unless allow_plain_nonlocal (prefer wss_bind)
passwordstringunsetconnection password: clients must send a matching PASS before registration (464 otherwise); REHASH-reloadable
ststableunsetIRCv3 strict transport security policy: { port = 6697, duration = 2592000, preload = false }; plaintext connections are told the TLS port, TLS connections the duration (seconds; 0 clears the policy)

Validation: a non-loopback plain_bind or ws_bind with allow_plain_nonlocal = false is a configuration error.

[tls] — required ​

FieldTypeDefaultDescription
certpathunsetPEM certificate chain (leaf first)
keypathunsetPEM private key
self_signed_devboolfalsegenerate an ephemeral self-signed cert at startup — development only; ignored when cert/key are set
dev_hostnamesarray of string["localhost"]SANs for the dev certificate
reload_interval_secsint60how often the certificate/key files are checked; a changed, valid pair is installed live (a broken one is ignored). 0 disables

Validation: cert and key must be set together; if neither is set, [tls.acme] must be configured or self_signed_dev must be true.

[tls.acme] — optional ​

Built-in certificate management (RFC 8555, HTTP-01). Replaces cert/key. See TLS → built-in ACME.

FieldTypeDefaultDescription
domainsarray of stringrequiredDNS names on the certificate (no wildcards)
dirpathrequiredholds account.key, cert.pem, key.pem (created 0700, keys 0600)
http_bindsocket addressrequiredHTTP-01 responder; must be reachable as port 80 of every domain
accept_termsboolfalsemust be true — agreement to the CA's terms of service
contactarray of string[]account contacts, e.g. mailto:admin@example.org
directorystringLet's Encrypt productionthe CA's ACME directory URL
renew_before_daysint30renew when the certificate expires within this many days

[limits] — optional ​

All fields optional; defaults shown. See also Limits & Defaults for the hardcoded constants.

FieldTypeDefaultDescription
max_tag_bytesint4094budget for a client's message-tags section (the IRCv3 client limit); longer input is refused with 417 ERR_INPUTTOOLONG
max_body_bytesint512wire budget for the message body (RFC 1459)
max_line_bytesint8704fatal frame length — longer frames drop the connection; must be ≥ max_tag_bytes + max_body_bytes
registration_timeout_secsint30seconds a connection may stay unregistered
handshake_timeout_secsint15TLS handshake budget
ping_interval_secsint120idle seconds before a server PING; a second missed interval disconnects
max_clients_per_ipint10simultaneous connections per source IP
max_channelsint50channels per client (CHANLIMIT); opers exempt
sendq_linesint2048outbound queue depth in lines; overflow disconnects (SendQ exceeded)
recv_burstint20inbound token-bucket burst allowance
recv_rateint10sustained inbound commands/second; exhaustion disconnects (Excess Flood)
history_lenint500retained messages per chathistory target; 0 = current-run only
history_max_targetsint50000cap on distinct in-memory history targets; LRU-evicted beyond

[[accounts]] — optional, repeatable ​

SASL seed accounts. See Accounts & SASL.

FieldTypeDefaultDescription
namestringrequiredaccount name
passwordstringunsetplaintext password, Argon2id-hashed at startup — development convenience
password_hashstringunsetprecomputed Argon2 PHC string (ferrixd hash-password) — production
scramstringunsetprecomputed SCRAM-SHA-256 credential (<iterations>:<b64 salt>:<b64 stored_key>:<b64 server_key>). Required for SCRAM logins on a password_hash account — the server never sees that account's plaintext and cannot derive them. ferrixd hash-password --toml prints password_hash and scram together; an account seeded with plaintext password gets SCRAM credentials automatically
fingerprintsarray of string[]permitted TLS client-cert SHA-256 fingerprints (lowercase hex) for SASL EXTERNAL

REHASH-reloadable. Self-registered accounts (via REGISTER) are stored in [persistence] and merged on top.

[[operators]] — optional, repeatable ​

IRC operator credentials for OPER. See Operators & Moderation.

FieldTypeDefaultDescription
namestringrequiredoperator name
passwordstringunsetplaintext (dev only)
password_hashstringunsetArgon2 PHC string (production)
hostsarray of string[]hostmask globs (nick!user@host or bare IP) allowed to use this block; anywhere else gets 491 ERR_NOOPERHOST; empty = any host

Validation: each operator needs password or password_hash. REHASH-reloadable.

[[bans]] — optional, repeatable ​

Startup K-lines, enforced at registration.

FieldTypeDefaultDescription
maskstringrequirednick!user@host glob (*, ?)
reasonstring"Banned"shown to the banned client

REHASH-reloadable. Runtime additions: KLINE/DLINE (moderation guide).

[[webirc]] — optional, repeatable ​

Trusted WEBIRC gateways (IRCv3 WEBIRC). A web/IRC gateway may rewrite a client's apparent host and IP so users behind it are seen — and moderated — by their real address. Empty (the default) disables the WEBIRC command.

FieldTypeDefaultDescription
namestringrequiredgateway identifier, matched against the WEBIRC <gateway> parameter
passwordstringrequiredshared secret the gateway sends as WEBIRC <password>; compared in constant time — use a long random value
hostsarray of stringrequiredsource-address globs (e.g. "127.0.0.1", "10.0.0.*") the gateway may connect from

A WEBIRC is accepted only when it is the connection's first command (before CAP/NICK/USER/PASS), the real peer address matches one of hosts, and the password matches; the rewritten IP is then re-checked against D-lines. Any failure closes the connection. REHASH-reloadable.

[[services]] — optional, repeatable ​

RFC 2812 services allowed to register with SERVICE (commands). Empty refuses every SERVICE. REHASH-reloadable.

FieldTypeDefaultDescription
namestringrequiredthe service name it must register as
passwordstringrequiredsent by the service with PASS before SERVICE; compared in constant time
hostslist of globs[]source addresses the service may connect from; empty = any
toml
[[services]]
name = "stats"
password = "long-random-secret"
hosts = ["127.0.0.1"]

[account_registration] — optional ​

Self-registration (REGISTER) policy. REHASH-reloadable. See Accounts → E-mail verification.

FieldTypeDefaultDescription
verificationstring"none""none" (accounts usable at once), "smtp" or "command" (code must be confirmed with VERIFY; the cap advertises email-required)
code_ttl_secsint86400how long a code is valid; an account still unverified then is deleted
code_lengthint8code length, 6–32
verify_urlstringunsetlink included in the message; {account}, {code}, {network} are substituted (URL-encoded)
subjectstring"Your {network} verification code"mail subject
max_per_ip_per_hourint5registrations per source address per hour; 0 = unlimited
before_connectbooltrueallow REGISTER before connection registration completes (the cap's before-connect key); false answers it with FAIL REGISTER COMPLETE_CONNECTION_REQUIRED
commandlist of strings[]verification = "command": argv of the delivery program; gets FERRIXD_ACCOUNT, FERRIXD_EMAIL, FERRIXD_CODE, FERRIXD_NETWORK, FERRIXD_VERIFY_URL in its environment; must exit 0 within 30 s

[account_registration.smtp] (verification = "smtp"):

FieldTypeDefaultDescription
hoststringrequiredrelay host (also the TLS name verified against Mozilla's root store)
portint587relay port
securitystring"starttls""starttls", "tls" (implicit, usually port 465) or "none" (local relays only)
usernamestringunsetAUTH PLAIN login
password_envstringunsetname of the environment variable holding the SMTP password
fromstringrequiredsender address
timeout_secsint20per-delivery timeout

[dnsbl] — optional ​

DNS blocklist checks at connect time. No lists = disabled. REHASH-reloadable (a reload clears the result cache). See Operators → DNS blocklists.

FieldTypeDefaultDescription
cache_ttl_secsint3600how long a lookup result is cached per address
max_cache_entriesint65536cache cap; when full, expired entries are purged and new results go uncached
max_inflightint256concurrent checks; beyond it connections are admitted unchecked (fail open)
listsarray[]the blocklists (below)

[[dnsbl.lists]]:

FieldTypeDefaultDescription
zonestringrequiredthe blocklist zone, e.g. dnsbl.dronebl.org
codeslist of ints[]which 127.0.0.<code> answers count as listed; empty = any
actionstring"reject""reject" refuses the connection; "ban" also refuses the address for ban_secs without further lookups; "mark" admits it and shows operators the zone in WHOIS (320)
ban_secsint86400ban duration
reasonstring"Your address is listed in {zone}"shown to refused clients; {zone} and {ip} are substituted
timeout_msint1500per-lookup timeout (1–30000); a timeout counts as not listed

[multiclient] — optional ​

Several connections per account. REHASH-reloadable. See Accounts → multiclient.

FieldTypeDefaultDescription
enabledboolfalsea SASL login to an account already online here attaches to that user
max_connectionsint4devices per account
always_onboolfalsethe user stays (auto-away) when its last connection leaves
always_on_expiry_secsint604800an always-on user without connections quits after this
auto_away_messagestring"Disconnected"away message while no device is connected
rejoinboolfalserejoin an account's previous channels on login (persisted with [persistence])

[web] — optional ​

The built-in HTTP(S) server: the web client, IRC over WebSocket and file uploads on one port. See Web Client and File Uploads.

FieldTypeDefaultDescription
bindsocket address—address to listen on
tlsbooltrueHTTPS with the [tls] certificate; false only on loopback (reverse proxy)
public_urlstringhttps://<server name>:<port>externally visible base URL for links and FILEHOST
ircbooltrueaccept IRC over WebSocket at /irc on this port
clientboolfalseserve the web client from root
rootpath/usr/share/ferrixd/webdirectory holding the built web client (ferrixd-web.tar.gz from a release)

[admin] — optional ​

The admin dashboard and its HTTP API.

FieldTypeDefaultDescription
bindsocket address—address to listen on; must be loopback unless tls = true
tlsboolfalseHTTPS with the [tls] certificate (required for a non-loopback bind)
rootpath[web] rootdirectory holding admin.html
session_secsint28800admin session lifetime
overridespath—JSON file persisting runtime switches changed with ferrixd ctl set or the dashboard

[filehost] — optional ​

File uploads (soju.im/FILEHOST); needs [web]. Limits are REHASH-reloadable, the storage backend is fixed at startup. See File Uploads.

FieldTypeDefaultDescription
enabledboolfalseaccept uploads and advertise the endpoint
max_bytesint26214400largest upload (25 MiB)
allowed_typesstring listimages, audio, video, PDF, text/plainaccepted MIME types; type/* wildcards
quota_bytesint524288000stored bytes per account (0 = unlimited)
uploads_per_hourint60uploads per account per hour
retention_daysint30purge uploads older than this (0 = never)
voice_max_secsint300longest Ogg/Opus voice message (0 = no limit)
indexpath<local dir>/index.dbSQLite upload index; required for S3
storage.kind"local" | "s3""local"backend
storage.pathpath/var/lib/ferrixd/uploadslocal: directory
storage.endpoint, region, bucketstring—S3: where
storage.access_key_env, secret_key_envstring—S3: environment variables holding the credentials
storage.path_stylebooltrueS3: <endpoint>/<bucket> instead of <bucket>.<host>
storage.prefixstring""S3: object key prefix

[calls] — optional ​

1:1 call signalling (ferrix.chat/calls). REHASH-reloadable. See Calls & E2EE.

FieldTypeDefaultDescription
enabledboolfalseoffer the capability and police call frames
stun_urlsstring list[]STUN URLs handed out by CALL ICE
turn_urlsstring list[]TURN URLs handed out with minted credentials
turn_secret_envstring—environment variable holding the coturn static-auth-secret
turn_ttl_secsint3600TURN credential lifetime
require_accountbooltrueonly logged-in users may call or get TURN credentials
offers_per_minuteint5call offers per user per minute
max_duration_secsint14400the server hangs up calls older than this

[e2ee] — optional ​

The experimental end-to-end encryption key directory (ferrix.chat/e2ee). REHASH-reloadable. See Calls & E2EE.

FieldTypeDefaultDescription
enabledboolfalseoffer the capability and the KEYS command
max_devicesint10devices per account
max_prekeysint100one-time prekeys per device
fetches_per_minuteint30bundle fetches per user per minute

[control] — optional ​

The local administration endpoint for ferrixd ctl (and the web admin API). Disabled unless configured.

FieldTypeDefaultDescription
socketpathunsetUnix domain socket, created mode 0600 — anyone who can open it can administer the server, so keep it in a directory only the service user can reach. Unix only
bindsocket addressunsetloopback-only TCP endpoint (Windows, containers); requires token_env
token_envstringunsetname of the environment variable holding the TCP token (≥ 16 characters), compared in constant time
shutdown_grace_secsint30how long drain waits for clients to leave
toml
[control]
socket = "/run/ferrixd/ctl.sock"

[nicks] — optional ​

Nick protection. REHASH-reloadable. See Accounts → Nick protection.

FieldTypeDefaultDescription
delay_secsint0RFC 2811 nick delay: after a netsplit or ping timeout the departed user's nick answers 437 ERR_UNAVAILRESOURCE to everyone else for this long. 0 disables it
reserve_account_nicksboolfalseevery registered account's name is a nick reserved for that account
reservation_grace_secsint30how long someone using another account's reserved nick has to log in before being renamed
guest_prefixstring"Guest"forced renames pick <prefix><5 digits>

[logging] — optional ​

Log output defaults, so a service unit or container needs no extra flags. The CLI flags win over these.

FieldTypeDefaultDescription
formatstring"full""full", "compact", "pretty" or "json" (one JSON object per line); --log-format overrides
filterstringunsettracing filter (info, ferrixd=debug,info, …); --log overrides, and an unset filter falls back to RUST_LOG, then info. Validated at load

[persistence] — optional ​

SQLite durability for history, registered channels, and self-registered accounts. Omit for in-memory-only operation. See Message History.

FieldTypeDefaultDescription
pathpathrequiredSQLite database file (created if missing; WAL mode)
load_limitint5000most-recent history rows loaded into RAM at startup
searchbooltrueoffer full-text message search (soju.im/search) over the stored history
search_max_resultsint100most results one SEARCH returns

[metrics] — optional ​

FieldTypeDefaultDescription
bindsocket addressrequiredHTTP listener for /metrics; bind to loopback — the endpoint has no auth

Catalogue: Metrics reference.

[plugins] — optional ​

WASM plugin host. See WASM Plugins.

FieldTypeDefaultDescription
dirpathrequireddirectory scanned for *.wasm at startup (sorted filename order)
fuelint5000000per-hook-call instruction budget
max_memoryint16777216per-instance linear-memory cap, bytes
expose_private_messagesboolfalsefeed user-to-user DMs to the ferrix_on_private_message hook (a privacy decision — off unless you opt in)
state_dirpathunsetdirectory for host-managed per-plugin KV state files; unset → in-memory only
tick_secsint0seconds between ferrix_on_timer calls; 0 disables the tick (as does no plugin exporting the hook)
grantstable{}per-plugin capability grants, plugin name → list of capability names; deny-by-default (see below)
configtable{}per-plugin operator settings, plugin name → string table, read back through ferrix.config_get; a "$env:NAME" value is read from the environment
on_missing_grantsstring"refuse"a plugin whose manifest requests ungranted capabilities is "refuse"d, or loaded with the granted subset ("degrade")
httptable{}plugin name → host names it may reach with ferrix.http_request (needs the http grant)
botstable{}plugin name → { nick, realname, channels } bot pseudo-client (needs the bot grant)

Capability names for grants: send_notice, send_message, kick, mode, topic, kline, gline, connect, squit, http, bot. An unrecognised name is logged and ignored. Grants are re-applied to the running plugins on REHASH (a removed grant is revoked immediately). Grant the narrowest set that does the job — kline bans a hostmask and disconnects everyone it matches.

toml
[plugins.grants]
"20-modbot" = ["send_notice", "kick", "mode"]

[plugins.config."20-modbot"]
report_channel = "#ops"
threshold = "5"

S2S peer definitions. See Federation.

FieldTypeDefaultDescription
namestringrequiredpeer's advertised server.name; must match at handshake
connectsocket addressunsetpeer's link_bind; omit for accept-only links
fingerprintstringrequiredpeer TLS cert SHA-256, lowercase hex (ferrixd fingerprint) — pinned
passwordstringrequiredshared link secret, compared in constant time
protocolstring"ferrix"wire protocol on this link: "ferrix" (native) or "ts6" (charybdis-family bridge, e.g. solanum)

What REHASH reloads ​

Reloadable at runtimeRestart required
[[accounts]], [[operators]], [[bans]], [[webirc]], [[services]], [nicks], [dnsbl], [account_registration], [multiclient], [calls], [e2ee], [filehost] limits, [plugins.grants], server.motd, server.password, [tls] certificate/key, [[links]] definitionslistener bind addresses, [limits], [persistence], [metrics], [web], [admin], [control], [filehost.storage], the rest of [plugins] (plugins are loaded at startup), sid, cloak_key, casemapping

[tls] certificate/key reload is live for every TLS listener (no dropped connections; a bad PEM leaves the previous material armed).

[[links]] after a REHASH:

  • operator CONNECT (and ferrixd ctl connect) uses the refreshed definitions immediately, so a newly added link can be dialled at once;
  • the boot-time auto-dial loops pick up an edited address, fingerprint or certificate on their next attempt, and stop for links removed from the file — but REHASH never starts a loop for a newly added link;
  • the inbound link listener (link_bind) matches each connecting peer against the refreshed definitions, so a newly added peer (accept-only or not) can link in at once, and a removed peer — or one with a changed fingerprint or password — is judged by the new file on its next attempt. Links already up are not dropped; SQUIT a removed peer to cut it off.

Runtime switches (ferrixd ctl set …, the admin dashboard) override the file across REHASH until reset with default.

Complete annotated example ​

The exact file ferrixd gen-config writes:

toml
# ferrixd example configuration.
#
# Copy to `ferrixd.toml` and adjust (or run `ferrixd gen-config` to write this
# file for you). Validate any changes with `ferrixd check` before restarting.
# The parser rejects unknown keys (fail-closed configuration), so a
# typo is an error, not a silently-ignored setting.
#
# Helper subcommands for the values below:
#   ferrixd gen-cert       -> a self-signed [tls] cert + key (dev)
#   ferrixd hash-password  -> an Argon2id `password_hash` for accounts/operators
#   ferrixd fingerprint    -> a cert fingerprint for [[links]] / SASL EXTERNAL

[server]
# Advertised server name (used in numerics / source prefixes).
name = "irc.example.test"

# Advertised network name (ISUPPORT NETWORK).
network = "ferrixnet"
# Server description for LINKS / WHOIS / linked servers (default: the network).
# description = "Main ferrixnet server"

# Optional network icon URL (IRCv3 draft/network-icon), advertised as the
# `draft/ICON` ISUPPORT token. Use an HTTPS URL to a (preferably square) image;
# a literal `{size}` in the URL is passed through for clients to substitute.
# icon = "https://example.org/icon.svg"

# Network-wide case folding for nicks/channels: "ascii" (default) or "rfc1459".
casemapping = "ascii"

# HMAC key enabling host cloaking (omit to disable). Keep this secret — it makes
# cloaks unforgeable. Authenticated users are cloaked as account.<network>.
# cloak_key = "change-this-to-a-long-random-secret"

# Server id (SID) and optional inbound S2S link listener.
sid = "42F"
# link_bind = "0.0.0.0:6666"

# Message of the day, one entry per line (optional).
motd = [
    "Welcome to ferrixd.",
    "Be excellent to each other.",
]

# TLS is the primary, mandatory transport.
tls_bind = "0.0.0.0:6697"

# Plaintext is disabled by default. Uncomment ONLY for local testing;
# binding to a non-loopback address will be rejected unless you also set
# `allow_plain_nonlocal = true` below.
# plain_bind = "127.0.0.1:6667"
# allow_plain_nonlocal = false

# IRC over WebSockets (IRCv3). `wss_bind` reuses the [tls] certificate and is the
# recommended form for browser clients. `ws_bind` is plaintext and — like
# `plain_bind` — loopback-only unless `allow_plain_nonlocal = true`.
# wss_bind = "0.0.0.0:443"
# ws_bind  = "127.0.0.1:8080"

# Optional connection password: clients must send `PASS <password>` before
# completing registration (rejected with 464 otherwise).
# password = "change-me"

# Accepted channel types (RFC 2811), advertised as CHANTYPES: "#" network-wide,
# "&" local to this server (never linked), "+" modeless (no ops, no modes).
# chantypes = "#&"

# Optional IRCv3 strict transport security (`sts`) policy. Plaintext clients
# are told the TLS port to reconnect to; TLS clients are told to remember the
# policy for `duration` seconds (0 clears it).
# sts = { port = 6697, duration = 2592000, preload = false }

[tls]
# Option A — provide a real certificate chain and private key (PEM):
# cert = "/etc/ferrixd/fullchain.pem"
# key  = "/etc/ferrixd/privkey.pem"

# Option B — generate an ephemeral self-signed certificate at startup.
# Convenient for development; NEVER use in production. Ignored if cert/key
# are set above.
self_signed_dev = true
dev_hostnames = ["localhost", "irc.example.test"]

# Renewed certificate files are picked up automatically (0 disables).
# reload_interval_secs = 60

# Option C — let ferrixd obtain and renew its certificate itself (ACME,
# HTTP-01). Replaces cert/key; http_bind must be reachable as port 80.
# [tls.acme]
# domains = ["irc.example.org"]
# contact = ["mailto:admin@example.org"]
# dir = "/var/lib/ferrixd/acme"
# http_bind = "0.0.0.0:80"
# accept_terms = true

[limits]
# Wire-length budgets. Kept separate for tags and body per IRCv3.
max_tag_bytes = 4094
max_body_bytes = 512

# Fatal frame length before the connection is dropped (DoS guard).
# Must be >= max_tag_bytes + max_body_bytes plus a little slack.
max_line_bytes = 8704

# Seconds a connection may stay unregistered before it is closed (slot guard).
registration_timeout_secs = 30

# Seconds allowed for the TLS handshake before the attempt is aborted.
handshake_timeout_secs = 15

# Retained messages per target for chathistory (0 keeps only the current run).
history_len = 500

# Cap on the number of distinct in-memory history targets (channels + DM pairs).
# Bounds total history memory regardless of activity; least-recently-active
# targets are evicted past this. Persisted rows (if enabled) are unaffected.
history_max_targets = 50000

# Idle seconds before the server PINGs a quiet client (disconnects on a 2nd miss).
ping_interval_secs = 120

# --- DoS controls ---
# Maximum simultaneous connections from one source IP (connection throttling).
max_clients_per_ip = 10
# Maximum channels a single client may be in at once (advertised as CHANLIMIT).
max_channels = 50
# Outbound SendQ depth in lines; a client whose queue overflows is dropped.
sendq_lines = 2048
# Inbound command burst allowance, then sustained rate/sec (token bucket).
# Exceeding this disconnects the client with "Excess Flood".
recv_burst = 20
recv_rate = 10

# --- SASL seed accounts ---
# Each account may authenticate via SASL PLAIN (password) and/or EXTERNAL
# (TLS client-certificate fingerprint).
#
# [[accounts]]
# name = "alice"
# # Development convenience: plaintext, hashed with Argon2id at startup. This
# # form also derives the account's SCRAM-SHA-256 credentials automatically.
# password = "change-me"
# # Preferred in production: a pre-computed Argon2 PHC hash instead of `password`.
# # The server never sees the plaintext, so SCRAM credentials cannot be derived
# # from it — supply them explicitly for SASL SCRAM-SHA-256. Both lines are
# # printed together by `ferrixd hash-password --toml`.
# # password_hash = "$argon2id$v=19$m=19456,t=2,p=1$...$..."
# # scram = "4096:<b64 salt>:<b64 stored_key>:<b64 server_key>"
# # SASL EXTERNAL: permitted client-cert SHA-256 fingerprints (lowercase hex).
# # fingerprints = ["a1b2c3..."]

# --- IRC operators (used by the OPER command) ---
# [[operators]]
# name = "admin"
# password = "change-me"          # or password_hash = "$argon2id$..."
# # Optional hostmask allowlist for this block: `nick!user@host` globs or bare
# # IPs. OPER from anywhere else is refused with 491. Empty/omitted = any host.
# # hosts = ["*!*@203.0.113.7", "*!*@*.trusted.example"]

# --- Startup server bans (K-Lines), matched at registration ---
# [[bans]]
# mask = "*!*@203.0.113.0/24"     # nick!user@host glob (* and ?)
# reason = "Banned network"

# --- Trusted WEBIRC gateways (IRCv3 WEBIRC) ---
# A web/IRC gateway may rewrite a client's apparent host and IP so users behind
# it are seen (and moderated) by their real address. A gateway must present the
# shared password AND connect from one of the `hosts` globs; both are checked
# (the password in constant time) before any rewrite. Empty = WEBIRC disabled.
# [[webirc]]
# name = "kiwi"                    # matched against the WEBIRC <gateway> field
# password = "long-random-shared-secret"
# hosts = ["127.0.0.1", "10.0.0.*"]  # source-address globs the gateway may use

# --- RFC 2812 services (optional) ---
# Connections allowed to register with SERVICE instead of NICK/USER. The
# service sends `PASS <password>` first; `hosts` limits where it may connect
# from (empty = anywhere).
# [[services]]
# name = "stats"
# password = "long-random-secret"
# hosts = ["127.0.0.1"]

# --- Self-registration policy (optional) ---
# [account_registration]
# verification = "none"           # none | smtp | command
# code_ttl_secs = 86400           # unverified accounts are deleted after this
# max_per_ip_per_hour = 5
# REGISTER allowed before connection registration completes:
# before_connect = true
# verify_url = "https://irc.example.org/verify?account={account}&code={code}"
# [account_registration.smtp]
# host = "smtp.example.org"
# port = 587
# security = "starttls"           # starttls | tls | none
# username = "irc@example.org"
# password_env = "FERRIXD_SMTP_PASSWORD"
# from = "irc@example.org"

# --- DNS blocklists (optional) ---
# Listed addresses are refused (or marked for opers) at connect time.
# [dnsbl]
# cache_ttl_secs = 3600
# max_inflight = 256              # beyond this, connect unchecked (fail open)
# [[dnsbl.lists]]
# zone = "dnsbl.dronebl.org"
# action = "ban"                  # reject | mark | ban
# ban_secs = 86400
# reason = "Your address ({ip}) is listed in {zone}"
# timeout_ms = 1500

# --- Several devices per account (optional) ---
# [multiclient]
# enabled = true                  # a SASL login to an online account attaches
# max_connections = 4
# always_on = false               # stay present (away) without connections
# always_on_expiry_secs = 604800
# rejoin = false                  # rejoin the account's channels on login

# --- Built-in HTTP(S) server: web client, IRC over WebSocket, uploads ---
# [web]
# bind = "0.0.0.0:8443"
# tls = true                      # HTTPS with the [tls] certificate
# public_url = "https://chat.example.org"   # behind a reverse proxy
# irc = true                      # IRC over WebSocket at wss://…/irc
# client = true                   # serve the web client from `root`
# root = "/usr/share/ferrixd/web" # extracted ferrixd-web.tar.gz
#
# Admin dashboard + API; log in with an [[operators]] credential.
# [admin]
# bind = "127.0.0.1:8080"         # loopback unless tls = true
# overrides = "/var/lib/ferrixd/overrides.json"  # persist runtime switches
#
# File uploads, advertised as soju.im/FILEHOST (needs [web]).
# [filehost]
# enabled = true
# max_bytes = 26214400            # 25 MiB
# quota_bytes = 524288000         # per account; 0 = unlimited
# uploads_per_hour = 60
# retention_days = 30             # 0 = keep forever
# voice_max_secs = 300            # Ogg/Opus voice messages
# [filehost.storage]
# kind = "local"
# path = "/var/lib/ferrixd/uploads"
# # kind = "s3", endpoint = "https://…", region = "…", bucket = "…",
# # access_key_env = "FERRIXD_S3_ACCESS_KEY", secret_key_env = "FERRIXD_S3_SECRET_KEY"
# # (S3 also needs [filehost] index = "/var/lib/ferrixd/uploads.db")

# --- 1:1 call signalling, ferrix.chat/calls (optional) ---
# [calls]
# enabled = true
# stun_urls = ["stun:turn.example.org:3478"]
# turn_urls = ["turn:turn.example.org:3478"]
# turn_secret_env = "FERRIXD_TURN_SECRET"  # coturn static-auth-secret
# turn_ttl_secs = 3600
# require_account = true
# offers_per_minute = 5
# max_duration_secs = 14400

# --- E2EE key directory, ferrix.chat/e2ee (optional, experimental) ---
# [e2ee]
# enabled = true
# max_devices = 10
# max_prekeys = 100
# fetches_per_minute = 30

# --- Local control endpoint for `ferrixd ctl` (optional) ---
# [control]
# socket = "/run/ferrixd/ctl.sock"   # mode 0600; Unix only
# # bind = "127.0.0.1:6699"          # loopback TCP alternative…
# # token_env = "FERRIXD_CTL_TOKEN"  # …authenticated by this env var's token
# shutdown_grace_secs = 30           # how long `ctl drain` waits

# --- Nick protection (optional) ---
# [nicks]
# delay_secs = 60                 # hold a nick after netsplit/ping timeout (437)
# reserve_account_nicks = true    # an account's name is its owner's nick
# reservation_grace_secs = 30     # time to log in before a forced rename
# guest_prefix = "Guest"          # forced renames become Guest12345

# --- Log output (optional; --log / --log-format override these) ---
# [logging]
# format = "json"                 # full | compact | pretty | json
# filter = "info"                 # tracing filter, e.g. "info,ferrixd::link=debug"

# --- Durable persistence (SQLite; optional) ---
# When set, chathistory AND channel registrations survive restarts (they share
# the same database file). Omit for in-memory-only state.
# [persistence]
# path = "/var/lib/ferrixd/ferrixd.db"
# load_limit = 5000               # recent messages to load into RAM at startup
# search = true                   # full-text SEARCH (soju.im/search) over history
# search_max_results = 100

# --- Prometheus metrics endpoint (optional; bind to loopback) ---
# [metrics]
# bind = "127.0.0.1:9090"         # scrape at http://127.0.0.1:9090/metrics

# --- WASM plugin host (optional) ---
# Loads every *.wasm file in `dir` at startup. Plugins are sandboxed and run
# under a per-call fuel (instruction) budget; a plugin's on_message hook may
# block channel messages. See crates/ferrixd/src/plugin.rs for the ABI.
# [plugins]
# dir = "/etc/ferrixd/plugins"
# fuel = 5000000                  # per-hook-call instruction budget
# max_memory = 16777216           # per-instance linear-memory cap (bytes)
# expose_private_messages = false # feed DMs to plugins (privacy: your call)
# state_dir = "/var/lib/ferrixd/plugin-state"  # persist plugin KV stores
# tick_secs = 0                   # >0 calls ferrix_on_timer that often
#
# Capability grants (deny-by-default): plugin file stem -> capabilities.
# Available: send_notice, send_message, kick, mode, topic, kline.
# Grant the narrowest set that does the job — `kline` disconnects users.
# [plugins.grants]
# "20-modbot" = ["send_notice", "kick", "mode"]
#
# Per-plugin settings, readable through ferrix.config_get. Lets one .wasm
# file be deployed with site-specific parameters instead of recompiled.
# A "$env:NAME" value is read from the server's environment (API keys).
# [plugins.config."20-modbot"]
# report_channel = "#ops"
# threshold = "5"
#
# ABI 4: network grants (gline, connect, squit — audited), outbound HTTP to
# allow-listed hosts, and plugin-owned bot pseudo-clients.
# (in [plugins]:) on_missing_grants = "refuse"  # or "degrade"
# [plugins.http]
# llm-assistant = ["api.openai.com"]
# [plugins.bots.llm-assistant]
# nick = "helper"
# channels = ["#help"]

# --- S2S peer links ---
# Trust is the pinned TLS certificate fingerprint plus the shared password.
# Set server.link_bind above to accept inbound links.
# Links refuse to form cycles: keep the topology a tree.
# [[links]]
# name = "irc.peer.test"
# connect = "peer.example:6666"   # omit for accept-only links
# fingerprint = "a1b2c3…"         # peer cert SHA-256 (lowercase hex)
# password = "shared-link-secret"
# protocol = "ferrix"             # or "ts6" to bridge a charybdis-family
#                                 # IRCd (solanum, …) into the network

Dual-licensed under MIT or Apache-2.0.