Split the single-binary crate into a reusable `rustbot` library (src/lib.rs)
plus a thin supervisor binary. The monolithic irc.rs and bot.rs become module
folders:
irc/ message (wire parsing), connection (TCP/TLS transport), encoding
bot/ mod (state + event loop), caps (IRCv3 cap negotiation + SASL),
commands (message routing + command table)
config Config + layered loading, moved out of main.rs and bot.rs
main.rs is now just the per-network connect/reconnect supervisor over the
library API. Unit tests move out of the source files into tests/ integration
tests (config.rs, protocol.rs) that drive the public surface — prefix parsing
is now covered through Message::parse, and config layering through the new
public config::parse_str. Behavior is unchanged; no new dependencies.
Connect to several IRC networks at once. The config file gains optional
`[network]` section headers: keys before the first header are shared
defaults, and each section defines one network that inherits and overrides
them. A file with no sections is a single network exactly as before, so
existing configs are unaffected.
main spawns one supervisor thread per network, each with its own
connect/reconnect/backoff loop, so a failure on one network never disturbs
the others. The blocking Bot/Connection are reused unchanged — no async
runtime, no new dependencies. With more than one network, wire logs are
tagged with the section name; a lone network stays unprefixed.
Connect over TLS (default port 6697) using native-tls with the system
OpenSSL trust store for certificate verification. Unify the plaintext and
TLS transports behind a single Box<dyn Read + Write>, dropping the
read/write socket clone that a TLS session cannot support. Add a `tls`
config key and IRC_TLS override; the port auto-defaults to 6697 when TLS
is enabled.