docs: some clarifications in createUnconnectedPingFrame

This commit is contained in:
Timofey Gelazoniya 2024-03-31 02:01:46 +03:00
parent fa4c34d896
commit 0b0bed4e71
Signed by: zeldon
GPG Key ID: 047886915281DD2A
1 changed files with 5 additions and 5 deletions

View File

@ -16,12 +16,12 @@ const START_TIME = new Date().getTime();
* @returns {Buffer} * @returns {Buffer}
* @see {@link https://wiki.vg/Raknet_Protocol#Unconnected_Ping} * @see {@link https://wiki.vg/Raknet_Protocol#Unconnected_Ping}
*/ */
const createUnconnectedPingFrame = (pingId) => { const createUnconnectedPingFrame = (timestamp) => {
const buffer = Buffer.alloc(33); const buffer = Buffer.alloc(33);
buffer.writeUInt8(0x01, 0); buffer.writeUInt8(0x01, 0); // Packet ID
buffer.writeBigInt64LE(BigInt(pingId), 1); buffer.writeBigInt64LE(BigInt(timestamp), 1); // Timestamp
Buffer.from(MAGIC, "hex").copy(buffer, 9); Buffer.from(MAGIC, "hex").copy(buffer, 9); // OFFLINE_MESSAGE_DATA_ID (Magic)
buffer.writeBigInt64LE(BigInt(0), 25); buffer.writeBigInt64LE(BigInt(0), 25); // Client GUID
return buffer; return buffer;
}; };