GithubHelp home page GithubHelp logo

gamedig / node-gamedig Goto Github PK

View Code? Open in Web Editor NEW
590.0 16.0 143.0 1.48 MB

Query game servers and not only! Node.JS/Deno or Bash (via the CLI).

Home Page: https://www.npmjs.com/package/gamedig

License: MIT License

JavaScript 100.00%

node-gamedig's Introduction

node-GameDig - Game Server Query Library

npmjs.com deno compatibility Static Badge

node-GameDig is a game server query Node.js module (as well as a command line executable), capable of querying for the status of nearly any game or voice server.

If a server makes its status publically available, GameDig can fetch it for you.

Support is available on the Discord for questions, or GitHub for bugs.

Are you updating from v4 to v5? Many game ids have changed.
Make sure to check if your game's ID is in the id migration document and don't forget to check the changelog file.

Games List

node-GameDig can query over 320 games + a few services!
See the GAMES_LIST.md file for the currently supported titles, not yet supported titles and notes about some of them.

Usage from Node.js

Install using your favorite package manager: npm install gamedig, then use!
Tip: Do you want to try and use the latest features? Install GameDig from this repository via npm i git+https://github.com/gamedig/node-gamedig!

import { GameDig } from 'gamedig';
// Or if you're using CommonJS:
// const { GameDig } = require('gamedig'); 

GameDig.query({
    type: 'minecraft',
    host: 'mc.hypixel.net'
}).then((state) => {
    console.log(state);
}).catch((error) => {
    console.log(`Server is offline, error: ${error}`);
});

Confused on how this works, or you want to see more? Checkout the examples folder!

Required Fields

Field Type Description
type string One of the game type IDs listed in the games list. Or you can use protocol-[name] to select a specific protocol. Protocols are listed here.
host string Hostname or IP of the game server.

Optional Fields

Field Type Default Description
address string undefined Override the IP address of the server skipping DNS resolution. When set, host will not be resolved, instead address will be connected to. However, some protocols still use host for other reasons e.g. as part of the query.
port number Game port Connection port or query port for the game server. Some games utilize a separate "query" port. If specifying the game port does not seem to work as expected, passing in this query port may work instead.
maxRetries number 1 Number of retries to query server in case of failure. Note that this amount multiplies with the number of attempts.
socketTimeout number 2000 Milliseconds to wait for a single packet. Beware that increasing this will cause many queries to take longer even if the server is online.
attemptTimeout number 10000 Milliseconds allowed for an entire query attempt (including socketTimeout, beware that if this value is smaller (or even equal) to the socket one, the query will always fail).
givenPortOnly boolean false Only attempt to query server on given port. It will ignore the game's default port.
ipFamily number 0 IP family/version returned when looking up hostnames via DNS, can be 0 (IPv4 and IPv6), 4 (IPv4 only) or 6 (IPv6 only).
debug boolean false Enables massive amounts of debug logging to stdout.
requestRules boolean false Valve games only. Additional 'rules' may be fetched into the raw key.
requestRulesRequired boolean false Valve games only. requestRules is always required to have a response or the query will timeout.
requestPlayersRequired boolean false Valve games only. Querying players is always required to have a response or the query will timeout. Some games may not provide a players response.
stripColors boolean true Enables stripping colors for protocols: unreal2, savage2, quake3, nadeo, gamespy2, doom3, armagetron.
portCache boolean true After you queried a server, the second time you query that exact server (identified by specified ip and port), first add an attempt to query with the last successful port.
noBreadthOrder boolean false Enable the behaviour of retrying an attempt X times followed by the next attempt X times, otherwise try attempt A, then B, then A, then B until reaching the X retry count of each.
checkOldIDs boolean false Also checks the old ids amongst the current ones.

Query Response

The returned state object will contain the following keys:

Key Type Description
name string Server name.
map string Server map.
password boolean If a password is required.
numplayers number Number of players connected.
maxplayers number Maximum number of connected players.
players array of objects Note that this could be of a different length compared to numplayers.
players.name string If the player's name is unknown, the string will be empty.
players.raw object Additional information about the player if available.
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.
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.
version string Game version that is running on the server. Empty if not present.
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).

Usage from Command Line

