Improve RCON

Remove all unwraps when handling packets. Also improve split Packets into Client & Server bound removing ugly match statement where we are reading Clientboud Packets (which is impossible).
This commit is contained in:
Alexander Medvedev committed 2024-10-07 23:00:25 +01:00
1 parent 5e45ebac33
commit 2194f14981
5 files changed
+277 -300

No files matched your search

+7
View File
@@ -4,9 +4,15 @@ use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Clone)]
pub struct RCONConfig {
/// Is RCON Enabled?
pub enabled: bool,
/// The network address and port where the RCON server will listen for connections.
pub address: SocketAddr,
/// The password required for RCON authentication.
pub password: String,
/// The maximum number of concurrent RCON connections allowed.
/// If 0 there is no limit
pub max_connections: u32,
}
impl Default for RCONConfig {
@@ -15,6 +21,7 @@ impl Default for RCONConfig {
enabled: false,
address: SocketAddr::new(Ipv4Addr::new(0, 0, 0, 0).into(), 25575),
password: "".to_string(),
max_connections: 0,
}
}
}