From 9642558f8f8d983a7087f15d68be8cf07a85f0c2 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 15 Dec 2021 23:10:55 -0600 Subject: azalea --- minecraft-client/src/connect.rs | 53 ----------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 minecraft-client/src/connect.rs (limited to 'minecraft-client/src/connect.rs') diff --git a/minecraft-client/src/connect.rs b/minecraft-client/src/connect.rs deleted file mode 100644 index 5eedbf96..00000000 --- a/minecraft-client/src/connect.rs +++ /dev/null @@ -1,53 +0,0 @@ -///! Connect to Minecraft servers. -use minecraft_protocol::{ - connect::HandshakeConnection, - packets::{ - handshake::client_intention_packet::ClientIntentionPacket, - login::{serverbound_hello_packet::ServerboundHelloPacket, LoginPacket}, - ConnectionProtocol, PROTOCOL_VERSION, - }, - resolver, ServerAddress, -}; - -pub async fn join_server(address: &ServerAddress) -> Result<(), String> { - let username = "bot".to_string(); - - let resolved_address = resolver::resolve_address(address).await?; - - let mut conn = HandshakeConnection::new(&resolved_address).await?; - - // handshake - conn.write( - ClientIntentionPacket { - protocol_version: PROTOCOL_VERSION, - hostname: address.host.clone(), - port: address.port, - intention: ConnectionProtocol::Login, - } - .get(), - ) - .await; - let mut conn = conn.login(); - - // login start - conn.write(ServerboundHelloPacket { username }.get()).await; - - // encryption request - loop { - match conn.read().await.unwrap() { - LoginPacket::ClientboundHelloPacket(encryption_request_packet) => { - println!( - "Got encryption request {:?} {:?}", - encryption_request_packet.nonce, encryption_request_packet.public_key - ); - } - _ => (), - } - } - - // TODO: client auth - - // TODO: encryption response - - Ok(()) -} -- cgit v1.2.3