#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct ServerConfig {
pub bind_address: &'static str,
pub ring_size: u32,
pub buffer_size: usize,
pub max_connections: usize,
pub connection_timeout_secs: u64,
}
impl Default for ServerConfig {
fn default() -> Self {
Self {
bind_address: "127.0.0.1:8080",
ring_size: 64,
buffer_size: 4096,
max_connections: 128,
connection_timeout_secs: 30,
}
}
}
impl ServerConfig {
#[allow(dead_code)]
pub fn host_port(&self) -> (&str, &str) {
let parts: Vec<&str> = self.bind_address.split(':').collect();
(
parts.first().unwrap_or(&"localhost"),
parts.get(1).unwrap_or(&"8080"),
)
}
}