rust-gamedig/src/protocols/mod.rs
Tom 6c1fdb1159
[Generic] Add struct for all extra request settings (#93)
* [Generic] Add struct for all extra request settings

Adds a new struct `ExtraRequestSettings` that contains all possible
extra settings for all protocols, and can be implicitly converted with
`.into()` into each protocol's extra settings type.

This is then used in a new query method
`query_with_timeout_and_extra_settings()` that passes the object on to
the selected protocol.

This also updates the generic example to set some of these generic
settings so that it can be used for certain queries like
"mc.hypixel.net".

* [Minecraft] Add `request_settings` parameter to auto query

This allows generic queries to pass through request settings when using
the `mc` game so that servers like `mc.hypixel.net` will still work when
using auto query.

* Fix generic examples tests (and enable example tests in pre-commit)
2023-09-05 01:13:12 +03:00

18 lines
788 B
Rust

//! Protocols that are currently implemented.
//!
//! A protocol will be here if it supports multiple entries, if not, its
//! implementation will be in that specific needed place, a protocol can be
//! independently queried.
/// Reference: [node-GameDig](https://github.com/gamedig/node-gamedig/blob/master/protocols/gamespy1.js)
pub mod gamespy;
/// Reference: [Server List Ping](https://wiki.vg/Server_List_Ping)
pub mod minecraft;
/// Reference: [node-GameDig](https://github.com/gamedig/node-gamedig/blob/master/protocols/quake1.js)
pub mod quake;
/// General types that are used by all protocols.
pub mod types;
/// Reference: [Server Query](https://developer.valvesoftware.com/wiki/Server_queries)
pub mod valve;
pub use types::{ExtraRequestSettings, GenericResponse, Protocol};