View Source A2S (a2s v0.2.5)

A set of process-less functions for forming A2S challenges, requests, and parsing responses.

Link to this section Summary

Functions

Parses a challenge response payload. Some game servers don't implement the challenge flow and will immediately respond with the requested data. In that case :immediate will be returned with the data.

Link to this section Functions

@spec challenge_request(:info | :players | :rules) :: binary()
@spec parse_challenge(binary()) ::
  {:challenge, binary()}
  | {:immediate,
     {:info, A2S.Info.t()}
     | {:players, A2S.Players.t()}
     | {:rules, A2S.Rules.t()}}
  | {:multipart, {A2S.MultiPacketHeader.t(), binary()}}
  | {:error, :compression_not_supported}

Parses a challenge response payload. Some game servers don't implement the challenge flow and will immediately respond with the requested data. In that case :immediate will be returned with the data.

If the server returns data immediately, and that data is multipart, :multipart will be returned.

Link to this function

parse_multipacket_response(packets)

View Source
@spec parse_multipacket_response([{A2S.MultiPacketHeader.t(), binary()}]) ::
  {:info, A2S.Info.t()}
  | {:players, A2S.Player.t()}
  | {:rules, A2S.Rules.t()}
  | {:error, any()}
@spec parse_response(binary()) ::
  {:info, A2S.Info.t()}
  | {:players, A2S.Player.t()}
  | {:rules, A2S.Rules.t()}
  | {:multipart, {A2S.MultiPacketHeader.t(), binary()}}
  | {:error, :compression_not_supported}
Link to this function

sign_challenge(atom, challenge)

View Source
@spec sign_challenge(:info | :players | :rules, binary()) :: binary()