fix: this was actually quite a big footgun

This commit is contained in:
Skye 2023-06-05 01:54:33 +09:00
parent 75931e5e88
commit 9177e44adb
Signed by: me
GPG key ID: 0104BC05F41B77B8

View file

@ -168,7 +168,7 @@ async fn accept_websocket_connection(stream: TcpStream) -> Result<()> {
info!("New WebSocket connection: {}", addr); info!("New WebSocket connection: {}", addr);
let domain = get_random_domain().await; let domain = get_random_domain().await.to_lowercase();
ws_stream ws_stream
.send(ClientboundControlMessage::DomainAssigned(domain.clone()).into()) .send(ClientboundControlMessage::DomainAssigned(domain.clone()).into())
@ -366,7 +366,7 @@ async fn accept_minecraft_connection(mut stream: TcpStream) -> Result<()> {
let handshake = Handshake::new(&packet?).await?; let handshake = Handshake::new(&packet?).await?;
info!("Minecraft client {} is connecting to {}", addr, handshake.server_address); info!("Minecraft client {} is connecting to {}", addr, handshake.server_address);
let map = ROUTING_MAP.read().await; let map = ROUTING_MAP.read().await;
if let Some(sender) = map.get(&handshake.server_address).cloned() { if let Some(sender) = map.get(&handshake.server_address.to_lowercase()).cloned() {
drop(map); drop(map);
let mut handle: ChannelHandle = ChannelHandle::new(&sender, addr).await?; let mut handle: ChannelHandle = ChannelHandle::new(&sender, addr).await?;
let mut buf = vec![]; let mut buf = vec![];