3 个版本
0.1.2 | 2022年9月13日 |
---|---|
0.1.1 | 2022年5月26日 |
0.1.0 | 2022年5月26日 |
#24 in #wiki
12KB
193 行
Rust版的gophertunnel/query
使用状态ping获取Minecraft信息的库 https://wiki.vg/Server_List_Ping#Client_to_server
安装
添加到Cargo.toml [依赖项]
mcpe_query = "0.1.2"
基本用法
查询默认超时时间为5秒。
let uri = "play.redmc.me:19132";
let info = mcpe_query::handle(uri, None).unwrap();
println!("{:?}", info);
超时
let uri = "play.redmc.me:19132";
let timeout = std::time::Duration::from_secs(10); // 10 seconds
let info = mcpe_query::handle(uri, Some(timeout)).unwrap();
println!("{:?}", info);
示例响应信息
Information {
players: ["Arial w", "darly4990", "LegendAdam3456", "BugraBcrr00", "RTshadow6686"],
other: {
"hostip": "0.0.0.0",
"maxplayers": "60",
"hostport": "19132",
"hostname": "RedMC",
"numplayers": "10",
"map": "Spawn",
"plugins": "PocketMine-MP 4.7.1+dev",
"gametype": "SMP",
"version": "v1.19.21",
"server_engine": "PocketMine-MP 4.7.1+dev",
"whitelist": "off",
"game_id": "MINECRAFTPE"
}
}
依赖项
~560KB