mirror of
https://github.com/Tribufu/rust-gamedig
synced 2026-08-17 19:01:06 +00:00
feat: add Ark: Survival Ascended support (#197)
* feat: add initial epic client auth call * fix: working client auth * feat: unfinished initial EOS query * first successful query * first successful server query * run fmt * be a bit more detailed about servers * properly run fmt for sure this time fr fr * port of what node gamedig has done * feat: remove query_raw_values to query_raw * feat: add raw field to epic response * feat: pass SocketAddr to epic * feat: remove unused pub access to internal only struct * feat: add initial generic impl * fix: possibly conditional comp * feat: add epic to the protocol list * feat: add version and add epic to RESPONSES.md * feat: add asa to definitions * feat: add initial protocol macros * feat: conditional serde ser and des * fix: cfg serde stuff * fix: epic macro warn dead code * partial feature gate epic to tls * fix: remove asa from game definitions
This commit is contained in:
parent
1620ba36b8
commit
45ffa53de3
15 changed files with 434 additions and 81 deletions
58
crates/lib/src/protocols/epic/mod.rs
Normal file
58
crates/lib/src/protocols/epic/mod.rs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/// The implementation.
|
||||
pub mod protocol;
|
||||
/// All types used by the implementation.
|
||||
pub mod types;
|
||||
|
||||
pub use protocol::*;
|
||||
pub use types::*;
|
||||
|
||||
/// Generate a module containing a query function for an epic (EOS) game.
|
||||
///
|
||||
/// * `mod_name` - The name to be given to the game module (see ID naming
|
||||
/// conventions in CONTRIBUTING.md).
|
||||
/// * `pretty_name` - The full name of the game, will be used as the
|
||||
/// documentation for the created module.
|
||||
/// * `steam_app`, `default_port` - Passed through to [game_query_fn].
|
||||
#[cfg(feature = "games")]
|
||||
macro_rules! game_query_mod {
|
||||
($mod_name: ident, $pretty_name: expr, $default_port: literal, $credentials: expr) => {
|
||||
#[doc = $pretty_name]
|
||||
pub mod $mod_name {
|
||||
use crate::protocols::epic::Credentials;
|
||||
|
||||
crate::protocols::epic::game_query_fn!($pretty_name, $default_port, $credentials);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "games")]
|
||||
pub(crate) use game_query_mod;
|
||||
|
||||
/// Generate a query function for an epic (EOS) game.
|
||||
///
|
||||
/// * `default_port` - The default port the game uses.
|
||||
/// * `credentials` - Credentials to access EOS.
|
||||
#[cfg(feature = "games")]
|
||||
macro_rules! game_query_fn {
|
||||
($pretty_name: expr, $default_port: literal, $credentials: expr) => {
|
||||
crate::protocols::epic::game_query_fn! {@gen $default_port, concat!(
|
||||
"Make a Epic query for ", $pretty_name, ".\n\n",
|
||||
"If port is `None`, then the default port (", stringify!($default_port), ") will be used."), $credentials}
|
||||
};
|
||||
|
||||
(@gen $default_port: literal, $doc: expr, $credentials: expr) => {
|
||||
#[doc = $doc]
|
||||
pub fn query(
|
||||
address: &std::net::IpAddr,
|
||||
port: Option<u16>,
|
||||
) -> crate::GDResult<crate::protocols::epic::Response> {
|
||||
crate::protocols::epic::query(
|
||||
$credentials,
|
||||
&std::net::SocketAddr::new(*address, port.unwrap_or($default_port)),
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "games")]
|
||||
pub(crate) use game_query_fn;
|
||||
Loading…
Add table
Add a link
Reference in a new issue