A class for querying Source game servers (e.g., GoldSource, Source Engine) using the A2S protocol. Supports retrieving server information, player information, and server rules.

const source = new Source('127.0.0.1', 27015);
const info = await source.getInfo();
console.log(info);

Constructors

  • Creates a new Source server query instance.

    Parameters

    • host: string

      The IP address or hostname of the server.

    • port: number

      The port number of the server.

    • timeout: number = 5000

      The timeout duration (in milliseconds) for server queries. Default is 5000.

    • debug: boolean = false

      Enables debug logging if true. Default is false.

    Returns Source

Methods

  • Retrieves server rules.

    Returns Promise<Record<string, string>>

    A promise that resolves with a map of server rules.