Skip to content

hfern/sourceq

Repository files navigation

Source Query

Command line query tool for source servers. Basically a head for goseq. Use it to get source server lists from the Valve's master servers (or a custom, ip-specified one).

Installation

  1. You must have Go Installed (minimum 1.0)
  2. Make sure your GOPATH is added to your system's PATH (it isn't by default)
    • You can find your current GOPATH by running go env
    • Windows: set PATH=%PATH%;%GOPATH%
    • Linux/Mac: export PATH=$PATH:$GOPATH
  3. Run go get github.com/hfern/sourceq to compile & install the binary to your GOPATH

Update

To update Source Query, simply run go get -u github.com/hfern/sourceq

Usage

There are two types of queries that can be done with Source Query: Master Server querying and individual Source Server queying.

Master Queries

A sourceq master command will querying a Source Master Server to obtain a list of servers. By default, only IPs are returned by the Master server. If only the IP field is requested (--fields "ip") then only a single request to the master server will be dispatched. If other fields are requested (--fields "ip,name") then a single, additional request will be dispatched for each ip returned by the master server.

You can always use sourceq master -? for a summary of the command line options.

Use the --json flag to output a JSON encoded array of the retrieved servers to StdOut instead of printing a table of servers. Diagnostic information may still be printed to StdLog.

sourceq master -l20 --json

Fields

Use a comma-delimited list of these with the --fields flag.

For text-results, column lengths may optionally be specified to pad values with by appending =X where X is a number indicating the minimum field length for that column.

E.g. --fields "ip=21,players,name=0" will pad the IP column to 21 characters, use the default padding for the players column, and not pad the name column.

  • environment: Environment OS (L inux, W in, M ac/ O s X)
  • id: ID of the server.
  • steamid: SteamID of the server.
  • ip: IP Address of the Server
  • bots: Number of Bots
  • game: Game being run.
  • map: Map currently active (e.g. de_dust2).
  • players: Number Players
  • spectatorname: Spectator Name
  • spectatorport: Spectator Port
  • vac: Is the server VAC protected?
  • gameid: GameID that the Server is running
  • mode: Mode the server is running
  • name: Name of Server
  • port: Port of the server.
  • servertype: Hosting Type (eg dedicated)
  • witnesses: # Witnesses for The Ship.
  • duration: Will arrest in (The Ship)
  • folder: Folder that the game is hosted from.
  • keywords: Keywords, registered by the player
  • maxplayers: Maximum number of players allowed
  • version: Version of the server being run.
  • visibility: Is a password required to join?

Regions

Use with the -r flag. E.g. -r "USW" for United States West servers.

  • SA: South America
  • EU: Europe
  • AS: Asia
  • AU: Australia
  • ME: Middle East
  • USE: United States (East)
  • USW: United States (West)
  • AF: Africa
  • OTHER: Rest of World

Known Filters

You may use other filters than the ones listed here. These are the publicly known ones.

Use as -f filtername:value

You may use multiple filters (-f filtername:value -f other:otherval).

  • type: Servers running (d)edicated, (l)isten, or (p) SourceTV.
  • secure: (1) Servers using anti-cheat technology (VAC, but potentially others as well).
  • gamedir: Servers running the specified modification (ex. cstrike)
  • map: Servers running the specified map (ex. cs_italy)
  • linux: Servers running on a Linux (1) platform
  • empty: Servers that are not empty (1)
  • full: Servers that are not full (1)
  • proxy: Servers that are spectator proxies (1)
  • napp: Servers that are NOT running game ([appid])
  • noplayers: Servers that are empty (1)
  • white: Servers that are whitelisted (1)
  • gametype: Servers with all of the given tag(s) in sv_tags (tag1,tag2,...)
  • gamedata: Servers with all of the given tag(s) in their 'hidden' tags (L4D2) (tag1,tag2,...)
  • gamedataor: Servers with any of the given tag(s) in their 'hidden' tags (L4D2) (tag1,tag2,...)

Filter Usage Examples

For only listen servers

sourceq master -f type:l

For only non-empty servers

sourceq master -f empty:1

Servers running Counter Strike currently on map de_dust2

sourceq master -f gamedir:cstrike -f map:de_dust2

Master Examples

General help for querying master servers

sourceq master -?

Get the first 20 servers' IP and Name in U.S. West.

sourceq master --fields "ip,name" -l20 -r"USW" -a

Get non-empty, non-full servers.

sourceq master --fields "ip,maxplayers,players,name" -f empty:1 -f full:1

List the usable filters, regions, and fields that can be used.

sourceq master --list-filters --list-regions --list-fields

Dump a JSON list of servers to the file "servers.json"

sourceq master --fields "ip,name" --json > servers.json

About

Command line query tool for source servers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages