mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Add multiplayer dos protection config toggle
This commit is contained in:
@@ -297,6 +297,7 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
|
|||||||
auth_url: self.settings.server.auth_url.trim_end_matches('/').to_owned(),
|
auth_url: self.settings.server.auth_url.trim_end_matches('/').to_owned(),
|
||||||
intercom_url: self.settings.server.intercom_url.trim_end_matches('/').to_owned(),
|
intercom_url: self.settings.server.intercom_url.trim_end_matches('/').to_owned(),
|
||||||
minimum_version: self.settings.server.min_version as i32,
|
minimum_version: self.settings.server.min_version as i32,
|
||||||
|
dos_protect: self.settings.server.dos_protection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ pub struct ServerConfig {
|
|||||||
pub auth_url: String,
|
pub auth_url: String,
|
||||||
pub intercom_url: String,
|
pub intercom_url: String,
|
||||||
pub minimum_version: i32,
|
pub minimum_version: i32,
|
||||||
|
pub dos_protect: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum QueueChangeMode {
|
pub enum QueueChangeMode {
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ pub struct ServerSettings {
|
|||||||
pub wiki_url: String,
|
pub wiki_url: String,
|
||||||
#[serde(default = "default_game_version")]
|
#[serde(default = "default_game_version")]
|
||||||
pub min_version: u32,
|
pub min_version: u32,
|
||||||
|
#[serde(default = "default_true")]
|
||||||
|
pub dos_protection: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
||||||
@@ -124,6 +126,7 @@ fn default_server_conf() -> ServerSettings {
|
|||||||
support_url: default_support_url(),
|
support_url: default_support_url(),
|
||||||
wiki_url: default_wiki_url(),
|
wiki_url: default_wiki_url(),
|
||||||
min_version: default_game_version(),
|
min_version: default_game_version(),
|
||||||
|
dos_protection: default_true(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,3 +157,7 @@ fn default_wiki_url() -> String {
|
|||||||
fn default_game_version() -> u32 {
|
fn default_game_version() -> u32 {
|
||||||
2855
|
2855
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_true() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,8 +41,9 @@ async fn main() -> std::io::Result<()> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mtu = oj_rc_core::ConfigProvider::<()>::network_config(&init_ctx.config).max_packet_size;
|
let mtu = oj_rc_core::ConfigProvider::<()>::network_config(&init_ctx.config).max_packet_size;
|
||||||
|
let dos_protection = oj_rc_core::ConfigProvider::<()>::server_config(&init_ctx.config).dos_protect;
|
||||||
let event_handler = events::handler(&init_ctx).await;
|
let event_handler = events::handler(&init_ctx).await;
|
||||||
let server = literustlib_server::Server::new(event_handler, (args.ip, args.port), mtu).await.expect("Bad server");
|
let server = literustlib_server::Server::new(event_handler, (args.ip, args.port), mtu, dos_protection).await.expect("Bad server");
|
||||||
|
|
||||||
let start_time = chrono::Utc::now();
|
let start_time = chrono::Utc::now();
|
||||||
START_TIMESTAMP_S.store(start_time.timestamp(), std::sync::atomic::Ordering::Relaxed);
|
START_TIMESTAMP_S.store(start_time.timestamp(), std::sync::atomic::Ordering::Relaxed);
|
||||||
|
|||||||
Reference in New Issue
Block a user