1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//! # rust-mc-status
//!
//! High-performance asynchronous Rust library for querying Minecraft server
//! status — Java Edition and Bedrock Edition.
//!
//! ## Quick start
//!
//! ```rust,no_run
//! use rust_mc_status::{ping_java, ping_bedrock, StatusExt};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), rust_mc_status::McError> {
//! // One-shot facade — no setup required
//! let java = ping_java("mc.hypixel.net").await?;
//! println!("{} — {} ms", java.motd_clean(), java.latency_ms() as u32);
//!
//! let bedrock = ping_bedrock("geo.hivebedrock.network").await?;
//! println!("{} [{}]", bedrock.motd_clean(), bedrock.edition());
//! Ok(())
//! }
//! ```
//!
//! ## Using a client
//!
//! Build a [`McClient`] when you need custom timeouts, caching, or a proxy.
//! `McClient::builder()` is the **only** constructor — there is no `new()`.
//!
//! ```rust,no_run
//! use rust_mc_status::{McClient, StatusExt};
//! use std::time::Duration;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), rust_mc_status::McError> {
//! let client = McClient::builder()
//! .timeout(Duration::from_secs(5))
//! .max_parallel(20)
//! .response_cache(Duration::from_secs(30), 256)
//! .build();
//!
//! let status = client.java("mc.hypixel.net").await?;
//! println!("{}", status.display_players()); // "21000/200000"
//! println!("{:.0} ms", status.latency_ms());
//! println!("cached: {}", status.is_cached());
//! Ok(())
//! }
//! ```
//!
//! ## Batch pings
//!
//! [`McClient::ping_many`] pings multiple servers concurrently using a
//! semaphore — slow or timed-out servers never block the rest.
//!
//! ```rust,no_run
//! use rust_mc_status::{McClient, ServerEdition, ServerInfo};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), rust_mc_status::McError> {
//! let client = McClient::builder().max_parallel(10).build();
//! let servers = vec![
//! ServerInfo { address: "mc.hypixel.net".into(), edition: ServerEdition::Java },
//! ServerInfo { address: "geo.hivebedrock.network".into(), edition: ServerEdition::Bedrock },
//! ];
//! for (server, result) in client.ping_many(&servers).await {
//! match result {
//! Ok(s) => println!("{} — {} ms", server.address, s.latency),
//! Err(e) => println!("{} — ❌ {e}", server.address),
//! }
//! }
//! Ok(())
//! }
//! ```
//!
//! ## Error handling
//!
//! [`McError`] is a two-level hierarchy — match broadly or drill into details:
//!
//! ```rust,no_run
//! use rust_mc_status::{McClient, McError, StatusExt};
//! use rust_mc_status::error::{NetworkError, ProtocolError};
//!
//! #[tokio::main]
//! async fn main() {
//! let client = McClient::builder().build();
//! match client.java("mc.hypixel.net").await {
//! Ok(s) => println!("online: {}", s.display_players()),
//! Err(McError::Network(NetworkError::Timeout)) => println!("timed out"),
//! Err(McError::Network(NetworkError::Dns(msg))) => println!("DNS: {msg}"),
//! Err(McError::Protocol(ProtocolError::InvalidResponse(msg))) => println!("bad packet: {msg}"),
//! Err(e) => println!("other: {e}"),
//! }
//! }
//! ```
//!
//! ## Optional features
//!
//! | Feature | What it adds |
//! |---------|-------------|
//! | `proxy` | SOCKS5 and HTTP CONNECT proxy support via [`ProxyConfig`] |
//! | `tower` | [`McService`] — wrap `McClient` in Tower middleware (retries, rate-limiting, etc.) |
//! | `full` | Both `proxy` and `tower` |
//!
//! ```toml
//! [dependencies]
//! rust-mc-status = { version = "3", features = ["full"] }
//! ```
//!
//! ## Crate structure
//!
//! | Module | Contents |
//! |--------|----------|
//! | *(root)* | [`McClient`], [`McClientBuilder`], [`ping_java`], [`ping_bedrock`] |
//! | [`error`] | [`McError`] and sub-error types |
//! | [`models`] | [`ServerStatus`], [`ServerData`], [`JavaStatus`], [`BedrockStatus`], etc. |
//! | [`status`] | [`JavaServerStatus`], [`BedrockServerStatus`], [`StatusExt`] trait |
//! | [`proxy`] | [`ProxyConfig`] *(feature = "proxy")* |
//! | [`service`] | [`McService`], [`McRetryPolicy`] *(feature = "tower")* |
//! | [`core`] | Internal DNS resolver, response cache, address parser *(not stable API)* |
pub use ;
pub use ;
pub use ;
pub use ProxyError;
pub use *;
pub use CacheStats;
pub use ;
pub use ;
pub use ;
pub use ;