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
607 stars 147 forks source link

Conan Exiles server queries throwing UDP errors #193

Closed passivedragon closed 4 years ago

passivedragon commented 4 years ago

I've tried this with various methods now, commandline, in script, both on local PC and on repl.it, with various servers and port variations.

No matter what I do or try, even after correcting the query port set in the games.txt according to https://www.conanexiles.com/dedicated-servers/ and testing that with servers I know the query port with, I can't seem to get this to work.

https://repl.it/@passivedragon/gamedig-testing this is what I've tried, also locally. Results:


{
  "name": "gamedig-testing",
Q#0 Query is running with options: {
  socketTimeout: 2000,
  attemptTimeout: 10000,
  maxAttempts: 1,
  port: 27015,
  protocol: 'valve',
  type: 'conanexiles',
  host: '172.107.169.170',
  debug: true
}
Q#0 DNS Lookup: 172.107.169.170
Q#0 Raw IP Address: 172.107.169.170
Promise { <pending> }
Q#0 Requesting info ...
Q#0 172.107.169.170: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> (/home/runner/gamedig-testing/node_modules/gamedig/lib/Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
didn't work Error: Failed all 1 attempts
    at QueryRunner.run (/home/runner/gamedig-testing/node_modules/gamedig/lib/QueryRunner.js:88:21)
Attempt #1 - Port=27015 Retry=0:
Error: UDP - Timed out after 2000ms
    at Timeout.<anonymous> (/home/runner/gamedig-testing/node_modules/gamedig/lib/Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)```

And from console:

![cmd_R3HgtqUexs](https://user-images.githubusercontent.com/54485880/91913622-5acfeb00-ecb6-11ea-973c-014f611183b6.png)

If this is purely a firewall type issue, what local ports would have to be accessible? I've spent too much time on this to still keep an overview.
mmorrisontx commented 4 years ago

Conan exiles uses an arbitrary query port. By default, it's 27015, but on shared hosts, it can be whatever they set it to. For the IP you listed, I happened to (just by chance by googling) find that there's a server running on game port 28120 and query port 28122: https://www.battlemetrics.com/servers/conanexiles/8101891

Running gamedig --type conanexiles 172.107.169.170:28122 --debug gets us a bit further, and successfully retrieves the global info but not the player list:

Q#0 Query is running with options: {
  socketTimeout: 2000,
  attemptTimeout: 10000,
  maxAttempts: 1,
  port: 28122,
  protocol: 'valve',
  type: 'conanexiles',
  host: '172.107.169.170',
  debug: true
}
Q#0 DNS Lookup: 172.107.169.170
Q#0 Raw IP Address: 172.107.169.170
Q#0 Requesting info ...
Q#0 172.107.169.170:28122 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

172.107.169.170:28122 <--UDP
Buffer length: 58 bytes
ff ff ff ff 49 02 45 6d 65 72 69 61 6c 20 52 50 00 54 68 65 20
            I     E  m  e  r  i  a  l     R  P     T  h  e
45 78 69 6c 65 64 20 4c 61 6e 64 73 00 00 43 6f 6e 61 6e 20 45
E  x  i  l  e  d     L  a  n  d  s        C  o  n  a  n     E
78 69 6c 65 73 00 00 00 1b 28 00 64 77 00 01 00
x  i  l  e  s              (     d  w

Q#0 Registered RTT: 42ms
Q#0 Received full packet
Q#0 Received 49 expected 49
Q#0 UDP send finished by callback
Q#0 STEAM APPID: 0
Q#0 PROTOCOL: 2
Q#0 Requesting player list ...
Q#0 172.107.169.170:28122 UDP-->
Q#0 Buffer length: 9 bytes
ff ff ff ff 55 ff ff ff ff
            U

Q#0 UDP timeout detected
Q#0 Query failed with error Error: UDP - Timed out after 2000ms

It's possible that conanexiles doesn't support serving the player list, and we should just skip that step for this protocol...

mmorrisontx commented 4 years ago

Fixed that issue in 81a3ec10193fd3f5752689a226c51d8d29dbab25. Give 2.0.23 a shot, but beware that you'll still need to have the proper query port for the game -- it's not always 27015.

gamedig --type conanexiles 172.107.169.170:28122 now gives me:

{"name":"Emerial RP","map":"The Exiled Lands","password":false,"raw":{"protocol"
:2,"folder":"","game":"Conan Exiles","steamappid":0,"numplayers":29,"numbots":0,
"listentype":"d","environment":"w","secure":1,"version":"","rules":{}},"maxplaye
rs":40,"players":[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}
,{},{},{},{},{},{},{},{}],"bots":[],"connect":"172.107.169.170:28122","ping":39}
passivedragon commented 4 years ago

Thank you

passivedragon commented 4 years ago

Personally I can't seem to get the response that you've showed there. Trying that via command line results in the same things as before for me, just like the library version. https://repl.it/@passivedragon/gamedig-testing It's clearly updated to 2.023 but I can't see any change.

mmorrisontx commented 4 years ago

repl.it is almost certainly running scripts in a sandbox which doesn't allow incoming udp. Typically, only tcp protocols can navigate the firewall of isolation sandboxes such as those.

If I run that exact same script locally, I get this output:

Q#0 Query is running with options: {
  socketTimeout: 2000,
  attemptTimeout: 10000,
  maxAttempts: 1,
  port: 28122,
  protocol: 'valve',
  type: 'conanexiles',
  host: '172.107.169.170',
  debug: true
}
Q#0 DNS Lookup: 172.107.169.170
Q#0 Raw IP Address: 172.107.169.170
Q#0 Requesting info ...
Q#0 172.107.169.170:28122 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

172.107.169.170:28122 <--UDP
Buffer length: 69 bytes
ff ff ff ff 49 02 45 6d 65 72 69 61 6c 20 52 50 00 54 68 65 20
            I     E  m  e  r  i  a  l     R  P     T  h  e
45 78 69 6c 65 64 20 4c 61 6e 64 73 00 00 43 6f 6e 61 6e 20 45
E  x  i  l  e  d     L  a  n  d  s        C  o  n  a  n     E
78 69 6c 65 73 00 00 00 0f 28 00 64 77 00 01 00 81 d8 6d 44 ba
x  i  l  e  s              (     d  w                 m  D
06 00 00 00 00 00

Q#0 Registered RTT: 32ms
Q#0 Received full packet
Q#0 Received 49 expected 49
Q#0 UDP send finished by callback
Q#0 INFO:  {
  protocol: 2,
  folder: '',
  game: 'Conan Exiles',
  steamappid: 0,
  numplayers: 15,
  numbots: 0,
  listentype: 'd',
  environment: 'w',
  secure: 1,
  version: '',
  gameid: '440900'
}
Q#0 Requesting player list ...
Q#0 172.107.169.170:28122 UDP-->
Q#0 Buffer length: 9 bytes
ff ff ff ff 55 ff ff ff ff
            U

172.107.169.170:28122 <--UDP
Buffer length: 9 bytes
ff ff ff ff 41 01 b3 81 59
            A           Y

Q#0 Registered RTT: 17ms
Q#0 Received full packet
Q#0 Received 41 expected 44
Q#0 Received new challenge key: 1501672193
Q#0 Challenge key changed -- allowing query retry if needed
Q#0 UDP send finished by callback
Q#0 172.107.169.170:28122 UDP-->
Q#0 Buffer length: 9 bytes
ff ff ff ff 55 01 b3 81 59
            U           Y

172.107.169.170:28122 <--UDP
Buffer length: 374 bytes
ff ff ff ff 44 0f 00 54 72 69 6d 23 33 31 35 37 39 00 00 00 00
            D        T  r  i  m  #  3  1  5  7  9
00 80 ea aa 47 01 4c 69 6c 69 74 61 23 33 30 38 32 38 00 00 00
            G     L  i  l  i  t  a  #  3  0  8  2  8
00 00 80 62 a9 47 02 4c 69 6c 69 74 61 23 33 30 38 32 38 00 00
         b     G     L  i  l  i  t  a  #  3  0  8  2  8
00 00 00 00 1c 65 47 03 e2 98 a2 ef b8 8e 4e 6f 6f 62 e2 98 a2
               e  G                       N  o  o  b
23 36 37 39 39 36 00 00 00 00 00 00 ae 20 47 04 4c 69 6c 69 74
#  6  7  9  9  6                          G     L  i  l  i  t
61 23 33 30 38 32 38 00 00 00 00 00 00 df 14 47 05 52 79 6b 61
a  #  3  0  8  2  8                          G     R  y  k  a
23 30 31 35 33 37 00 00 00 00 00 00 2e ef 46 06 52 79 6b 61 23
#  0  1  5  3  7                    .     F     R  y  k  a  #
30 31 35 33 37 00 00 00 00 00 00 2e ef 46 07 57 68 61 74 74 68
0  1  5  3  7                    .     F     W  h  a  t  t  h
65 66 6c 79 69 6e 67 66 6c 69 70 37 36 23 00 00 00 00 00 00 a6
e  f  l  y  i  n  g  f  l  i  p  7  6  #
96 46 08 52 79 6b 61 23 30 31 35 33 37 00 00 00 00 00 00 a4 90
   F     R  y  k  a  #  0  1  5  3  7
46 09 e2 98 a2 ef b8 8e 4e 6f 6f 62 e2 98 a2 23 36 37 39 39 36
F                       N  o  o  b           #  6  7  9  9  6
00 00 00 00 00 00 b0 5f 46 0a 42 65 65 6c 7a 65 62 75 62 23 38
                     _  F     B  e  e  l  z  e  b  u  b  #  8
35 31 33 33 00 00 00 00 00 00 a4 32 46 0b 52 79 6b 61 23 30 31
5  1  3  3                       2  F     R  y  k  a  #  0  1
35 33 37 00 00 00 00 00 00 a4 90 46 0c e2 98 a2 ef b8 8e 4e 6f
5  3  7                          F                       N  o
6f 62 e2 98 a2 23 36 37 39 39 36 00 00 00 00 00 00 a8 9e 45 0d
o  b           #  6  7  9  9  6                          E
53 53 47 20 7c 20 57 6f 6f 64 65 6e 20 54 72 6f 75 74 23 32 00
S  S  G     |     W  o  o  d  e  n     T  r  o  u  t  #  2
00 00 00 00 00 f8 97 45 0e 53 68 69 74 74 79 20 47 72 65 6d 6c
                     E     S  h  i  t  t  y     G  r  e  m  l
69 6e 23 31 35 36 37 36 00 00 00 00 00 00 40 ba 44
i  n  #  1  5  6  7  6                    @     D

Q#0 Registered RTT: 41ms
Q#0 Received full packet
Q#0 Received 44 expected 44
Q#0 UDP send finished by callback
Q#0 Found player: Trim#31579 0 87509
Q#0 Found player: Lilita#30828 0 86725
Q#0 Found player: Lilita#30828 0 58652
Q#0 Found player: ☢︎Noob☢#67996 0 41134
Q#0 Found player: Lilita#30828 0 38111
Q#0 Found player: Ryka#01537 0 30615
Q#0 Found player: Ryka#01537 0 30615
Q#0 Found player: Whattheflyingflip76# 0 19283
Q#0 Found player: Ryka#01537 0 18514
Q#0 Found player: ☢︎Noob☢#67996 0 14316
Q#0 Found player: Beelzebub#85133 0 11433
Q#0 Found player: Ryka#01537 0 18514
Q#0 Found player: ☢︎Noob☢#67996 0 5077
Q#0 Found player: SSG | Wooden Trout#2 0 4863
Q#0 Found player: Shitty Gremlin#15676 0 1490
Q#0 Requesting rules ...
Q#0 172.107.169.170:28122 UDP-->
Q#0 Buffer length: 9 bytes
ff ff ff ff 56 01 b3 81 59
            V           Y

Q#0 UDP timeout detected
Q#0 UDP timeout resolved by callback
Q#0 Size of players array: 15
Q#0 Size of bots array: 0
Q#0 Query was successful
worked {
  name: 'Emerial RP',
  map: 'The Exiled Lands',
  password: false,
  raw: {
    protocol: 2,
    folder: '',
    game: 'Conan Exiles',
    steamappid: 0,
    numplayers: 15,
    numbots: 0,
    listentype: 'd',
    environment: 'w',
    secure: 1,
    version: '',
    gameid: '440900',
    rules: {}
  },
  maxplayers: 40,
  players: [
    { name: 'Trim#31579', score: 0, time: 87509 },
    { name: 'Lilita#30828', score: 0, time: 86725 },
    { name: 'Lilita#30828', score: 0, time: 58652 },
    { name: '☢︎Noob☢#67996', score: 0, time: 41134 },
    { name: 'Lilita#30828', score: 0, time: 38111 },
    { name: 'Ryka#01537', score: 0, time: 30615 },
    { name: 'Ryka#01537', score: 0, time: 30615 },
    { name: 'Whattheflyingflip76#', score: 0, time: 19283 },
    { name: 'Ryka#01537', score: 0, time: 18514 },
    { name: 'Ryka#01537', score: 0, time: 18514 },
    { name: '☢︎Noob☢#67996', score: 0, time: 14316 },
    { name: 'Beelzebub#85133', score: 0, time: 11433 },
    { name: '☢︎Noob☢#67996', score: 0, time: 5077 },
    { name: 'SSG | Wooden Trout#2', score: 0, time: 4863 },
    { name: 'Shitty Gremlin#15676', score: 0, time: 1490 }
  ],
  bots: [],
  connect: '172.107.169.170:28120',
  ping: 17
}