Proof of concept mechanical port of ircnet/ircd to Rust as part of a bit about C being insecure for network services
1//! # leveva
2//!
3//! The idiomatic-Rust end-state of the `ircd.rs` C→Rust port. It grew to parity
4//! against a *faithful mechanical* translation of IRCnet 2.11 (the `ircd-*` crates,
5//! byte-identical to the C oracle) which served as its differential oracle and was
6//! deleted at parity (P12). `leveva` is the from-scratch idiomatic product: typed
7//! identifiers, safe string handling, no `unsafe` FFI seam.
8//!
9//! This module is the **string foundation**:
10//!
11//! - [`casemap`] — RFC 1459 case folding (`A-Z↔a-z` *plus* the Scandinavian
12//! `[↔{ \↔| ]↔} ~↔^`).
13//! - [`string`] — [`IrcStr`]/[`IrcString`], casemapping-aware string types whose
14//! equality, ordering, and hashing are IRC-case-insensitive, and an
15//! [`IrcStringBuilder`].
16//! - [`ident`] — validating newtypes, one per IRC identifier class ([`Nick`],
17//! [`ChanName`], [`Sid`], [`Uid`], [`Cid`], [`ServerName`], [`UserName`],
18//! [`HostName`]), each rejecting illegal input on construction.
19//! - [`message`] — a [`MessageBuilder`] that assembles RFC 1459 protocol lines into
20//! 512-byte-safe, CRLF-terminated wire bytes.
21//! - [`patricia`] — a generic [`Patricia`] trie for longest-prefix matching over
22//! bit-[`Prefix`]es (IP CIDRs and any other hierarchical bit key).
23//! - [`numeric`] — the [`Numeric`] enum: every RFC 1459 / IRCnet 2.11 reply and
24//! error code, with wire-format [`Display`](core::fmt::Display) and `u16`
25//! round-tripping.
26//! - [`mode`] — the [`UserMode`] and [`ChanMode`] enums: every mode letter the
27//! daemon understands, with char/bit conversions and (for channels) a
28//! [`ChanModeKind`] category.
29//! - [`config`] — a KDL-based, typed [`Config`](config::Config): the idiomatic
30//! replacement for the C daemon's pipe-delimited single-letter config.
31//! - [`matching`] — IRC glob matching ([`matches`]/[`collapse`]) and the
32//! [`HostMask`] `nick!user@host` pattern used by bans and host auth.
33//!
34//! [`IrcStr`]: string::IrcStr
35//! [`IrcString`]: string::IrcString
36//! [`IrcStringBuilder`]: string::IrcStringBuilder
37//! [`Nick`]: ident::Nick
38//! [`ChanName`]: ident::ChanName
39//! [`Sid`]: ident::Sid
40//! [`Uid`]: ident::Uid
41//! [`Cid`]: ident::Cid
42//! [`ServerName`]: ident::ServerName
43//! [`UserName`]: ident::UserName
44//! [`HostName`]: ident::HostName
45//! [`MessageBuilder`]: message::MessageBuilder
46//! [`Patricia`]: patricia::Patricia
47//! [`Prefix`]: patricia::Prefix
48
49pub mod autoconnect;
50pub mod callerid;
51pub mod cap;
52pub mod casemap;
53pub mod certfp;
54pub mod channel;
55pub mod cidr;
56pub mod cloak;
57pub mod clock;
58pub mod command;
59pub mod config;
60pub mod connaccept;
61pub mod connlimit;
62pub mod connstats;
63pub mod control;
64pub mod extban;
65pub mod flood;
66pub mod heartbeat;
67pub mod ident;
68pub mod isupport;
69pub mod kline;
70pub mod knock_throttle;
71pub mod labeled;
72pub mod link;
73pub mod listeners;
74pub mod matching;
75pub mod message;
76pub mod metadata;
77pub mod metrics;
78pub mod metrics_server;
79pub mod mode;
80pub mod monitor;
81pub mod msgid;
82pub mod netio;
83pub mod numeric;
84pub mod patricia;
85pub mod registration;
86pub mod registry;
87pub mod s2s;
88pub mod sasl;
89pub mod server;
90pub mod session;
91pub mod snotice;
92pub mod stdreply;
93pub mod string;
94pub mod sts;
95pub mod tls;
96pub mod uid;
97pub mod websocket;
98pub mod whowas;
99
100pub use ident::{ChanName, Cid, HostName, IdentError, Nick, ServerName, Sid, Uid, UserName};
101pub use matching::{collapse, matches, HostMask, Pattern};
102pub use message::{Message, MessageBuilder, ParseError};
103pub use mode::{ChanMode, ChanModeKind, UnknownMode, UserMode};
104pub use numeric::{Numeric, UnknownNumeric};
105pub use patricia::{CidrParseError, IpCidr, Patricia, Prefix};
106pub use registration::{welcome_burst, RegStep, Registration, WelcomeParams};
107pub use string::{IrcError, IrcStr, IrcString, IrcStringBuilder};