@sanctumterra/raknet 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +2 -0
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +0 -1
- package/dist/shared/proto/offline/open-connection-reply-one.d.ts +2 -0
- package/dist/shared/proto/offline/open-connection-reply-one.d.ts.map +1 -1
- package/dist/shared/proto/offline/open-connection-reply-one.js +19 -5
- package/dist/shared/proto/offline/open-connection-request-two.d.ts +1 -0
- package/dist/shared/proto/offline/open-connection-request-two.d.ts.map +1 -1
- package/dist/shared/proto/offline/open-connection-request-two.js +12 -7
- package/dist/tests/client-once.js +3 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,YAAY,EAWZ,QAAQ,EAIR,KAAK,KAAK,EAIV,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACN,KAAK,aAAa,EAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAgB,KAAK,UAAU,EAAe,MAAM,YAAY,CAAC;AAGxE,qBAAa,MAAO,SAAQ,YAAY,CAAC,YAAY,CAAC;IACrD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAA2B;IAC7D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAO;IAE1C,OAAO,EAAE,aAAa,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,MAAM,CAAmB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAAS;gBAEd,OAA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QAA0B;IAI/D,IAAI,IAAI,IAAI;IAQZ,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIxB,UAAU,IAAI,IAAI;CAIzB"}
|
package/dist/client/client.js
CHANGED
|
@@ -100,6 +100,8 @@ class Client extends shared_1.EventEmitter {
|
|
|
100
100
|
request.mtu = reply.mtu;
|
|
101
101
|
request.guid = this.options.guid;
|
|
102
102
|
request.cookie = reply.cookie;
|
|
103
|
+
// Set to false since we don't support libcat encryption
|
|
104
|
+
request.clientSupportsecurity = false;
|
|
103
105
|
this.send(request.serialize());
|
|
104
106
|
break;
|
|
105
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,YAAY,EAQZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EACN,KAAK,aAAa,EAElB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAExB,MAAM,SAAS,CAAC;AAGjB,qBAAa,MAAO,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IAC3D,OAAO,CAAC,MAAM,CAAS;IACvB,SAAgB,OAAO,EAAE,mBAAmB,CAAC;IACtC,aAAa,EAAE,aAAa,CAAC;IACpC,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAiB;gBAEzB,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM;IAuB/C,IAAI;IAOJ,MAAM;IAab,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,YAAY,EAQZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EACN,KAAK,aAAa,EAElB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAExB,MAAM,SAAS,CAAC;AAGjB,qBAAa,MAAO,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IAC3D,OAAO,CAAC,MAAM,CAAS;IACvB,SAAgB,OAAO,EAAE,mBAAmB,CAAC;IACtC,aAAa,EAAE,aAAa,CAAC;IACpC,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAiB;gBAEzB,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM;IAuB/C,IAAI;IAOJ,MAAM;IAab,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,SAAS;IA6EV,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAGzD"}
|
package/dist/server/server.js
CHANGED
|
@@ -65,7 +65,6 @@ class Server extends shared_1.EventEmitter {
|
|
|
65
65
|
id = 0x80;
|
|
66
66
|
switch (id) {
|
|
67
67
|
case shared_1.Packets.UnconnectedPing: {
|
|
68
|
-
console.log("Received Ping! from: ", rinfo.address);
|
|
69
68
|
const pong = new shared_1.UnconnectedPong();
|
|
70
69
|
pong.guid = this.options.guid;
|
|
71
70
|
pong.message = (0, types_1.AdvertisementToString)(this.advertisement);
|
|
@@ -2,7 +2,9 @@ import { BinaryStream } from "@serenityjs/binarystream";
|
|
|
2
2
|
export declare class OpenConnectionReplyOne extends BinaryStream {
|
|
3
3
|
guid: bigint;
|
|
4
4
|
security: boolean;
|
|
5
|
+
hasCookie: boolean;
|
|
5
6
|
cookie: number | null;
|
|
7
|
+
serverPublicKey: Buffer | null;
|
|
6
8
|
mtu: number;
|
|
7
9
|
serialize(): Buffer;
|
|
8
10
|
deserialize(): OpenConnectionReplyOne;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-connection-reply-one.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/offline/open-connection-reply-one.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,
|
|
1
|
+
{"version":3,"file":"open-connection-reply-one.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/offline/open-connection-reply-one.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EAKZ,MAAM,0BAA0B,CAAC;AAIlC,qBAAa,sBAAuB,SAAQ,YAAY;IAChD,IAAI,EAAG,MAAM,CAAC;IACd,QAAQ,EAAG,OAAO,CAAC;IACnB,SAAS,EAAG,OAAO,CAAC;IACpB,MAAM,EAAG,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,EAAG,MAAM,GAAG,IAAI,CAAC;IAChC,GAAG,EAAG,MAAM,CAAC;IAEb,SAAS,IAAI,MAAM;IAYnB,WAAW,IAAI,sBAAsB;CAyB5C"}
|
|
@@ -7,7 +7,9 @@ const types_1 = require("../types");
|
|
|
7
7
|
class OpenConnectionReplyOne extends binarystream_1.BinaryStream {
|
|
8
8
|
guid;
|
|
9
9
|
security;
|
|
10
|
+
hasCookie;
|
|
10
11
|
cookie;
|
|
12
|
+
serverPublicKey;
|
|
11
13
|
mtu;
|
|
12
14
|
serialize() {
|
|
13
15
|
binarystream_1.Uint8.write(this, enums_1.Packets.OpenConnectionReply1);
|
|
@@ -15,21 +17,33 @@ class OpenConnectionReplyOne extends binarystream_1.BinaryStream {
|
|
|
15
17
|
binarystream_1.Int64.write(this, this.guid);
|
|
16
18
|
binarystream_1.Bool.write(this, this.security);
|
|
17
19
|
if (this.security && this.cookie != null) {
|
|
18
|
-
|
|
20
|
+
this.writeUint32(this.cookie);
|
|
19
21
|
}
|
|
20
|
-
|
|
22
|
+
this.writeUint16(this.mtu);
|
|
21
23
|
return this.getBuffer();
|
|
22
24
|
}
|
|
23
25
|
deserialize() {
|
|
24
26
|
binarystream_1.Uint8.read(this);
|
|
25
27
|
types_1.Magic.read(this);
|
|
26
|
-
this.guid = binarystream_1.
|
|
28
|
+
this.guid = this.readInt64(binarystream_1.Endianness.Little);
|
|
27
29
|
this.security = binarystream_1.Bool.read(this);
|
|
28
30
|
this.cookie = null;
|
|
31
|
+
this.hasCookie = false;
|
|
32
|
+
this.serverPublicKey = null;
|
|
29
33
|
if (this.security) {
|
|
30
|
-
|
|
34
|
+
const remaining = this.buffer.byteLength - this.offset;
|
|
35
|
+
// Full security format: has_cookie (1) + cookie (4) + public_key (294) + mtu (2) = 301
|
|
36
|
+
if (remaining >= 1 + 4 + 294 + 2) {
|
|
37
|
+
this.hasCookie = binarystream_1.Bool.read(this);
|
|
38
|
+
this.cookie = this.readUint32();
|
|
39
|
+
this.serverPublicKey = this.read(294);
|
|
40
|
+
}
|
|
41
|
+
else if (remaining >= 4 + 2) {
|
|
42
|
+
// Simple security format: cookie (4) + mtu (2)
|
|
43
|
+
this.cookie = this.readUint32();
|
|
44
|
+
}
|
|
31
45
|
}
|
|
32
|
-
this.mtu =
|
|
46
|
+
this.mtu = this.readUint16();
|
|
33
47
|
return this;
|
|
34
48
|
}
|
|
35
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-connection-request-two.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/offline/open-connection-request-two.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"open-connection-request-two.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/offline/open-connection-request-two.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAsB,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,OAAO,EAAS,MAAM,UAAU,CAAC;AAE1C,qBAAa,wBAAyB,SAAQ,YAAY;IAClD,OAAO,EAAG,OAAO,CAAC;IAClB,GAAG,EAAG,MAAM,CAAC;IACb,IAAI,EAAG,MAAM,CAAC;IACd,MAAM,EAAG,MAAM,GAAG,IAAI,CAAC;IACvB,qBAAqB,EAAG,OAAO,CAAC;IAEhC,SAAS,IAAI,MAAM;IAcnB,WAAW,IAAI,wBAAwB;CAc9C"}
|
|
@@ -9,26 +9,31 @@ class OpenConnectionRequestTwo extends binarystream_1.BinaryStream {
|
|
|
9
9
|
mtu;
|
|
10
10
|
guid;
|
|
11
11
|
cookie;
|
|
12
|
+
clientSupportsecurity;
|
|
12
13
|
serialize() {
|
|
13
14
|
binarystream_1.Uint8.write(this, enums_1.Packets.OpenConnectionRequest2);
|
|
14
15
|
types_1.Magic.write(this);
|
|
15
16
|
if (this.cookie != null) {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
this.writeUint32(this.cookie);
|
|
18
|
+
// client_supports_security should be false if we don't support libcat encryption
|
|
19
|
+
binarystream_1.Bool.write(this, this.clientSupportsecurity ?? false);
|
|
18
20
|
}
|
|
19
21
|
types_1.Address.write(this, this.address);
|
|
20
|
-
|
|
22
|
+
this.writeUint16(this.mtu);
|
|
21
23
|
binarystream_1.Int64.write(this, this.guid);
|
|
22
24
|
return this.getBuffer();
|
|
23
25
|
}
|
|
24
26
|
deserialize() {
|
|
25
27
|
binarystream_1.Uint8.read(this);
|
|
26
28
|
types_1.Magic.read(this);
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
29
|
+
// Check if there's enough data for cookie + clientSupportsecurity before address
|
|
30
|
+
// Cookie format: cookie (4) + clientSupportsecurity (1) = 5 bytes minimum before address
|
|
31
|
+
// We need to peek ahead to determine if security data is present
|
|
32
|
+
// For now, assume no security on deserialize (server-side typically doesn't need this)
|
|
33
|
+
this.cookie = null;
|
|
34
|
+
this.clientSupportsecurity = false;
|
|
30
35
|
this.address = types_1.Address.read(this);
|
|
31
|
-
this.mtu =
|
|
36
|
+
this.mtu = this.readUint16();
|
|
32
37
|
this.guid = binarystream_1.Int64.read(this);
|
|
33
38
|
return this;
|
|
34
39
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const client_1 = require("../client");
|
|
4
4
|
const client = new client_1.Client({
|
|
5
|
-
address: "donutsmp.net",
|
|
5
|
+
// address: "donutsmp.net",
|
|
6
|
+
// address: "127.0.0.1",
|
|
7
|
+
address: "geo.hivebedrock.network",
|
|
6
8
|
});
|
|
7
9
|
client.on("unconnectedPong", (packet) => {
|
|
8
10
|
console.log(packet);
|