1 个不稳定版本

0.1.0 2024年1月28日

#1664命令行工具

GPL-3.0-only

115KB
3K SLoC

xash3d-query

接收并显示有关服务器的信息。

用法

检索关于服务器的信息。

$ xash3d-query info 144.49.47.88:27016
server: 144.49.47.88:27016 [33.462 ms]
    status: "ok"
    host: "Test Server"
    gamedir: "valve"
    map: "crossfire"
    protocol: "0"
    numcl: "13"
    maxcl: "30"
    dm: "true"
    team: "false"
    coop: "false"
    password: "false"

从主服务器检索服务器地址。

$ xash3d-query list
144.49.47.88:27016
144.49.47.88:27017

检索从主服务器接收到的所有服务器的信息。

$ xash3d-query
server: 144.49.47.88:27016 [33.462 ms]
    status: "ok"
    host: "Test Server"
    gamedir: "valve"
    map: "crossfire"
    protocol: "0"
    numcl: "13"
    maxcl: "30"
    dm: "true"
    team: "false"
    coop: "false"
    password: "false"

server: 144.49.47.88:27017 [32.596 ms]
    status: "ok"
    host: "Test Server 2"
    gamedir: "valve"
    map: "crossfire"
    protocol: "0"
    numcl: "7"
    maxcl: "30"
    dm: "true"
    team: "false"
    coop: "false"
    password: "false"

JSON 输出

# Print table sorted by number of players.
$ xash3d-query -j | jq -r '[.servers[] | select(.status == "ok")] | sort_by(.numcl) | reverse | .[] | [.numcl, .map, .address, .host] | @tsv'
13      crossfile       144.49.47.88:27016    Test Server
7       crossfile       144.49.47.88:27017    Test Server 2

依赖项

~1.4–2.4MB
~46K SLoC