diff --git a/lib/ping.js b/lib/ping.js index 859a368..d8e3743 100644 --- a/lib/ping.js +++ b/lib/ping.js @@ -33,7 +33,15 @@ function ping(options, cb) { cb(err); }); client.on('connect', function() { - client.write(0xfe, { magic: 1 }); + client.write(0xfe, { + unused1: 1, + customPayloadId: 250, + magicText: "MC|PingHost", + len: 3 + ip.length + 4, + magic: 73, + ip: host, + port: port, + }); }); var start = Date.now(); diff --git a/lib/protocol.js b/lib/protocol.js index 02416ba..78c4555 100644 --- a/lib/protocol.js +++ b/lib/protocol.js @@ -480,7 +480,13 @@ var packets = { { name: "verifyToken", type: "byteArray16" } ], 0xfe: [ - { name: "magic", type: "byte" } + { name: "unused1", type: "byte" }, + { name: "customPayloadId", type: "byte" }, + { name: "magicText", type: "string" }, + { name: "len", type: "short" }, + { name: "magic", type: "byte" }, + { name: "ip", type: "string" }, + { name: "port", type: "int" } ], 0xff: [ { name: "reason", type: "string" }