fix: use vanilla ping format
This commit is contained in:
parent
88ad92e59d
commit
e3e7e293ed
|
@ -5,7 +5,8 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import dgram from 'dgram';
|
import dgram from 'node:dgram';
|
||||||
|
import crypto from 'node:crypto'
|
||||||
|
|
||||||
const MAGIC = "00ffff00fefefefefdfdfdfd12345678";
|
const MAGIC = "00ffff00fefefefefdfdfdfd12345678";
|
||||||
const START_TIME = new Date().getTime();
|
const START_TIME = new Date().getTime();
|
||||||
|
@ -21,7 +22,7 @@ const createUnconnectedPingFrame = (timestamp) => {
|
||||||
buffer.writeUInt8(0x01, 0); // Packet ID
|
buffer.writeUInt8(0x01, 0); // Packet ID
|
||||||
buffer.writeBigInt64LE(BigInt(timestamp), 1); // Timestamp
|
buffer.writeBigInt64LE(BigInt(timestamp), 1); // Timestamp
|
||||||
Buffer.from(MAGIC, "hex").copy(buffer, 9); // OFFLINE_MESSAGE_DATA_ID (Magic)
|
Buffer.from(MAGIC, "hex").copy(buffer, 9); // OFFLINE_MESSAGE_DATA_ID (Magic)
|
||||||
buffer.writeBigInt64LE(BigInt(0), 25); // Client GUID
|
Buffer.from(crypto.randomBytes(8)).copy(buffer, 25); // Client GUID
|
||||||
return buffer;
|
return buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue