pub struct ServerStatus {
pub online: bool,
pub ip: String,
pub port: u16,
pub hostname: String,
pub latency: f64,
pub dns: Option<DnsInfo>,
pub data: ServerData,
}Expand description
Server status information.
This structure contains all information about a Minecraft server’s status. Even if the server is offline, some fields may still be populated (e.g., DNS info).
§Example
use rust_mc_status::{McClient, ServerEdition};
let client = McClient::new();
let status = client.ping("mc.hypixel.net", ServerEdition::Java).await?;
println!("Hostname: {}", status.hostname);
println!("IP: {}", status.ip);
println!("Port: {}", status.port);
println!("Online: {}", status.online);
println!("Latency: {:.2}ms", status.latency);Fields§
§online: boolWhether the server is online and responding.
This field is always true for successful pings. If the server
is offline or unreachable, the ping() method returns an error instead.
ip: StringResolved IP address of the server.
This is the actual IP address that was connected to, which may differ from the hostname if SRV records were used or if the hostname resolves to multiple IP addresses.
Example: "172.65.197.160"
port: u16Port number of the server.
This is the actual port that was connected to. For Java servers, this may differ from the default port (25565) if an SRV record was found.
Example: 25565 (Java) or 19132 (Bedrock)
hostname: StringOriginal hostname used for the query.
This is the hostname that was provided to the ping() method, before
any DNS resolution or SRV lookup.
Example: "mc.hypixel.net"
latency: f64Latency in milliseconds.
This is the round-trip time (RTT) from sending the ping request to receiving the response. Lower values indicate better network connectivity.
Example: 45.23 (45.23 milliseconds)
dns: Option<DnsInfo>Optional DNS information (A records, CNAME, TTL).
This field contains DNS resolution details if available. It may be None
if DNS information could not be retrieved or if an IP address was used
directly instead of a hostname.
data: ServerDataServer data (Java or Bedrock specific information).
This field contains edition-specific server information including version, players, plugins, mods, and more. Use pattern matching to access the data:
match data {
ServerData::Java(java) => println!("Java server: {}", java.version.name),
ServerData::Bedrock(bedrock) => println!("Bedrock server: {}", bedrock.version),
}Implementations§
Trait Implementations§
Source§impl Clone for ServerStatus
impl Clone for ServerStatus
Source§fn clone(&self) -> ServerStatus
fn clone(&self) -> ServerStatus
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more