mirror of
https://github.com/Tribufu/rust-gamedig
synced 2026-08-11 08:01:06 +00:00
* 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
58 lines
1.9 KiB
Rust
58 lines
1.9 KiB
Rust
/// 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;
|