-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FE legacy ping support #332
Comments
This packet is supported for serialization/deserialization by https://github.com/PrismarineJS/minecraft-data/blob/master/data/1.8/protocol.json#L148: "legacy_server_list_ping": {
"id": "0xfe",
"fields": [
{
"name": "payload",
"type": "ubyte"
}
]
} but nothing currently reads/writes it |
That probably doesn't work. It needs to be sent without the length-prefix and with a byte ID instead of varint ID, no ? |
Yeah I think needs to be special-cased somehow |
Yeah maybe just with a simple if (packet.name=="legacy_server_list_ping"){ On Wed, Jan 27, 2016, 05:23 deathcap [email protected] wrote:
|
Ah, not sure how that should be handled by the parsing pipeline though On Wed, Jan 27, 2016, 08:55 Romain Beaumont [email protected] wrote:
|
Researching the various pings in https://github.com/deathcap/node-minecraft-ping, details in the repo but overall summary of server support:
(*) As implemented in node-minecraft-protocol src/ping.js (**) Limited = responds but does not return the game/protocol version What I call |
Released https://www.npmjs.com/package/minecraft-ping, but it is only for the client-side ping. For server in node-minecraft-protocol, currently gets stuck in the splitter transform. I think we'll need to do something like this:
this gets the legacy server list ping to the deserializer, which recognizes it:
but it will need to be handled. Also, for par with vanilla, deserialization should be able to read:
Currently it can read the last two, but not the first:
or
If only 0xfe is received, then the server should (or at least vanilla servers do) return the "ping 0" response, example:
0xff (kick) + 2-byte length + UCS-2 string: motd + \xa7 + current players (decimal string) + \xa7 + max players (decimal string) If 0xfe is received followed by 0x01 (and then optionally anything else; 1.6.4 sends some MC|PingHost junk, but it does not matter), then the server should send the "ping 1" response:
Same 0xff (kick) + 2-byte length + UCS-2 string format, but it begins with \xa7 + digit '1' and has \0-delimited fields: if (string[0] == '\xa7') {
const parts = string.split('\0');
result.pingVersion = parseInt(parts[0].slice(1));
result.protocolVersion = parseInt(parts[1]);
result.gameVersion = parts[2];
result.motd = parts[3];
result.playersOnline = parseInt(parts[4]); |
The splitter is easy enough to special-case for 0xfe, but not sure how to special-case in the deserializer. Currently, 0xfe 0x01 decodes to varint 254, and 0xfe is an incomplete varint. Should legacy ping support be added somewhere in here? // src/transforms/serializer.js createProtocol
proto.addType("packet",["container", [
{ "name": "name", "type":["mapper",{"type": "varint" ,
"mappings":Object.keys(packets).reduce(function(acc,name){
acc[parseInt(packets[name].id)]=name;
return acc;
},{})
}]},
{ "name": "params", "type": ["switch", {
"compareTo": "name",
"fields": Object.keys(packets).reduce(function(acc,name){
acc[name]="packet_"+name;
return acc;
},{})
}]}
]]); but only for the The difficulty is that the first few bytes of the packet can either be a varint length, or a packet identifier byte.. can protodef express this? I know it can switch on another field, but can the field have two different types depending on its value? (if 0xfe, then read rest of bytes as the payload; if anything else, read as a varint length, continue parsing). It would be be easiest if 0xfe legacy ping handling could bypass the deserializer, but I can't see how to do this. |
It seems the vanilla client uses the legacy ping when trying to ping a server with an other version. |
src/ping.js implements a server list ping using
ping
andping_start
in theSTATUS
protocol state, but there is another type of ping initiated by sending the bytes 0xfe 0x01. Sometimes known as the "legacy" ping, but it supported by modern versions of Minecraft, including 1.8.9 and the 1.9 snapshots: http://wiki.vg/Protocol#Legacy_Server_List_Pingnode-minecraft-protocol should support FE01 ping, in both the server and client. Server is especially important since third-party ping/status software may still send FE01 pings, due to simplicity and widespread support (vanilla servers support it). Client support would be useful when pinging servers of an unknown version, including those with the modern Netty protocol, or earlier versions (all the way back to Minecraft 1.4.4 release is supported by the FE01 ping).
Example of fe01 ping in nodejs: https://github.com/deathcap/mcping16/blob/master/mcping16.js#L124 - but needs to be cleaned up to use protodef, etc.
The text was updated successfully, but these errors were encountered: