mc-ping

Crates.iomc-ping
lib.rsmc-ping
version0.0.20
created_at2025-08-10 10:16:12.861956+00
updated_at2025-08-10 16:58:14.104832+00
descriptionSimple Java Minecraft Server Pinger
homepage
repositoryhttps://github.com/cxdsad/mc-ping
max_upload_size
id1788768
size46,526
(cxdsad)

documentation

README

Minecraft Server Status Client (Rust)

This Rust crate provides functionality to perform Minecraft server status queries using the official Minecraft protocol handshake and status query packets.

It supports:

  • Establishing TCP connections (with optional DNS resolving).
  • Sending Minecraft handshake packets.
  • Sending status query packets.
  • Parsing the server's JSON status response into a Rust struct.

Features

  • Async/await based using Tokio.
  • Optional DNS resolving feature (enabled via resolve feature flag).
  • Parses JSON server status into typed Rust structs.
  • Socks5 proxy support.
  • Timeout support on connections.

Usage Example

use tokio::time::Duration;
use mc_ping::connection::Connection;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let addr = ("example.com".to_string(), 25565);

    // Connect to the server with a timeout of 5 seconds
    let mut connection = Connection::new(addr)
    connection = connection.timeout(5000)?.connect().await?

    // Perform handshake and status query
    let status = connection.ping().await?;

    println!("Server Status: {:?}", status);

    Ok(())
}
Commit count: 0

cargo fmt