Rust Minecraft Server Status Library
Fork of NameOfShadow/rust-mc-status
A high-performance, asynchronous Rust library for querying the status of both Minecraft Java Edition and Bedrock Edition servers.
Features
- Dual Protocol Support: Ping both Minecraft Java Edition (
25565) and Bedrock Edition (19132) servers. - DNS SRV Record Support (New Feature): Automatically resolves DNS SRV records (
_minecraft._tcp) for Java Edition servers when no port is specified, matching native Minecraft client behavior. - Async/Await: Built on Tokio for non-blocking operations and high concurrency.
- Batch Queries: Ping multiple servers in parallel with configurable concurrency limits.
- DNS Caching (New Feature): Automatically caches DNS lookups and SRV records to reduce latency for repeated queries.
- Structured Data: Returns richly structured, serializable data (using
serde), including version info, player counts, MOTD, map, gamemode, plugins, mods and more. - Favicon Handling: Easily retrieve and save the server's favicon (Java Edition only).
- Robust Error Handling: Comprehensive error types using
thiserror. - Extended Information: Detailed data about plugins, mods, DNS and more.
Installation
Add this to your Cargo.toml:
[]
= "1.0.0"
= { = "*", = ["full"] }
Usage
Basic Example
use ;
use Duration;
async
Advanced Example
See examples/advanced_usage.rs for a demonstration of all the new library features.
Key Structs and Methods
McClient: The main client for making requests.new(),with_timeout(),with_max_parallel()ping(address, edition): Ping a single server.ping_many(servers): Ping multiple servers in parallel.
ServerStatus: The result of a successful ping.online:boolip:String- Server IP addressport:u16- Server porthostname:String- Hostnamelatency:f64- Latency in msdns:Option<DnsInfo>- DNS informationdata:ServerData(enum containing eitherJavaStatusorBedrockStatus)
JavaStatus: Contains detailed information from a Java server.version: Version informationplayers: Player informationdescription: Server description (MOTD)map: Map namegamemode: Game modesoftware: Server softwareplugins: List of pluginsmods: List of modssave_favicon(filename): Saves the server icon to a PNG file.
BedrockStatus: Contains information from a Bedrock server.edition: Minecraft editionmotd: Message of the dayversion: Server versiononline_players: Online players countmax_players: Maximum playersmap: Map namesoftware: Server softwaregame_mode: Game mode
License
This project is licensed under the MIT License - see the LICENSE file for details.