node-minecraft-ping icon indicating copy to clipboard operation
node-minecraft-ping copied to clipboard

Uber-ping/meta-ping: try different or all pings, return what works

Open deathcap opened this issue 9 years ago • 2 comments

The default operation of this module should be to, given nothing but a server address, return generally useful information about it. Including if possible the protocol/game version (for nmp-auto).

FE01 therefore is a good default since it supports 1.4.4-1.9, but if it fails, maybe try the FEFD pings or FE00? (GH-2). If it can make a good guess, detecting the failure mode where a Minecraft server is likely listening, but does not understand FE01.

Of course, individual ping types should still be available on their own.

What about the "modern ping" (status handshake state) on 1.8 (and thereabout)? Maybe if FE01 detects a compatible version, it could send another ping, the modern ping, to get more info. Could be useful since the JSON response may include modinfo, Forge mods, for nmp-forge. Or maybe try a handshake status ping first, if can reliably detect when should instead try FE01 ping. Or try both simultaneously.

deathcap avatar Jan 28 '16 08:01 deathcap

The demo script tries all the pings. Here's what happens:

node-minecraft-ping $ node demo.js localhost 12500
ended
received ping_fe { pingVersion: -1,
  motd: 'Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
^C

node-minecraft-ping $ node demo.js localhost 13200
ended
received ping_fe { pingVersion: -1,
  motd: 'Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
^C

node-minecraft-ping $ node demo.js localhost 14400
received ping_fe01 { pingVersion: 1,
  protocolVersion: 49,
  gameVersion: '1.4.4',
  motd: 'A Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
(delay)
received ping_fe { pingVersion: -1,
  motd: 'Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
ended
^C

node-minecraft-ping $ node demo.js localhost 15200
received ping_fe01 { pingVersion: 1,
  protocolVersion: 61,
  gameVersion: '1.5.2',
  motd: 'A Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
(delay)
received ping_fe { pingVersion: -1,
  motd: 'Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
ended
^C

node-minecraft-ping $ node demo.js localhost 16400
received ping_fe01 { pingVersion: 1,
  protocolVersion: 78,
  gameVersion: '1.6.4',
  motd: 'A Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
(delay)
received ping_fe { pingVersion: -1,
  motd: 'Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
ended
^C

node-minecraft-ping $ node demo.js localhost 17100
received ping_fe01 { pingVersion: 1,
  protocolVersion: 127,
  gameVersion: '1.7.10',
  motd: 'A Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
ended
(right after)
received ping_fe { pingVersion: -1,
  motd: 'Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
^C

node-minecraft-ping $ node demo.js localhost 18900
received ping_fe01 { pingVersion: 1,
  protocolVersion: 127,
  gameVersion: '1.8.9',
  motd: 'A Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
(right after)
received ping_fe { pingVersion: -1,
  motd: 'Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
ended
^C

node-minecraft-ping $ node demo.js localhost 19000
received ping_fe01 { pingVersion: 1,
  protocolVersion: 127,
  gameVersion: '16w03a',
  motd: 'A Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }
ended
(right after)
received ping_fe { pingVersion: -1,
  motd: 'Minecraft Server',
  playersOnline: 0,
  maxPlayers: 2 }

1.2 and 1.3 only respond to FE (due to the FE01 MC|PingHost incompatibility, see https://github.com/deathcap/node-minecraft-ping/issues/2, required for instant 1.6.4 pings). 1.4, 1.5, 1.6 respond to FE01, and then after a delay (presumably a timeout) return FE too. 1.7, 1.8, 1.9 respond to both FE01 and FE at about the same time.

deathcap avatar Jan 29 '16 07:01 deathcap

The only benefit of multiple pings is that 1.3.2, 1.2.5, etc. and earlier could be "supported", but only in a limited sense, since ping_fe (and `ping_fe01 on ≤1.3.2) doesn't return the protocol version.

You could tell a "minecraft server" is running some older version, but not what it was except a nonspecific "1.3.2 or earlier". Maybe interoperability very old modded 1.2.5 servers would benefit.

But you can't even download anything earlier than 1.2.5 from the normal channels (see https://github.com/rom1504/node-minecraft-wrap/issues/9), Mojang has a launcher but only for the client(?). So this comes down to significant complexity to only support basically two major versions, one of which (1.3.x) was not too popular for modding, and probably many of the 1.2.5 holdouts have moved onto at least 1.5.2.

Marking as wontfix, but leaving open since could be reconsidered later if there is a compelling need (and it would sort of fit into node-minecraft-ping's goal of "pinging everything"). Nonetheless for now, targeting only 1.4.4+

deathcap avatar Jan 30 '16 19:01 deathcap