1.2.0 • Published 4 months ago

digz v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

digz library

DayZ server query library, with DZSA Mod Download Server fallback request. It is built on top of node-gamedig, but focus on providing a simpler DayZ server output.

digz is available as a node.js module, as well as a command line executable.

Usage from Node.js

npm install digz
const digz = require('digz')

digz.query({
  host: '168.100.162.110',
  port: '2303'
}).then((response) => {
  console.log('Server data:', response)
}).catch((error) => {
  console.log('Server is offline')
})

Query parameters

ParameterTypeDefault
hoststring-Required. Hostname or IP of the server.
portnumber-Required. Connection port or query port for the server. Make sure it's the query port and not the game port.
prettybooleanfalseHostname or IP of the server.
maxAttemptsnumber1Number of attempts to query server in case of failure.
socketTimeoutnumber2000Milliseconds to wait for a single packet. Beware that increasing this will cause many queries to take longer even if the server is online.
attemptTimeoutnumber10000Milliseconds allowed for an entire query attempt. This timeout is not commonly hit, as the socketTimeout typically fires first.
givenPortOnlybooleanfalseOnly attempt to query server on given port.
debugbooleanfalseEnables massive amounts of debug logging to stdout.
pingOnlybooleanfalseOnly gets ping in the response.

Response

The returned state object will contain the following keys:

KeyType
namestringServer name.
mapstringMap name.
passwordbooleanIf password is required.
officialbooleanIf server is official or not.
versionstringGame version the server is running.
first_personbooleanIf server is first person only.
dlc_enabledbooleanIf server needs Livonia DLC.
connectstringIP:PORT to connect.
ipstringServer IP.
port_gamestringServer game port.
port_querystringServer query port.
pingnumberRound trip time to the server in milliseconds.
players_maxnumberMaximum number of connected players.
players_connected_infonumberNumber of players connected, via A2S_INFO.
players_connected_playernumberNumber of players connected, via A2S_PLAYER.
players_connectednumberNumber of players connected.
players_queuenumberNumber of players in queue.
timestringCurrent server day time.
day_accelerationnumberIn-game day time acceleration.
night_accelerationnumberIn-game night time acceleration.
modsarrayTitle and Steam Workshop ID.

Usage from Command Line

Install digz globally if you need to integrate server queries from a batch script or other programming language:

npm install digz -g
digz 168.100.162.110:2303 --pretty

The output of the command will be in JSON format. Additional optional parameters can be passed in as well. Ex: --pretty, --socketTimeout 5000, etc.

node-gamedig

This library is built on top of node-gamedig, a more broad game server library. This wouldn't be possible if it wasn't for all their hard work. I decided to put this togeter, because DayZ has it's own misteries and needs a little more love to have fallback options and a simpler query response.

License

Released under the MIT license.

1.2.0

4 months ago

1.1.19

4 months ago

1.1.18

4 months ago

1.1.17

4 months ago

1.1.16

4 months ago

1.1.15

4 months ago

1.1.14

6 months ago

1.1.13

10 months ago

1.1.12

11 months ago

1.1.11

11 months ago

1.1.9

2 years ago

1.1.10

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago