aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-04 19:29:45 +0000
committerFuwn <[email protected]>2021-05-04 19:29:45 +0000
commit5e87a453df1a9cb1235e2657f0dffb3cb66b0c11 (patch)
tree5b4c8695400fab545ef202a679dd669dbc975ebf /src
parentstyle(global): fix clippy complaints (diff)
downloadwhirl-5e87a453df1a9cb1235e2657f0dffb3cb66b0c11.tar.xz
whirl-5e87a453df1a9cb1235e2657f0dffb3cb66b0c11.zip
feat(redirect_id): specify custom ip in config
Adds the abiltiy to specify a custom IP in the Whirl.toml BREAKING CHANGE: This feature updates the configuration file format, update your Whirl.toml per the repository example.
Diffstat (limited to 'src')
-rw-r--r--src/config/Whirl.default.toml1
-rw-r--r--src/config/mod.rs1
-rw-r--r--src/server/cmd/commands/redirect_id.rs2
3 files changed, 3 insertions, 1 deletions
diff --git a/src/config/Whirl.default.toml b/src/config/Whirl.default.toml
index 688fa88..eb0758f 100644
--- a/src/config/Whirl.default.toml
+++ b/src/config/Whirl.default.toml
@@ -1,6 +1,7 @@
[whirlsplash]
worldsmaster_username = "WORLDSMASTER" # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING
log_level = 1 # Generally, you should only change this if you are expiriencing issues
+ip = "0.0.0.0" # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING
[distributor]
worldsmaster_greeting = "Welcome to Whirlsplash!"
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 4f01313..b1fa789 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -7,6 +7,7 @@ use config::{ConfigError, File};
pub struct WhirlsplashConfig {
pub worldsmaster_username: String,
pub log_level: i64,
+ pub ip: String,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct DistributorConfig {
diff --git a/src/server/cmd/commands/redirect_id.rs b/src/server/cmd/commands/redirect_id.rs
index ebfa95b..fdcf859 100644
--- a/src/server/cmd/commands/redirect_id.rs
+++ b/src/server/cmd/commands/redirect_id.rs
@@ -29,7 +29,7 @@ impl Creatable for RedirectId {
command.put_u16(self.room_number as u16); // Room ID
// IP
- for byte in "0.0.0.0".split('.') {
+ for byte in Config::get().unwrap().whirlsplash.ip.split('.') {
command.put_u8(byte.parse::<u8>().unwrap());
}
command.put_u16(Config::get().unwrap().hub.port as u16); // Port