mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 17:25:19 +01:00
feat: add query port to the results (#476)
This commit is contained in:
parent
2ffff5e7d6
commit
ec708d7219
4 changed files with 5 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
||||||
* Minimum Supported Deno Version: `1.39.2`.
|
* Minimum Supported Deno Version: `1.39.2`.
|
||||||
* `deno run --allow-net bin/gamedig.js --type tf2 127.0.0.1`
|
* `deno run --allow-net bin/gamedig.js --type tf2 127.0.0.1`
|
||||||
* Added code examples.
|
* Added code examples.
|
||||||
|
* New stable field: `queryPort` - this number indicates what was the port that the query was done on, 0 indicates none if not applicable.
|
||||||
* New option: `stripColors` (defaults to `true`) for protocols that strips colors: unreal2, savage2, quake3, nadeo, gamespy2, doom3, armagetron.
|
* New option: `stripColors` (defaults to `true`) for protocols that strips colors: unreal2, savage2, quake3, nadeo, gamespy2, doom3, armagetron.
|
||||||
* New option: `requestRulesRequired` (defaults to `false`) Valve games only. `requestRules` is always required to have a response or the query will timeout.
|
* New option: `requestRulesRequired` (defaults to `false`) Valve games only. `requestRules` is always required to have a response or the query will timeout.
|
||||||
* New option: `requestPlayersRequired` (defaults to `false`) Valve games only. Querying players is always required to have a response or the query will timeout. Some [games](GAMES_LIST.md) may not provide a players response.
|
* New option: `requestPlayersRequired` (defaults to `false`) Valve games only. Querying players is always required to have a response or the query will timeout. Some [games](GAMES_LIST.md) may not provide a players response.
|
||||||
|
|
|
@ -68,6 +68,7 @@ The returned state object will contain the following keys:
|
||||||
| **bots** | array of objects | Same schema as `players`. |
|
| **bots** | array of objects | Same schema as `players`. |
|
||||||
| **connect** | string | This will typically include the game's `IP:PORT`. The port will reflect the server's game port, even if your request specified the game's query port in the request. For some games, this may be a server ID or connection URL if an IP:PORT is not appropriate for end-users. |
|
| **connect** | string | This will typically include the game's `IP:PORT`. The port will reflect the server's game port, even if your request specified the game's query port in the request. For some games, this may be a server ID or connection URL if an IP:PORT is not appropriate for end-users. |
|
||||||
| **ping** | number | Round trip time to the server (in milliseconds). Note that this is not the RTT of an ICMP echo, as ICMP packets are often blocked by NATs and node has poor support for raw sockets. This value is derived from the RTT of one of the query packets, which is usually quite accurate, but may add a bit due to server lag. |
|
| **ping** | number | Round trip time to the server (in milliseconds). Note that this is not the RTT of an ICMP echo, as ICMP packets are often blocked by NATs and node has poor support for raw sockets. This value is derived from the RTT of one of the query packets, which is usually quite accurate, but may add a bit due to server lag. |
|
||||||
|
| **queryPort** | number | Indicates on which port the query was done on, 0 if this is not applicable. |
|
||||||
| **raw** | object | Contains all information received from the server in a disorganized format. |
|
| **raw** | object | Contains all information received from the server in a disorganized format. |
|
||||||
|
|
||||||
Note that `raw` (or **unstable**) objects contents MAY change on a per-protocol basis between GameDig patch releases (although not typical).
|
Note that `raw` (or **unstable**) objects contents MAY change on a per-protocol basis between GameDig patch releases (although not typical).
|
||||||
|
|
|
@ -29,4 +29,6 @@ export class Results {
|
||||||
maxplayers = 0
|
maxplayers = 0
|
||||||
players = new Players()
|
players = new Players()
|
||||||
bots = new Players()
|
bots = new Players()
|
||||||
|
|
||||||
|
queryPort = 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ export default class Core extends EventEmitter {
|
||||||
const state = new Results()
|
const state = new Results()
|
||||||
|
|
||||||
await this.run(state)
|
await this.run(state)
|
||||||
|
state.queryPort = options.port
|
||||||
|
|
||||||
// because lots of servers prefix with spaces to try to appear first
|
// because lots of servers prefix with spaces to try to appear first
|
||||||
state.name = (state.name || '').trim()
|
state.name = (state.name || '').trim()
|
||||||
|
|
Loading…
Reference in a new issue