View Source A2S (elixir_a2s v0.4.3)
A collection of pure functions for forming A2S challenges, requests, and parsing responses.
Summary
Functions
Returns the challenge request packet for the given query type.
Parses a challenge response packet. 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.
Functions
@spec challenge_request(:info | :players | :rules) :: binary()
Returns the challenge request packet for the given query type.
@spec parse_challenge(binary()) :: {:challenge, binary()} | {:immediate, {:info, A2S.Info.t()}} | {:immediate, {:players, A2S.Players.t()}} | {:immediate, {:rules, A2S.Rules.t()}} | {:multipacket, {A2S.MultiPacketHeader.t(), binary()}} | {:error, A2S.ParseError.t()}
Parses a challenge response packet. 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 multipacket, :multipacket
will be returned.
@spec parse_challenge!(binary()) :: {:challenge, binary()} | {:immediate, {:info, A2S.Info.t()}} | {:immediate, {:players, A2S.Players.t()}} | {:immediate, {:rules, A2S.Rules.t()}} | {:multipacket, {A2S.MultiPacketHeader.t(), binary()}}
@spec parse_multipacket_response([{A2S.MultiPacketHeader.t(), binary()}]) :: {:info, A2S.Info.t()} | {:players, A2S.Player.t()} | {:rules, A2S.Rules.t()} | {:error, A2S.ParseError.t()}
@spec parse_multipacket_response!([{A2S.MultiPacketHeader.t(), binary()}]) :: {:info, A2S.Info.t()} | {:players, A2S.Player.t()} | {:rules, A2S.Rules.t()}
@spec parse_response(binary()) :: {:info, A2S.Info.t()} | {:multipacket, {A2S.MultiPacketHeader.t(), binary()}} | {:players, A2S.Players.t()} | {:rules, A2S.Rules.t()} | {:error, A2S.ParseError.t()}
@spec parse_response!(binary()) :: {:info, A2S.Info.t()} | {:players, A2S.Player.t()} | {:rules, A2S.Rules.t()} | {:multipacket, {A2S.MultiPacketHeader.t(), binary()}}