a2s-protocol-0.1.0 has been yanked.
a2s-protocol
A Rust protocol core for building A2S server query clients.
It parses Source and GoldSrc server responses, including legacy multipacket formats. Feed it UDP datagrams; it assembles fragments and decompresses compressed responses. You manage the socket and decide whether your client is blocking or async.
Features
- Parses A2S_INFO, A2S_PLAYER, and A2S_RULES responses
- Supports Source and GoldSrc response formats
- Reassembles Source and GoldSrc multipacket responses, including legacy and Orange Box variants
- Decompresses bzip2-compressed responses
- Borrows string fields from the input packet where possible; convert parsed values to owned data when needed
- Leaves networking and runtime choices to your application
Compatibility
| Response format | Support |
|---|---|
| Source single-packet responses | Yes |
| GoldSrc single-packet responses | Yes |
| Source multipacket responses | Yes |
| GoldSrc multipacket responses | Yes |
| Legacy and Orange Box fragment formats | Yes |
| Compressed multipacket responses | Yes |
How it fits into a client
The crate handles packet processing and payload parsing. Your client sends requests, receives datagrams, and responds to challenges.
use ;
let mut processor = new;
// For each UDP datagram received:
let Some = processor.process? else ;
match parse_payload?
See examples/query.rs for a complete blocking UDP client.
Scope
The crate implements the documented A2S protocol and includes support for The Ship's additional server information. It does not currently implement unofficial game-specific extensions such as Arma or DayZ extensions.
API overview
info_request,players_request,rules_requestbuild request packets.PacketProcessoraccepts datagrams and returns a complete packet when one is ready.parse_payloadparses the completed payload into aResponse.