Want to integrate server queries from a batch script or other programming language? You'll still need npm to install gamedig:

npm install gamedig -g

After installing gamedig globally, you can call gamedig via the command line:

gamedig --type minecraft mc.example.com:11234
# Alternatively, if you don't want to install gamedig globally, you can run it with npx:
npx gamedig --type minecraft mc.example.com:11234

The output of the command will be in JSON format.
Additional advanced parameters can be passed in as well:

  • --debug: Print debugging informations, useful when stating an issue.
  • --pretty: Outputs the JSON format nicely.
  • --requestRules: Request Valve games rules.
  • --givenPortOnly: Run the query with the specified port only (if any).
  • --socketTimeout N: Specifies socket timeout (where N is a number, eg. 5000).
  • ... and the rest in the same format.

Deno

The minimum supported deno version is 1.39.2 and the --allow-net permission is required.

Common Issues

Firewalls block incoming UDP

(replit / docker / some VPS providers)

Most game query protocols require a UDP request and response. This means that in some environments, gamedig may not be able to receive the reponse required due to environmental restrictions.

Some examples include:

  • Docker containers
    • You may need to run the container in --network host mode so that gamedig can bind a UDP listen port.
    • Alternatively, you can forward a single UDP port to your container, and force gamedig to listen on that port using the instructions in the section down below.
  • replit
    • Most online IDEs run in an isolated container, which will never receive UDP responses from outside networks.
  • Various VPS / server providers
    • Even if your server provider doesn't explicitly block incoming UDP packets, some server hosts block other server hosts from connecting to them for DDOS-mitigation and anti-botting purposes.

Gamedig doesn't work in the browser

Gamedig cannot operate within a browser. This means you cannot package it as part of your webpack / browserify / rollup / parcel package.
Even if you were able to get it packaged into a bundle, unfortunately no browsers support the UDP protocols required to query server status from most game servers.
As an alternative, we'd recommend using gamedig on your server-side, then expose your own API to your webapp's frontend displaying the status information. If your application is thin (with no constant server component), you may wish to investigate a server-less lambda provider.

Specifying a listen UDP port override

In some very rare scenarios, you may need to bind / listen on a fixed local UDP port. The is usually not needed except behind some extremely strict firewalls, or within a docker container (where you only wish to forward a single UDP port).
To use a fixed listen udp port, construct a new Gamedig object like this:

const gamedig = new GameDig({
    listenUdpPort: 13337
});
gamedig.query(...)

node-gamedig's People

Contributors

a-sync avatar arkuar avatar bosek avatar c43721 avatar cetteup avatar cosminperram avatar cwbr avatar dependabot[bot] avatar dgibbs64 avatar digitalfiz avatar douile avatar guilhermewerner avatar isostarec avatar itsphenom avatar jammsen avatar mattjeanes avatar mmorrisontx avatar nickdnk avatar p4sca1 avatar podrivo avatar rainst avatar rylinj avatar ryush00 avatar sonicsnes avatar steadexe avatar vito0912 avatar xcausxn avatar xcpep avatar xhip avatar zixesea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-gamedig's Issues

Gamespy4 protocol

Hey man,

Was wondering if you could add the gamespy4 protocol to gamedig, as some games have updated to use it.

Specifically Just Cause 2 Multiplayer.

Regards
xCausxn

UDP Watchdog Timeout with DayZ servers

I've tried querying both DayZ standalone and mod servers but I keep getting the UDP Watchdog Timeout error.

Here's the code:

var Gamedig = require('gamedig');
Gamedig.debug = true;
Gamedig.query({type: 'dayz', host: '199.189.85.77'}, function () { console.log(arguments) })

And the output:

$ node index.js                                                        
199.189.85.77:2302 UDP--> ffffffff54536f7572636520456e67696e6520517565727900
{ '0': 
   { error: 'UDP Watchdog Timeout',
     query: 
      { host: '199.189.85.77',
        address: '199.189.85.77',
        port: 2302,
        port_query: 2302,
        type: 'dayz',
        pretty: 'DayZ' } } }

Starbound 1.x can not be queried

Hi there, i've just update some older starbound instances. And it seams that Starbound changed something on the queries

Our server (does not query)

gamedig --type starbound --host das-uhrwerk.de --port 21025 (1.1.1)

{
"error":"UDP Watchdog Timeout",
"query":{
  "host":"das-uhrwerk.de",
  "address":"85.214.69.208",
  "port":21025,
  "port_query":21025,
  "type":"starbound",
  "pretty":"Starbound"}
}

Outdated Public Server (does query)

gamedig --type starbound --host 208.167.250.40 --port 21025 (Beta v. Glad Giraffe - Update 3)

  {
   "name":"A Starbound Server",
   "map":"Unknown",
   "password":false,
   "raw":{
      "protocol":7,
      "folder":"starbound",
      "game":"Starbound",
      "steamappid":65534,
      "numplayers":0,
      "numbots":0,
      "listentype":"D",
      "environment":"W",
      "secure":0,
      "version":"Beta v. Glad Giraffe - Update 3",
      "port":0,
      "rules":{
         "plugins":"none"
      }
   },
   "maxplayers":4,
   "players":[

   ],
   "bots":[

   ],
   "query":{
      "host":"208.167.250.40",
      "address":"208.167.250.40",
      "port":21025,
      "port_query":21025,
      "type":"starbound",
      "pretty":"Starbound"
   }
}

Quake 2 doesn't return correct maxplayers

While querying a quake 2 server I noticed maxplayers returned 0. The correct "maxplayers" value is under "maxclients" key which is under the raw values.

The server I was querying: 46.22.210.10:27910

Getting an error when trying to use an IP.

Hello, i am getting this following error:
\node_modules\gamedig\protocols\core.js:103
if(options.host.match(/\d+.\d+.\d+.\d+/)) {
^
TypeError: undefined is not a function
at module.exports.Class.extend.start.async.series.offset (**node_modules\gamedig\protocols\core.js:103:21)
at *__node_modules\gamedig\node_modules\async\lib\async.js:607:21
at *__node_modules\gamedig\node_modules\async\lib\async.js:246:17
at async.eachSeries.iterate (
node_modules\gamedig\node_modules\async\lib\async.js:146:13)
at async.eachSeries (
_node_modules\gamedig\node_modules\async\lib\async.js:162:9)
at asyncMap (node_modules\gamedig\node_modules\async\lib\async.js:245:13)
at Object.doSeries as mapSeries
at Object.async.series (
node_modules\gamedig\node_modules\async\lib\async.js:605:19)
at Class.module.exports.Class.extend.start (
*node_modules\gamedig\protocols\core.js:99:9)
at *
*node_modules\gamedig\lib\index.js:72:10
at process._tickCallback (node.js:355:11)

I am not sure if this is a problem just for me.

[React native] Unable to resolve module `dgram`: Module does not exist in the module map

When I use this library in reaact-native project, I'm receiving this error:

error: bundling failed: "Unable to resolve module dgram from E:\\Desktop\\New folder\\untitled\\node_modules\\gamedig\\lib\\index.js: Module does not exist in the module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start -- --reset-cache."

Tried to install dgram directly in the gamedig library folder, but it does not help.

Add Valve RCON query protocol

Hello,

Wondering if it's somehow possible to fetch the steam id of the players so you can link to their community profiles and so on?

Unturned - UDP Watchdog Timeout

Hi, I'm trying to get unturned server data.
I tried all ports: 27015, 27016, 27016.
But I am getting the following error: UDP Watchdog Timeout.
Please help me to solve it.

Code :

function PlayersByIP(IP ) {
Gamedig.query({
type: 'unturned',
host: IP,
port: 27017
}).then((state) => {
var lol = state.players.map(obj => obj.name);
lol = lol.join();
var bots = state.bots.map(obj => obj.name);
bots = bots.join();
for(let endpoint of endpoints) {
endpoint.emit("send" , state.players.length + state.bots.length + " Players Online: " + lol + "," + bots);
}
}).catch((error) => {
console.log("Server is offline " + error);
});

How do I call the code :

message = message.toString();
console.log(message);
PlayersByIP(message);

Thanks!

Teamspeak 3 should not show a player connecting when scanned

idk what is happening but when my bot is running on my vps (ubuntu 14.04.5) when it is querying a teamspeak3 server a teamspeak 3 client joins the server called "unknown" and leaves ... but when it is running on my computer (windows 10 pro) it doesn't do it and still queries the teamspeak 3 server the way it was suposed to.
it is anoying af is there a way to fix this or not ?

also when it queries the teamspeak 3 server name if there is this character "|" it saves it like this "\p" ... only happens when querying a teamspeak 3 server, i queried cs go and cs 1.6 and it didn't happened

{"error":"UDP Watchdog Timeout"}

Hi, i am trying to use gamedig after installing it globaly with "npm install gamedig -g".
when i hit gamedig --type arma3 --host 217.182.6.114 --port 2302 for example it throws:
{"error":"UDP Watchdog Timeout"}
it's my first time using it so forgive my ignorance.

Retry query

It would be a nice feature to have, where you can specify the amount of retries gamedig should perform and the time between retries for if a server is offline.

For example, scan a server a max of 5 times with 1 second between scans.

This is something that could easily be implemented by users in their own projects but could also be a nice feature for the package itself.

"Looking for maintainers"

I think you're not maintaining this library anymore and you should mention that you're looking for maintainers, eventually pick one candidate and just allow the project to evolve and be updated please.

Right now it's a dead project which is a shame because a lot of hard preliminary work got done and rewriting if from scratch would just be kind of a waste of time.

Thank you for considering it

Always returning server is offline?

When I use the snippet you posted in my Node.JS app, it always seems to return status offline for any servers I test. When I run the server through the command line executable though, it returns a status of true with all the data. Any ideas?

Strict mode

Hey, i getting this error using graph.cool . Looks like there is missing strict mode

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Module._compile (/data/sandbox/lib/module.js:127:21)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at WebtaskModule.require (/data/sandbox/lib/module.js:101:19)
at require (/data/sandbox/lib/module.js:136:21)
at Object.<anonymous> (/data/io/2a7475ab28884c25887bd992c4d7b708/webtask.js:1:79)
at WebtaskModule.compileWebtask (/data/sandbox/lib/module.js:95:34)

Stable return values

Hello,

I'm not familiar with gamedig and I'm attempting to get the players and maxplayers for my unturned server(IP: GangsRP.playat.ch -- Server is down a lot).

I'm using a callback and when making an output format for the variables I want to list the max players vs players online(ex: 5/24 Players online). When attempting this an error is made stating that the variable player isn't defined, how would I grab the variable player? Also when I put it in the function arguments it doesn't run the function at all.

My Code -- discord.js:

var loading = message.guild.emojis.find('name','loading');
const m = await message.channel.send(`Checking Server Status ${loading}`);

Gamedig.query({
	type: 'unturned',
	host: 'GangsRP.playat.ch',
	port: '27015',
	note: message
},
async (e,state) => {

	if(e){
		var emoji = message.guild.emojis.find('name','xmark');
		var embed = new Discord.RichEmbed()
			.setColor("0xaa0000")
			.setAuthor("Gang's RP Server Status", bot.user.avatarURL)
			.setDescription(`**The server is: \`Offline\`** ${emoji}`)
		m.edit({embed});
		console.log(e);
	} else {
		var emoji = message.guild.emojis.find('name','check');
		var embed = new Discord.RichEmbed()
			.setColor("0x00aa00")
			.setAuthor("Gang's RP Server Status", bot.user.avatarURL)
Player check ->	.setDescription(`**The server is: \`Online\`** ${emoji}\n\n**Name:** Gang's RP - [ Roles, Kits, TPA, NO KOS, 8x Bases ]\n**IP Address:** GangsRP.playat.ch\n**Port:** 27015\n**Players:** ${players.length}\/${maxplayers}`)
		m.edit({embed});
	}
});

Relationship with kurt-stolle/node-gamequery

I found another project that basically same as this one. kurt-stolle/node-gamequery
I checked commit history, the first commit of this project was in July 2013. kurt-stolle's node-gamequery was in May 2015.
Two projects are extremely similar, basically same README, basically same code structure.
What do you think?

I don't consider this is a legit fork thing since that project's first ( or second should I say ) commit (e9ab10) says:

Merged original private project, removed Casual Bananas specific
references. Preparing to make project public.

Obvious he says that project is his own thing, was a private project.
Is this a copycat thing, or just you guys that lucky wrote same code?

/CC @kurt-stolle

--port is not working at all.

I'm running two servers (games) at one machine. On two different ports - one 7777 another 7779 (and also 27015 and 27020) thenever i use --port to gamedig i ONLY get answer from the 7777 server - never from other - even if i know its running (and i even logged into it).

Non-standard callback arguments

Why doesn't this library return error as the first argument and result as second argument, as is the standard in node?

I'm asking because I tried promisifying the library and got an error because promisification libraries expect that first argument is an error, as they should.

multiple queries

is there any way of multiple queries for example I need TS3 and Minecraft in same query ??

UDP watchdog timeout Americas Army PG

hallo :)
i'm trying to use these code to query aa pg server. but i always get these error
{ _: [],
type: 'americasarmypg',
host: '37.59.203.232',
port: 8777 }
{"error":"UDP Watchdog Timeout","query":{"host":"37.59.203.232","address":"37.59.203.232","port":8777,"port_query":27020,"type":"americasarmypg","pretty":"America's Army: Proving Grounds"}}

i've tried :

  • gamedig --type americasarmypg --host xxx.xxx.xxx.xxx -port 8777
    and
  • gamedig --type americasarmypg --host xxx.xxx.xxx.xxx -port 27020

can somebody help me with that ?

Thx in adv

Fails wth TCP or UDP Watchdog timeout after some amount of checked servers

Hi there,

thanks for this awesome library! It's amazing. But I noticed one issue and I don't really know why after processing eg. 20-30 server it starts returning timeout errors. But let's start from the beginning. I'm creating another servers ranking page and I have to check every 1-2 minutes around 3k of Minecraft servers. It's simple script, basically I get list from DB, put tasks into queue and start processing with little concurrency, eg. 5. Initially I was thinking timeouts are caused by too high concurrency and real problems with my internet connection throughput. But nope.

Here's my query function (nothing special here):

function query_server(host, port, cb) {
    Gamedig.query(
        {
            type: 'minecraftping',
            host: host,
            port_query: port,
            udpTimeout: 2000,
            tcpTimeout: 2000,
        },
        function(state) {
            cb(state);
        }
    );  
}

Please note the same problem is with query and ping protocols. The script starts fast and then slows down. After 100-200 processed items only one per 10 servers responds, others get TCP or UDP Watchdog timeout. Interesting is this 'slowing down'. Every next query is slower then previous (and finally they get timeout). Do you have any ideas WHY?

Of course I'm 100% sure all failed servers are online - checked with other tool and GameDig CLI - it was OK, but only fails when GameDig is working longer while.

Latency

Is there a way to get the time it took to query the data from a server? Basically I want to display the latency between the API server and game server - it would be a nice way to get the rough latency between a player and the game server if the player is located in the same country as the api server.

Copyright infringement

Hi, I found no other way to contact you. I received a takedown notice from Github regarding the node-gamequery library I had forked. I had no idea it originated somewhere else.

Be that as it may, I'd like to take this opportunity to apologise. Also, I saw quite a few forks not mentioned in the takedown notice in the 'original' copy: https://github.com/kurt-stolle/node-gamequery/network/members.

I will remove the repo immediately.

Kind regards.

CS:GO players object is empty

Hi!

I set up everything and it's working fine except the players object what I get.
There are many player objects as many players are on the server but they are empty.
Is it something with the server itself?

Thanks.

Support for OpenTTD

Hey, I'm the lead sysadmin at /r/openttd, and I'm migrating our main control panel over from PHP to node. We used to use gameq to query our servers for state, but obviously I can't really use that anymore, so I guess I'm stuck with you guys!

As a result, is it possible to get some OpenTTD query support into gamedig? It'll really help me out, as our old method of query before I found gameq was based on a simple "can we open this socket? ok the server's up / down".

Many thanks!

Reference folder is well populated

Teamspeak 3 doesn't work

server is online I'm connected to it
but gamedig says: server is offline
when i try to use global gamedig command
i get error: TCP Watchdog Timeout

ts3 server is on default port 9987 and its query port is 10011 what could be wrong ??

[NOT ISSUE] Just letting you know :)

Hey Man,

I would like to say i love this library, and that im am currently using it. I have integrated it into a web based query NodeJS server. I will be adding a credits page soon mentioning this project.

Can be found here: https://gamerlabs.net/query/

And again keep up the awesome work :)
xCausxn

CLI returns response while script doesn't

If I run gamedig --type protocol-valve --host 192.168.0.5 --port 25569 it returns a valid response of:

{"name":"Insurgency","map":"sinjar","password":false,"raw":{"protocol":17,"folder":"insurgency","game":"Insurgency","steamappid":0,"numplayers":0,"numbots":0,"listentype":"d","environment":"l","secure":1,"version":"2.0.6.2","port":25569,"steamid":"90097972027621383","tags":"firefight,theater:default,ver:2062,nwibanlist,empty,nospawnprotection,","gameid":"222880","rules":{"coop":"0","deathmatch":"1","decalfrequency":"10","ins_bot_change_difficulty":"1","ins_bot_difficulty":"1","ins_teamsize":"0","mp_allowNPCs":"1","mp_ambush_single_point_max":"10","mp_autocrosshair":"1","mp_coop_lobbysize":"6","mp_cp_capture_time":"30","mp_cp_deteriorate_time":"0","mp_cp_speedup_max":"4","mp_cp_speedup_rate":"0.26","mp_extract_point":"0","mp_fadetoblack":"0","mp_falldamage":"0","mp_flashlight":"0","mp_footsteps":"1","mp_forcerespawn":"1","mp_fraglimit":"0","mp_freezetime":"15.0","mp_friendlyfire":"1","mp_friendlyfire_explosives":"0","mp_joinwaittime":"20","mp_lobbytime":"10","mp_maxgames":"1","mp_maxrounds":"5","mp_minteamplayers":"1","mp_respawnwavetime_max":"0","mp_respawnwavetime_min":"0","mp_roundlives":"0","mp_roundtime":"600","mp_scrambleteams_auto":"0","mp_scrambleteams_auto_windifference":"3","mp_searchdestroy_single_cache_max":"12","mp_spawnprotectiontime_navspawn":"15","mp_spawnprotectontime":"10","mp_supply_rate_losing_team_high":"0","mp_supply_rate_losing_team_low":"0","mp_supply_rate_winning_team_high":"0","mp_supply_rate_winning_team_low":"0","mp_supply_token_base":"10","mp_supply_token_bot_base":"18","mp_supply_token_max":"20","mp_switchteams_each_game":"0","mp_switchteams_each_round":"0","mp_switchteams_reset_supply":"1","mp_teamlist":"hgrunt;scientist","mp_teamplay":"0","mp_teams_unbalance_limit":"1","mp_timelimit":"0","mp_timer_postgame":"0","mp_timer_postround":"15","mp_timer_pregame":"10","mp_timer_preround":"15","mp_timer_preround_first":"15","mp_timer_preround_switch":"30","mp_timer_voting":"25","mp_weaponstay":"0","mp_winlimit":"3","mp_winlimit_coop":"1","nextlevel":"","r_VehicleViewDampen":"1","spec_allow_bots":"0","sv_accelerate":"10","sv_airaccelerate":"10","sv_allchat":"1","sv_alltalk":"1","sv_alltalk_dead":"0","sv_alltalk_endgame":"1","sv_alltalk_intermission":"1","sv_bounce":"0","sv_cheats":"0","sv_contact":"","sv_deadtalk":"0","sv_deadtalk_team":"1","sv_deadvoice":"0","sv_footsteps":"1","sv_friction":"4","sv_gravity":"800","sv_hud_deathmessages":"0","sv_hud_deathmessages_spectator":"0","sv_hud_scoreboard_show_score":"0","sv_hud_scoreboard_show_score_dead":"1","sv_hud_targetindicator":"1","sv_map_voting":"1","sv_map_voting_shuffle":"1","sv_maxspeed":"1000.000000","sv_noclipaccelerate":"5","sv_noclipspeed":"5","sv_nwi_banlist":"1","sv_password":"0","sv_playlist":"","sv_rollangle":"0","sv_rollspeed":"200","sv_specaccelerate":"5","sv_specnoclip":"1","sv_specspeed":"3","sv_steamgroup":"","sv_stepsize":"18","sv_stopspeed":"75.000000","sv_stopspeed_prone":"45","sv_tags":"nospawnprotection","sv_voiceenable":"1","sv_wateraccelerate":"10","sv_waterfriction":"1","tv_enable":"0","tv_password":"0","tv_relaypassword":"0"}},"maxplayers":20,"players":[],"bots":[],"query":{"host":"192.168.0.5","address":"192.168.0.5","port":25569,"port_query":25569,"type":"protocol-valve"}}

However, if I run the code below (where this.serverConfig.gamehost is 192.168.0.5 and this.serverConfig.gameport is 25569):

Gamedig.query({
        type: "protocol-valve",
        host: this.serverConfig.gamehost,
        port: parseInt(this.serverConfig.gameport)
}, function (res) {
        console.log(res);
});

It returns:

{ error: 'UDP Watchdog Timeout',
  query: 
   { host: '192.168.0.5',
     address: '192.168.0.5',
     port: 25569,
     port_query: 25569,
     type: 'protocol-valve' } }

Occasionally it will work correctly, but more often than not it will just fail without warning. This also happens with Minecraft servers, the only work around I've found was using minecraftping not minecraft.

Add support for RCon

I wonder if you have any interest in implementing remote consoles for the protocols you support (possibly with community help). I find your library extremely useful but I would like to be able to execute commands too.

Support for StarMade

It would be great if there was support for StarMade. I use this package to query game servers and show that data online. If this can be supported, I would be very grateful. Here is the server info for testing: StarMade (96.19.173.45:4242).

https://gamerlabs.net/query/ not working.

I believe that xCausxn is the author of the website, but I have no way to notify does not work, so I put it here.

I've been using the web long for a project in .net

A few days ago does not work in Arma 3 and teamspeak.

Thank you very much for everything and my thanks to xCausxn and sonicsnes for its great library.

Add a CONTRIBUTING.md

Can you add this file and put information into it for contributing? I would like to add support for some games but not exactly sure how.

csgo players empty

"gamedig": "0.2.24"

{ name: 'xxx',
  map: 'workshop/265623436/de_dust2x2_classic',
  password: false,
  raw: 
   { protocol: 17,
     folder: 'csgo',
     game: 'Counter-Strike: Global Offensive',
     steamappid: 730,
     numplayers: 10,
     numbots: 0,
     listentype: 'd',
     environment: 'l',
     secure: 1,
     version: '1.34.9.9',
     port: 27015,
     tags: 'secure',
     gameid: '730' },
  maxplayers: 20,
  players: [ {}, {}, {}, {}, {}, {}, {}, {}, {}, {} ],
  bots: [],
  query: 
   { host: 'xxx',
     address: 'xxx',
     port: 27015,
     port_query: 27015,
     type: 'csgo',
     pretty: 'Counter-Strike: Global Offensive' } }

SA-MP servers that have > 100 players online give a timeout.

It's known that you can't retrieve the player list when there are more than 100 players online, however you still can retrieve all other data, like mapname, servername, etc. With this plugin gamedig times out with error "timeout".

Try it yourself:
Type in the console gamedig --type samp --host 93.119.26.251 --port 7777

That's the IP + port of Romania Super Stunt (some random server I got from the internet list). Has 300 players at the time of writing, got the error message timeout. If you think this only happens with this IP + port, try an other one where the player count > 100.

The quake3 protocol doesn't have a raw.numplayers

Like the title says, the quake3 protocol doesn't have any numplayers integer. It retrieves the players but it doesn't put it in the array. Not sure if this is the way it should work, but all the protocols have a raw.numplayers, except this one ๐Ÿ˜›

Rust

I cant get it to work with the game rust. Running it in the command line:
gamedig --type rust --host 142.4.216.124 --port 28065

I know this is a valid server. The error I'm getting is:

{"error":"UDP Watchdog Timeout","query":{"host":"142.4.216.124","address":"142.4.216.124","port":28065,"port_query":28066,"type":"rust","pretty":"Rust"}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.