diff options
Diffstat (limited to 'minecraft-protocol')
| -rw-r--r-- | minecraft-protocol/src/lib.rs | 1 | ||||
| -rw-r--r-- | minecraft-protocol/src/server_status.rs | 6 | ||||
| -rw-r--r-- | minecraft-protocol/src/server_status_pinger.rs | 44 |
3 files changed, 0 insertions, 51 deletions
diff --git a/minecraft-protocol/src/lib.rs b/minecraft-protocol/src/lib.rs index aaf3da50..5d6c8330 100644 --- a/minecraft-protocol/src/lib.rs +++ b/minecraft-protocol/src/lib.rs @@ -7,7 +7,6 @@ pub mod connection; pub mod mc_buf; pub mod packets; pub mod resolver; -pub mod server_status_pinger; #[derive(Debug)] pub struct ServerAddress { diff --git a/minecraft-protocol/src/server_status.rs b/minecraft-protocol/src/server_status.rs deleted file mode 100644 index 93480aaf..00000000 --- a/minecraft-protocol/src/server_status.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct ServerStatus { - description: Component, - players: Players, - version: Version, - favicon: String, -} diff --git a/minecraft-protocol/src/server_status_pinger.rs b/minecraft-protocol/src/server_status_pinger.rs deleted file mode 100644 index 0c1f2076..00000000 --- a/minecraft-protocol/src/server_status_pinger.rs +++ /dev/null @@ -1,44 +0,0 @@ -use crate::{ - connection::Connection, - packets::{ - handshake::client_intention_packet::ClientIntentionPacket, - status::{ - clientbound_status_response_packet::ClientboundStatusResponsePacket, - serverbound_status_request_packet::ServerboundStatusRequestPacket, - }, - ConnectionProtocol, Packet, PacketTrait, - }, - resolver, ServerAddress, -}; - -pub async fn ping_server( - address: &ServerAddress, -) -> Result<ClientboundStatusResponsePacket, String> { - let resolved_address = resolver::resolve_address(address).await?; - - let mut conn = Connection::new(&resolved_address).await?; - - // send the client intention packet and switch to the status state - conn.send_packet( - ClientIntentionPacket { - protocol_version: 757, - hostname: address.host.clone(), - port: address.port, - intention: ConnectionProtocol::Status, - } - .get(), - ) - .await; - conn.switch_state(ConnectionProtocol::Status); - - // send the empty status request packet - conn.send_packet(ServerboundStatusRequestPacket {}.get()) - .await; - - let packet = conn.read_packet().await.unwrap(); - - Ok(match packet { - Packet::ClientboundStatusResponsePacket(p) => p, - _ => Err("Invalid packet type".to_string())?, - }) -} |
