aboutsummaryrefslogtreecommitdiff
path: root/minecraft-protocol/src/server_status_pinger.rs
diff options
context:
space:
mode:
Diffstat (limited to 'minecraft-protocol/src/server_status_pinger.rs')
-rw-r--r--minecraft-protocol/src/server_status_pinger.rs44
1 files changed, 0 insertions, 44 deletions
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())?,
- })
-}