server: add basic config file
Build and test / check (push) Failing after 57s
Build and test / build (push) Failing after 1m29s
Build and test / test (push) Failing after 1m36s
Build and test / docs (push) Has been cancelled

This commit is contained in:
2026-01-05 18:16:35 +09:00
parent 4cb2862133
commit bf39ca5c9b
6 changed files with 148 additions and 19 deletions
+36
View File
@@ -0,0 +1,36 @@
use std::net::SocketAddrV4;
use serde::{Deserialize, Serialize};
pub const DEFAULT_CONFIG_PATH: &str = "/etc/roowho2/config.toml";
pub const DEFAULT_CLIENT_SOCKET_PATH: &str = "/run/roowho2/server_client.sock";
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Config {
/// Configuration for the rwhod server.
pub rwhod: RwhodConfig,
/// Path to the Unix domain socket for client-server communication.
///
/// If left as `None`, the server expects to be served a file descriptor to the socket named 'client'.
pub client_socket_path: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RwhodConfig {
/// Enable or disable the rwhod server functionality.
pub enable: bool,
/// Network interfaces to listen on (e.g., ["eth0", "wlan0"]).
///
/// If left as `None`, the server will automatically determine relevant interfaces.
///
/// Note that if `broadcast_addresses` is specified, this field is ignored.
pub interfaces: Option<Vec<String>>,
/// Broadcast addresses to send rwhod packets to.
///
/// If left as `None`, the server will automatically determine broadcast addresses for the selected interfaces.
pub broadcast_addresses: Option<Vec<SocketAddrV4>>,
}
+1 -1
View File
@@ -75,7 +75,7 @@ pub fn generate_rwhod_status_update() -> anyhow::Result<WhodStatusUpdate> {
Ok(result)
}
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct RwhodSendTarget {
/// Name of the network interface.
pub name: String,