Files
AstralRinth/packages/app-lib/src/util/server_ping/mod.rs
T
aecsocket d14360aba5 Unify server pinging implementations between app and backend (#5510)
* Improve ping impl to bring parity to app lib impl

* Fix issue with new impl

* fix labrinth compile

* wip: why do servers not provide server info..

* Fix ping impl overriding port

* fix theseus_gui

* remove unneeded recursion lmit
2026-03-13 16:21:09 +00:00

44 lines
1.2 KiB
Rust

use serde::{Deserialize, Serialize};
use serde_json::value::RawValue;
use url::Url;
#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ServerStatus {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<Box<RawValue>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub players: Option<ServerPlayers>,
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<ServerVersion>,
#[serde(skip_serializing_if = "Option::is_none")]
pub favicon: Option<Url>,
#[serde(default)]
pub enforces_secure_chat: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub ping: Option<i64>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ServerPlayers {
pub max: Option<i32>,
pub online: Option<i32>,
#[serde(default)]
pub sample: Vec<ServerGameProfile>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ServerGameProfile {
pub id: String,
pub name: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ServerVersion {
pub name: String,
pub protocol: i32,
#[serde(skip_deserializing)]
pub legacy: bool,
}