services: label as network service in whois
All checks were successful
CI / check (push) Successful in 3m44s

This commit is contained in:
Jean Chevronnet 2026-07-17 00:30:51 +00:00
parent 952078aa7e
commit b87a0c56a2
No known key found for this signature in database
5 changed files with 29 additions and 1 deletions

View file

@ -285,10 +285,18 @@ pub struct Server {
// services server U-lined), bot, block-CTCP. Set per the ircd's loaded modules.
#[serde(default = "default_service_modes")]
pub service_modes: String,
// Oper type the service pseudo-clients are flagged with, so WHOIS shows
// "is a <this>". Default "Network Service". Empty leaves them non-opers.
#[serde(default = "default_service_oper_type")]
pub service_oper_type: String,
}
fn default_service_modes() -> String {
"iHkBT".to_string()
"ikBT".to_string()
}
fn default_service_oper_type() -> String {
"Network Service".to_string()
}
fn default_protocol() -> u32 {

View file

@ -104,6 +104,7 @@ pub struct Engine {
synced: bool,
guest_nick: String, // base for the Guest#### rename on enforcement
service_host: String, // hostname the service pseudo-clients wear
service_oper_type: String, // oper type our services are flagged with (WHOIS "is a <this>"); empty = don't oper
enforce_seq: u32, // counter appended to guest_nick
pending_enforce: Vec<PendingEnforce>, // registered nicks awaiting identify-or-rename
bot_uids: HashMap<String, String>, // casefolded bot nick -> live uid (per connection)
@ -238,6 +239,7 @@ impl Engine {
synced: false,
guest_nick: "Guest".to_string(),
service_host: "services.local".to_string(),
service_oper_type: String::new(),
enforce_seq: 0,
pending_enforce: Vec::new(),
bot_uids: HashMap::new(),
@ -771,6 +773,11 @@ impl Engine {
}
}
// Oper type our services are flagged with at introduction (empty = don't oper).
pub fn set_service_oper_type(&mut self, oper_type: impl Into<String>) {
self.service_oper_type = oper_type.into();
}
// A user arrived on (or changed to) a registered nick: if they aren't logged
// into that account, prompt them to IDENTIFY and schedule a rename. Gated on
// `synced` so a netburst can't enforce every already-online user; a user who
@ -929,6 +936,10 @@ impl Engine {
host: self.service_host.clone(),
gecos: svc.gecos().to_string(),
});
// Oper them up so WHOIS labels them a network service (the oper line).
if !self.service_oper_type.is_empty() {
out.push(NetAction::OperType { uid: svc.uid().to_string(), oper_type: self.service_oper_type.clone() });
}
}
// Advertise our SASL mechanisms so the uplink can offer `sasl=PLAIN` to
// clients in CAP LS (IRCv3 SASL 3.2).

View file

@ -189,6 +189,7 @@ async fn main() -> Result<()> {
// Service pseudo-clients wear the configured host, or the server name.
let service_host = if cfg.server.service_host.is_empty() { &cfg.server.name } else { &cfg.server.service_host };
engine.lock().await.set_service_host(service_host);
engine.lock().await.set_service_oper_type(cfg.server.service_oper_type.clone());
engine.lock().await.set_log_channel(cfg.log.as_ref().map(|l| l.channel.clone()));
if enabled("debugserv") {
// DebugServ speaks the live feed into the log channel; give the engine its uid.