extend x-platform support for binding URL previews to interfaces via address

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-12-08 02:39:40 +00:00
parent 52cee65748
commit f0a1aaf7bc
6 changed files with 74 additions and 28 deletions

View file

@ -1,3 +1,6 @@
use std::env::consts::OS;
use either::Either;
use figment::Figment;
use super::DEPRECATED_KEYS;
@ -191,6 +194,15 @@ For security and safety reasons, conduwuit will shut down. If you are extra sure
);
}
if let Some(Either::Right(_)) = config.url_preview_bound_interface.as_ref() {
if !matches!(OS, "android" | "fuchsia" | "linux") {
return Err!(Config(
"url_preview_bound_interface",
"Not a valid IP address. Interface names not supported on {OS}."
));
}
}
Ok(())
}