mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 07:17:27 +00:00
feat: add minetest master server service (#209)
* feat: add minetest master server service" * restore tf2 example * chore: replace default with None * fix: make it available only on TLS and serde * docs: update changelog
This commit is contained in:
parent
397817b6d6
commit
41a3d88fb5
6 changed files with 78 additions and 3 deletions
|
|
@ -1,8 +1,9 @@
|
||||||
# Supported services:
|
# Supported services:
|
||||||
|
|
||||||
| Name | Documentation reference |
|
| Name | Documentation reference |
|
||||||
|---------------------|-------------------------------------------------------------------------------------------------------|
|
|------------------------|-------------------------------------------------------------------------------------------------------|
|
||||||
| Valve Master Server | [Master Server Query Protocol](https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol) |
|
| Valve Master Server | [Master Server Query Protocol](https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol) |
|
||||||
|
| MineTest Master Server | [Node-GameDig](https://github.com/gamedig/node-gamedig/blob/master/protocols/minetest.js) |
|
||||||
|
|
||||||
## Planned to add support:
|
## Planned to add support:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@ Games:
|
||||||
|
|
||||||
- [Soulmask](https://store.steampowered.com/app/2646460/Soulmask/) support.
|
- [Soulmask](https://store.steampowered.com/app/2646460/Soulmask/) support.
|
||||||
|
|
||||||
|
Services:
|
||||||
|
|
||||||
|
- MineTest Master Server support (available only on the `tls` and `serde` feature).
|
||||||
|
|
||||||
# 0.5.1 - 12/05/2024
|
# 0.5.1 - 12/05/2024
|
||||||
|
|
||||||
Games:
|
Games:
|
||||||
|
|
|
||||||
7
crates/lib/src/services/minetest_master_server/mod.rs
Normal file
7
crates/lib/src/services/minetest_master_server/mod.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
/// The implementation.
|
||||||
|
pub mod service;
|
||||||
|
/// All types used by the implementation.
|
||||||
|
pub mod types;
|
||||||
|
|
||||||
|
pub use service::*;
|
||||||
|
pub use types::*;
|
||||||
13
crates/lib/src/services/minetest_master_server/service.rs
Normal file
13
crates/lib/src/services/minetest_master_server/service.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
use crate::http::HttpClient;
|
||||||
|
use crate::minetest_master_server::types::Response;
|
||||||
|
use crate::{GDResult, TimeoutSettings};
|
||||||
|
|
||||||
|
pub fn query(timeout_settings: TimeoutSettings) -> GDResult<Response> {
|
||||||
|
let mut client = HttpClient::from_url(
|
||||||
|
"https://servers.minetest.net",
|
||||||
|
&Some(timeout_settings),
|
||||||
|
None,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
client.get_json("/list", None)
|
||||||
|
}
|
||||||
46
crates/lib/src/services/minetest_master_server/types.rs
Normal file
46
crates/lib/src/services/minetest_master_server/types.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
pub struct Server {
|
||||||
|
pub address: String,
|
||||||
|
pub clients: u32,
|
||||||
|
pub clients_list: Vec<String>,
|
||||||
|
pub clients_max: u32,
|
||||||
|
pub creative: bool,
|
||||||
|
pub damage: bool,
|
||||||
|
pub description: String,
|
||||||
|
pub game_time: u32,
|
||||||
|
pub gameid: String,
|
||||||
|
pub lag: Option<f32>,
|
||||||
|
pub name: String,
|
||||||
|
pub password: bool,
|
||||||
|
pub port: u16,
|
||||||
|
pub proto_max: u16,
|
||||||
|
pub proto_min: u16,
|
||||||
|
pub pvp: bool,
|
||||||
|
pub uptime: u32,
|
||||||
|
pub url: Option<String>,
|
||||||
|
pub version: String,
|
||||||
|
pub ip: String,
|
||||||
|
pub update_time: u32,
|
||||||
|
pub start: u32,
|
||||||
|
pub clients_top: u32,
|
||||||
|
pub updates: u32,
|
||||||
|
pub total_clients: u32,
|
||||||
|
pub pop_v: f32,
|
||||||
|
pub geo_continent: Option<String>,
|
||||||
|
pub ping: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
pub struct ServersClients {
|
||||||
|
pub servers: u32,
|
||||||
|
pub clients: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
pub struct Response {
|
||||||
|
pub total: ServersClients,
|
||||||
|
pub total_max: ServersClients,
|
||||||
|
pub list: Vec<Server>,
|
||||||
|
}
|
||||||
|
|
@ -2,3 +2,7 @@
|
||||||
|
|
||||||
/// Reference: [Master Server Query Protocol](https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol)
|
/// Reference: [Master Server Query Protocol](https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol)
|
||||||
pub mod valve_master_server;
|
pub mod valve_master_server;
|
||||||
|
|
||||||
|
/// Reference: [Node-GameDig](https://github.com/gamedig/node-gamedig/blob/master/protocols/minetest.js)
|
||||||
|
#[cfg(all(feature = "serde", feature = "tls"))]
|
||||||
|
pub mod minetest_master_server;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue