gamedig / node-gamedig

Query game servers and not only! Node.JS/Deno/Bun or Bash (via the CLI).
https://www.npmjs.com/package/gamedig
MIT License
606 stars 147 forks source link

Cannot query CSS/CSGO servers. #165

Closed Frumpy9 closed 4 years ago

Frumpy9 commented 4 years ago

I have been trying to query many CSS and CSGO servers. I have the latest version of Node and Gamedig. I have talked to other people who have been having the same issue. I have fiddled around with all of the optional settings and timings.

My code:

dig.query({
   type: "csgo",
   host: "216.52.143.73",
   port: 27015,
   debug: true
}).then(s => {
   console.log(s);
}).catch(e => {
   console.log(e);
})

My console output:

Q#0 Query is running with options: {
  socketTimeout: 2000,
  attemptTimeout: 10000,
  maxAttempts: 1,
  port: 27015,
  protocol: 'valve',
  type: 'csgo',
  host: '216.52.143.73',
  debug: true
}
Q#0 DNS Lookup: 216.52.143.73
Q#0 Raw IP Address: 216.52.143.73
Q#0 Requesting info ...
Q#0 216.52.143.73:27015 UDP-->
Q#0 Buffer length: 25 bytes
ff ff ff ff 54 53 6f 75 72 63 65 20 45 6e 67 69 6e 65 20 51 75 
            T  S  o  u  r  c  e     E  n  g  i  n  e     Q  u  
65 72 79 00 
e  r  y     

Q#0 UDP timeout detected
Q#0 Query failed with error Error: UDP - Timed out after 2000ms
    at Timeout.<anonymous> (/Users/242556/Desktop/test/node_modules/gamedig/lib/Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Error: Failed all 1 attempts
    at QueryRunner.run (/Users/242556/Desktop/test/node_modules/gamedig/lib/QueryRunner.js:88:21)
Attempt #1 - Port=27015 Retry=0:
Error: UDP - Timed out after 2000ms
    at Timeout.<anonymous> (/Users/242556/Desktop/test/node_modules/gamedig/lib/Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)

The weird thing is I have one discord bot running with gamedig right now with no issues.

Thanks for your help.

Edit: Might be because a school firewall is blocking the query. Will edit when I can test at home.

Edit #2: Tried it at home, and it still didn't work. Same errors

P4sca1 commented 4 years ago

Works fine for me: npx gamedig --type csgo --host 216.52.143.73 --port 27015

{"name":"sneaK's Beginner Surf !ws|!knife|!gloves|FastDL|Store|VIP","map":"surf_kitsune_fix","password":false,"raw":{"protocol":17,"folder":"csgo","game":"Counter-Strike: Global Offensive","steamappid":730,"numplayers":25,"numbots":1,"listentype":"d","environment":"w","secure":1,"version":"1.37.4.4","steamid":"85568392921714296","tags":"csgo,!ws,awp,easy,bhop,free,knife,game,fun,gloves,map,server,sneak,stat,skin,server,surf,surftimer,timer,utopia,ws,secure","gameid":"730","rules":{}},"maxplayers":38,"players":[{"name":"SADc4iogamer","score":0,"time":3664.87109375},{"name":"Dizzy","score":11541,"time":1367.32373046875},{"name":"uncle ben","score":513,"time":1367.288330078125},{"name":"✪ Vaxorz","score":0,"time":1366.8780517578125},{"name":"Loddle","score":5872,"time":1366.7255859375},{"name":"Bekayjay21","score":0,"time":1098.4913330078125},{"name":"ezweav13","score":13,"time":950.9642333984375},{"name":"SuspiciousCitrus","score":0,"time":726.4212646484375},{"name":"$hut Up","score":1867,"time":596.9644165039062},{"name":"きめつのやいば","score":270,"time":545.39013671875},{"name":"T.TV/GhostePhace","score":0,"tim99951171875},{"name":"SpayD:","score":0,"time":494.4840393066406},{"name":"KraZk","score":0,"time":404.0036315917969},{"name":"Qoxte","score":0,"time":382.7810974121094},{"name":"Vlitzen","score":0,"time":281.65997314453125},{"name":"Hplachance Tradeit.gg","score":0,"time":279.02325439453125},{"name":"LkzGod","score":0,"time":273.7027893066406},{"name":"balão suspeito","score":5131,"time":239.50765991210938},{"name":"Teddison","score":0,"time":156.41009521484375},{"name":"MasterNibbs","score":0,"time":122.41409301757812},{"name":"FloppyChicken","score":1872,"time":72.73795318603516},{"name":"Bootylicker9","score":0,"time":72.12894439697266},{"name":"gabbysmom1021","score":0,"time":14.367178916931152},{}],"bots":[{"name":"Type !replay to watch","score":0,"time":17911.849609375}],"connect":"216.52.143.73:27015","ping":125}

Might be a firewall issue.

Frumpy9 commented 4 years ago

Yeah, I figured this out earlier, but thank you for the response.