roowho2_lib/server/config.rs
1use std::net::SocketAddrV4;
2
3use serde::{Deserialize, Serialize};
4
5pub const DEFAULT_CONFIG_PATH: &str = "/etc/roowho2/config.toml";
6
7pub const DEFAULT_CLIENT_SOCKET_PATH: &str = "/run/roowho2/server_client.sock";
8
9#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
10pub struct Config {
11 /// Configuration for the rwhod server.
12 pub rwhod: RwhodConfig,
13
14 /// Path to the Unix domain socket for client-server communication.
15 ///
16 /// If left as `None`, the server expects to be served a file descriptor to the socket named 'client'.
17 pub client_socket_path: Option<String>,
18}
19
20#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
21pub struct RwhodConfig {
22 /// Enable or disable the rwhod server functionality.
23 pub enable: bool,
24
25 /// Network interfaces to listen on (e.g., ["eth0", "wlan0"]).
26 ///
27 /// If left as `None`, the server will automatically determine relevant interfaces.
28 ///
29 /// Note that if `broadcast_addresses` is specified, this field is ignored.
30 pub interfaces: Option<Vec<String>>,
31
32 /// Broadcast addresses to send rwhod packets to.
33 ///
34 /// If left as `None`, the server will automatically determine broadcast addresses for the selected interfaces.
35 pub broadcast_addresses: Option<Vec<SocketAddrV4>>,
36}