-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
397817b
commit 41a3d88
Showing
6 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// The implementation. | ||
pub mod service; | ||
/// All types used by the implementation. | ||
pub mod types; | ||
|
||
pub use service::*; | ||
pub use types::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters