Removed public hostname
This commit is contained in:
@@ -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()]),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user