Skip to main content

Crate ssq

Crate ssq 

Source
Expand description

Source Server Query (SSQ) client library.

Implements the Source A2S query protocol for querying game servers running on the Source engine.

§Quick start

use std::time::Duration;
use ssq::Client;

let client = Client::new(Duration::from_secs(5)).unwrap();
let info = client.info("127.0.0.1:27015").unwrap();
println!("{}: {}/{}", info.name, info.players, info.max_players);

§Async

Enable the async feature for a tokio-based async client at nonblocking::Client.

let client = ssq::nonblocking::Client::new().await.unwrap();
let info = client.info("127.0.0.1:27015").await.unwrap();

§Parsing raw response data

If you already have raw response bytes (e.g. from a packet capture), you can parse them directly without a client:

use ssq::info::Info;
use ssq::players::Player;
use ssq::rules::Rule;
use ssq::DeOptions;

// let info = Info::from_reader(info_bytes).unwrap();
// let players = Player::from_reader(player_bytes, &DeOptions::default()).unwrap();
// let rules = Rule::from_reader(rules_bytes).unwrap();

§Features

  • async – tokio-based async client (nonblocking module)
  • serialization – serde Serialize/Deserialize on all response types
  • arma3 – Arma 3 / DayZ server browser protocol parser (rules::arma3)
  • arbitraryarbitrary::Arbitrary implementations for fuzzing

Modules§

errors
Error types returned by query and parsing operations.
info
A2S_INFO query and response types.
nonblocking
Async (tokio) client. Requires the async feature. Async (tokio) client for A2S queries.
players
A2S_PLAYER query and response types.
rules
A2S_RULES query and response types.

Structs§

AppId
A Steam Application ID.
Client
Blocking UDP client for sending A2S queries to Source game servers.
DeOptions
Options that control deserialization of server responses.
GameId
A 64-bit Game ID. The low 24 bits contain a more accurate App ID than the 16-bit AppId field.
SteamId
A 64-bit Steam ID identifying a user or server.

Constants§

HEADER_CHALLENGE
Response header byte indicating a challenge response.
HEADER_INFO
Response header byte for A2S_INFO replies.
HEADER_PLAYER
Response header byte for A2S_PLAYER replies.
HEADER_RULES
Response header byte for A2S_RULES replies.