mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
Edited README.md
This commit is contained in:
parent
7b44c5f7eb
commit
e36161ce5a
4 changed files with 64 additions and 33 deletions
41
README.md
41
README.md
|
|
@ -7,23 +7,54 @@ MSRV is `1.58.1` and the code is cross-platform.
|
||||||
To see the supported (or the planned to support) games/services/protocols, see [GAMES](GAMES.md), [SERVICES](SERVICES.md) and [PROTOCOLS](PROTOCOLS.md) respectively.
|
To see the supported (or the planned to support) games/services/protocols, see [GAMES](GAMES.md), [SERVICES](SERVICES.md) and [PROTOCOLS](PROTOCOLS.md) respectively.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Just pick a game/service/protocol, provide the ip and the port (can be optional) then query on it.
|
Just pick a game/service/protocol, provide the ip and the port (can be optional) then query on it.
|
||||||
|
Team Fortress 2 query example:
|
||||||
```rust
|
```rust
|
||||||
use gamedig::games::tf2;
|
use gamedig::games::tf2;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let response = tf2::query("91.216.250.10", None); //or Some(27015), None is the default protocol port
|
let response = tf2::query("localhost", None); //or Some(27015), None is the default protocol port
|
||||||
match response {
|
match response {
|
||||||
Err(error) => println!("Couldn't query, error: {error}"),
|
Err(error) => println!("Couldn't query, error: {error}"),
|
||||||
Ok(r) => println!("{:?}", r)
|
Ok(r) => println!("{:#?}", r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Response:
|
||||||
|
```json5
|
||||||
|
{
|
||||||
|
protocol: 17,
|
||||||
|
name: "Team Fortress 2 Dedicated Server!",
|
||||||
|
map: "ctf_turbine",
|
||||||
|
game: "tf2",
|
||||||
|
players: 0,
|
||||||
|
players_details: [],
|
||||||
|
max_players: 69,
|
||||||
|
bots: 0,
|
||||||
|
server_type: Dedicated,
|
||||||
|
has_password: false,
|
||||||
|
vac_secured: true,
|
||||||
|
version: "7638371",
|
||||||
|
port: Some(27015),
|
||||||
|
steam_id: Some(69753253289735296),
|
||||||
|
tv_port: None,
|
||||||
|
tv_name: None,
|
||||||
|
keywords: Some("alltalk,arena,nocrits"),
|
||||||
|
rules: [
|
||||||
|
ServerRule {
|
||||||
|
name: "mp_autoteambalance",
|
||||||
|
value: "1",
|
||||||
|
}
|
||||||
|
//....
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
To see more examples, see the [examples](examples) folder.
|
To see more examples, see the [examples](examples) folder.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
The documentation is available at [docs.rs](https://docs.rs/gamedig/latest/gamedig/).
|
The documentation is available at [docs.rs](https://docs.rs/gamedig/latest/gamedig/).
|
||||||
Curious about the history and what changed between versions? you can see just that in the [CHANGELOG](CHANGELOG.md) file.
|
Curious about the history and what changed between versions? Check out the [CHANGELOG](CHANGELOG.md) file.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
If you want see your favorite game/service being supported here, open an issue, and I'll prioritize it! (or do a pull request if you want to implement it yourself)
|
If you want see your favorite game/service being supported here, open an issue, and I'll prioritize it (or do a pull request if you want to implement it yourself)!
|
||||||
|
|
|
||||||
|
|
@ -26,30 +26,30 @@ fn main() -> GDResult<()> {
|
||||||
};
|
};
|
||||||
|
|
||||||
match args[1].as_str() {
|
match args[1].as_str() {
|
||||||
"aliens" => println!("{:?}", aliens::query(ip, port)?),
|
"aliens" => println!("{:#?}", aliens::query(ip, port)?),
|
||||||
"asrd" => println!("{:?}", asrd::query(ip, port)?),
|
"asrd" => println!("{:#?}", asrd::query(ip, port)?),
|
||||||
"csgo" => println!("{:?}", csgo::query(ip, port)?),
|
"csgo" => println!("{:#?}", csgo::query(ip, port)?),
|
||||||
"css" => println!("{:?}", css::query(ip, port)?),
|
"css" => println!("{:#?}", css::query(ip, port)?),
|
||||||
"dods" => println!("{:?}", dods::query(ip, port)?),
|
"dods" => println!("{:#?}", dods::query(ip, port)?),
|
||||||
"gm" => println!("{:?}", gm::query(ip, port)?),
|
"gm" => println!("{:#?}", gm::query(ip, port)?),
|
||||||
"hl2dm" => println!("{:?}", hl2dm::query(ip, port)?),
|
"hl2dm" => println!("{:#?}", hl2dm::query(ip, port)?),
|
||||||
"tf2" => println!("{:?}", tf2::query(ip, port)?),
|
"tf2" => println!("{:#?}", tf2::query(ip, port)?),
|
||||||
"insmic" => println!("{:?}", insmic::query(ip, port)?),
|
"insmic" => println!("{:#?}", insmic::query(ip, port)?),
|
||||||
"ins" => println!("{:?}", ins::query(ip, port)?),
|
"ins" => println!("{:#?}", ins::query(ip, port)?),
|
||||||
"inss" => println!("{:?}", inss::query(ip, port)?),
|
"inss" => println!("{:#?}", inss::query(ip, port)?),
|
||||||
"l4d" => println!("{:?}", l4d::query(ip, port)?),
|
"l4d" => println!("{:#?}", l4d::query(ip, port)?),
|
||||||
"l4d2" => println!("{:?}", l4d2::query(ip, port)?),
|
"l4d2" => println!("{:#?}", l4d2::query(ip, port)?),
|
||||||
"ts" => println!("{:?}", ts::query(ip, port)?),
|
"ts" => println!("{:#?}", ts::query(ip, port)?),
|
||||||
"cscz" => println!("{:?}", cscz::query(ip, port)?),
|
"cscz" => println!("{:#?}", cscz::query(ip, port)?),
|
||||||
"dod" => println!("{:?}", dod::query(ip, port)?),
|
"dod" => println!("{:#?}", dod::query(ip, port)?),
|
||||||
"mc" => println!("{:?}", mc::query(ip, port)?),
|
"mc" => println!("{:#?}", mc::query(ip, port)?),
|
||||||
"mc_java" => println!("{:?}", mc::query_specific(Server::Java, ip, port)?),
|
"mc_java" => println!("{:#?}", mc::query_specific(Server::Java, ip, port)?),
|
||||||
"mc_legacy_vb1_8" => println!("{:?}", mc::query_specific(Server::Legacy(LegacyGroup::VB1_8), ip, port)?),
|
"mc_legacy_vb1_8" => println!("{:#?}", mc::query_specific(Server::Legacy(LegacyGroup::VB1_8), ip, port)?),
|
||||||
"mc_legacy_v1_4" => println!("{:?}", mc::query_specific(Server::Legacy(LegacyGroup::V1_4), ip, port)?),
|
"mc_legacy_v1_4" => println!("{:#?}", mc::query_specific(Server::Legacy(LegacyGroup::V1_4), ip, port)?),
|
||||||
"mc_legacy_v1_6" => println!("{:?}", mc::query_specific(Server::Legacy(LegacyGroup::V1_6), ip, port)?),
|
"mc_legacy_v1_6" => println!("{:#?}", mc::query_specific(Server::Legacy(LegacyGroup::V1_6), ip, port)?),
|
||||||
"_src" => println!("{:?}", valve::query(ip, 27015, App::Source(None), None, None)?),
|
"_src" => println!("{:#?}", valve::query(ip, 27015, App::Source(None), None, None)?),
|
||||||
"_gld" => println!("{:?}", valve::query(ip, 27015, App::GoldSrc(false), None, None)?),
|
"_gld" => println!("{:#?}", valve::query(ip, 27015, App::GoldSrc(false), None, None)?),
|
||||||
"_gld_f" => println!("{:?}", valve::query(ip, 27015, App::GoldSrc(true), None, None)?),
|
"_gld_f" => println!("{:#?}", valve::query(ip, 27015, App::GoldSrc(true), None, None)?),
|
||||||
_ => panic!("Undefined game: {}", args[1])
|
_ => panic!("Undefined game: {}", args[1])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
use gamedig::games::mc;
|
use gamedig::games::mc;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let response = mc::query("localhost", None); //or Some(25565), None is the default protocol port (which is 25565)
|
let response = mc::query("cosminperram.com", Some(26062)); //or Some(25565), None is the default protocol port (which is 25565)
|
||||||
match response {
|
match response {
|
||||||
Err(error) => println!("Couldn't query, error: {error}"),
|
Err(error) => println!("Couldn't query, error: {error}"),
|
||||||
Ok(r) => println!("{:?}", r)
|
Ok(r) => println!("{:#?}", r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
use gamedig::games::tf2;
|
use gamedig::games::tf2;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let response = tf2::query("cosminperram.com", None); //or Some(27015), None is the default protocol port (which is 27015)
|
let response = tf2::query("localhost", None); //or Some(27015), None is the default protocol port (which is 27015)
|
||||||
match response {
|
match response {
|
||||||
Err(error) => println!("Couldn't query, error: {error}"),
|
Err(error) => println!("Couldn't query, error: {error}"),
|
||||||
Ok(r) => println!("{:?}", r)
|
Ok(r) => println!("{:#?}", r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue