diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 47cec90..db7833c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,13 +5,22 @@ pub mod config; use anyhow::bail; use azalea_protocol::{ packets::{ - handshake::{client_intention_packet::ClientIntentionPacket, ServerboundHandshakePacket}, + handshaking::{client_intention_packet::ClientIntentionPacket, ServerboundHandshakePacket}, login::ServerboundLoginPacket, ConnectionProtocol, }, read::read_packet, write::write_packet, }; +// use azalea_protocol::{ +// packets::{ +// handshake::{client_intention_packet::ClientIntentionPacket, ServerboundHandshakePacket}, +// login::ServerboundLoginPacket, +// ConnectionProtocol, +// }, +// read::read_packet, +// write::write_packet, +// }; use bytes::BytesMut; use config::Config; use log::{error, info, warn}; @@ -108,24 +117,25 @@ async fn handle_client(config: Arc<Config>, sock: TcpStream) -> Result<(), anyho .await?; let upstream_login = match login { ServerboundLoginPacket::Hello(mut p) => { - info!("client hello (username={:?})", p.username); + info!("client hello (username={:?})", p.name); let profile = config .whitelist .iter() - .find(|e| e.token.as_ref().map_or(false, |e| e == &p.username)); + .find(|e| e.token.as_ref().map_or(false, |e| e == &p.name)); match profile { Some(profile) => { info!("login as {:?}", profile.username); - p.username = profile.username.clone(); + p.name = profile.username.clone(); } None => bail!("no profile found, disconnecting client"), } p } + ServerboundLoginPacket::LoginAcknowledged(_) => bail!("wtf?"), ServerboundLoginPacket::Key(_) => bail!("key not supported"), - ServerboundLoginPacket::CustomQuery(_) => bail!("custom query not supported"), + ServerboundLoginPacket::CustomQueryAnswer(_) => bail!("custom query not supported"), }; let upstream = TcpStream::connect(config.backend).await?; |