1.5 KiB
1.5 KiB
mcquery
A tool for querying Minecraft servers
What does this crate provide?
- An asynchronous,
tokio
-based library - Two examples (basic and full queries)
Usage
To perform a query, call Query::get_basic
or Query::get_full
. The
returned response will either be a BasicQueryResponse
or a FullQueryResponse
respectively.
Examples
use mcquery::Query;
use std::time::Duration;
#[tokio::main]
async fn main() -> std::io::Result<()> {
let mut basic_query_buffer = [0; 128];
let basic_query = Query::get_basic(
"example.com:25565",
Duration::from_secs(5),
&mut basic_buffer
).await?;
println!("{:#?}", basic_query);
let mut full_query_buffer = [0; 1024];
let full_query = Query::get_full(
"example.com:25565",
Duration::from_secs(5),
&mut buffer
).await?;
println!("{:#?}", full_query);
Ok(())
}
Participation
Feel free to help resolve issues, create new ones, or open a pull request.
What's next?
- Synchronous queries for those who want them
- A
Packet
trait (currently async trait functions are not supported by Rust) orRequest
/Response
structs
Development resources
Thank you to the Tokio project and the Minecraft Developer Wiki for providing a great asynchronous runtime and useful documentation! Without them, this crate wouldn't be possible.
License
This project is either licensed under the MIT or the Apache 2.0 license.