Scaffold the federated services daemon
Protocol-agnostic core: a Protocol trait maps raw server-to-server lines to a normalized event/action model, so the engine never touches a raw line and a new ircd is one new module. Adds event-log state (state is a fold over the log) and a service framework. First protocol impl links to an InspIRCd (insp4) uplink — completes the CAPAB/SERVER handshake, bursts, and introduces NickServ.
This commit is contained in:
commit
f82ab0c70a
15 changed files with 890 additions and 0 deletions
34
src/config.rs
Normal file
34
src/config.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Config {
|
||||
pub uplink: Uplink,
|
||||
pub server: Server,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Uplink {
|
||||
pub host: String,
|
||||
pub port: u16,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Server {
|
||||
pub name: String,
|
||||
pub sid: String,
|
||||
pub description: String,
|
||||
#[serde(default = "default_protocol")]
|
||||
pub protocol: u32,
|
||||
}
|
||||
|
||||
fn default_protocol() -> u32 {
|
||||
1206 // InspIRCd 4 spanning-tree protocol (1205 = insp3)
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn load(path: &str) -> anyhow::Result<Self> {
|
||||
let raw = std::fs::read_to_string(path)?;
|
||||
Ok(toml::from_str(&raw)?)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue