Removed public hostname

This commit is contained in:
2026-08-28 03:42:13 +02:00
parent 2ca2bafd61
commit 67215c4af0
2 changed files with 2 additions and 6 deletions
-3
View File
@@ -8,7 +8,6 @@ use crate::types::{Channel, ChannelKind, ServerMeta};
pub struct Config {
pub meta: ServerMeta,
pub port: u16,
pub public_hostname: String,
pub hostnames: HashSet<String>,
}
@@ -49,8 +48,6 @@ impl Config {
port: 3415,
public_hostname: "localhost:3415".to_string(),
hostnames: HashSet::from_iter(["localhost:3415".to_string()]),
}
}
+2 -3
View File
@@ -48,11 +48,10 @@ impl UserConnections {
return Err(anyhow::anyhow!("Client tampstamp wasn't correct"));
}
if hostname != server.config.public_hostname || !server.config.hostnames.contains(&hostname)
{
if !server.config.hostnames.contains(&hostname) {
socket.send(
&ClientMethod::Error {
error: Cow::Owned(format!("Invalid Hostname, to avoid man-in-the-middle attacks, please use the correct hostname: {}", server.config.public_hostname)),
error: Cow::Owned(format!("Invalid Hostname, to avoid man-in-the-middle attacks, please use the correct hostname(s): {}", server.config.hostnames.clone().into_iter().collect::<Vec<_>>().join(", "))),
},
)
.await?;