@baltica/raknet 0.0.1

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.
Files changed (95) hide show
  1. package/dist/client/client.d.ts +20 -0
  2. package/dist/client/client.js +122 -0
  3. package/dist/client/index.d.ts +2 -0
  4. package/dist/client/index.js +18 -0
  5. package/dist/client/types/client-events.d.ts +6 -0
  6. package/dist/client/types/client-events.js +2 -0
  7. package/dist/client/types/client-options.d.ts +12 -0
  8. package/dist/client/types/client-options.js +11 -0
  9. package/dist/client/types/index.d.ts +2 -0
  10. package/dist/client/types/index.js +18 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.js +19 -0
  13. package/dist/server/connection.d.ts +16 -0
  14. package/dist/server/connection.js +30 -0
  15. package/dist/server/index.d.ts +3 -0
  16. package/dist/server/index.js +19 -0
  17. package/dist/server/server.d.ts +19 -0
  18. package/dist/server/server.js +119 -0
  19. package/dist/server/types/index.d.ts +2 -0
  20. package/dist/server/types/index.js +18 -0
  21. package/dist/server/types/server-events.d.ts +6 -0
  22. package/dist/server/types/server-events.js +2 -0
  23. package/dist/server/types/server-options.d.ts +10 -0
  24. package/dist/server/types/server-options.js +11 -0
  25. package/dist/shared/index.d.ts +3 -0
  26. package/dist/shared/index.js +19 -0
  27. package/dist/shared/network-session.d.ts +63 -0
  28. package/dist/shared/network-session.js +480 -0
  29. package/dist/shared/proto/enums/index.d.ts +4 -0
  30. package/dist/shared/proto/enums/index.js +20 -0
  31. package/dist/shared/proto/enums/packet.d.ts +21 -0
  32. package/dist/shared/proto/enums/packet.js +25 -0
  33. package/dist/shared/proto/enums/priority.d.ts +6 -0
  34. package/dist/shared/proto/enums/priority.js +8 -0
  35. package/dist/shared/proto/enums/reliability.d.ts +10 -0
  36. package/dist/shared/proto/enums/reliability.js +14 -0
  37. package/dist/shared/proto/enums/status.d.ts +6 -0
  38. package/dist/shared/proto/enums/status.js +10 -0
  39. package/dist/shared/proto/index.d.ts +3 -0
  40. package/dist/shared/proto/index.js +19 -0
  41. package/dist/shared/proto/packets/data-packet.d.ts +7 -0
  42. package/dist/shared/proto/packets/data-packet.js +14 -0
  43. package/dist/shared/proto/packets/index.d.ts +3 -0
  44. package/dist/shared/proto/packets/index.js +19 -0
  45. package/dist/shared/proto/packets/offline/index.d.ts +6 -0
  46. package/dist/shared/proto/packets/offline/index.js +22 -0
  47. package/dist/shared/proto/packets/offline/open-connection-reply-one.d.ts +13 -0
  48. package/dist/shared/proto/packets/offline/open-connection-reply-one.js +46 -0
  49. package/dist/shared/proto/packets/offline/open-connection-reply-two.d.ts +12 -0
  50. package/dist/shared/proto/packets/offline/open-connection-reply-two.js +32 -0
  51. package/dist/shared/proto/packets/offline/open-connection-request-one.d.ts +9 -0
  52. package/dist/shared/proto/packets/offline/open-connection-request-one.js +26 -0
  53. package/dist/shared/proto/packets/offline/open-connection-request-two.d.ts +13 -0
  54. package/dist/shared/proto/packets/offline/open-connection-request-two.js +43 -0
  55. package/dist/shared/proto/packets/offline/unconnected-ping.d.ts +9 -0
  56. package/dist/shared/proto/packets/offline/unconnected-ping.js +25 -0
  57. package/dist/shared/proto/packets/offline/unconnected-pong.d.ts +10 -0
  58. package/dist/shared/proto/packets/offline/unconnected-pong.js +28 -0
  59. package/dist/shared/proto/packets/online/ack.d.ts +5 -0
  60. package/dist/shared/proto/packets/online/ack.js +9 -0
  61. package/dist/shared/proto/packets/online/acknowledgement.d.ts +6 -0
  62. package/dist/shared/proto/packets/online/acknowledgement.js +72 -0
  63. package/dist/shared/proto/packets/online/connected-ping.d.ts +8 -0
  64. package/dist/shared/proto/packets/online/connected-ping.js +19 -0
  65. package/dist/shared/proto/packets/online/connected-pong.d.ts +9 -0
  66. package/dist/shared/proto/packets/online/connected-pong.js +22 -0
  67. package/dist/shared/proto/packets/online/connection-request-accepted.d.ts +13 -0
  68. package/dist/shared/proto/packets/online/connection-request-accepted.js +41 -0
  69. package/dist/shared/proto/packets/online/connection-request.d.ts +10 -0
  70. package/dist/shared/proto/packets/online/connection-request.js +25 -0
  71. package/dist/shared/proto/packets/online/disconnect.d.ts +7 -0
  72. package/dist/shared/proto/packets/online/disconnect.js +16 -0
  73. package/dist/shared/proto/packets/online/frame-set.d.ts +10 -0
  74. package/dist/shared/proto/packets/online/frame-set.js +24 -0
  75. package/dist/shared/proto/packets/online/index.d.ts +10 -0
  76. package/dist/shared/proto/packets/online/index.js +26 -0
  77. package/dist/shared/proto/packets/online/nack.d.ts +5 -0
  78. package/dist/shared/proto/packets/online/nack.js +9 -0
  79. package/dist/shared/proto/packets/online/new-incoming-connection.d.ts +12 -0
  80. package/dist/shared/proto/packets/online/new-incoming-connection.js +33 -0
  81. package/dist/shared/proto/types/address.d.ts +11 -0
  82. package/dist/shared/proto/types/address.js +61 -0
  83. package/dist/shared/proto/types/data-type.d.ts +5 -0
  84. package/dist/shared/proto/types/data-type.js +9 -0
  85. package/dist/shared/proto/types/frame.d.ts +22 -0
  86. package/dist/shared/proto/types/frame.js +113 -0
  87. package/dist/shared/proto/types/index.d.ts +5 -0
  88. package/dist/shared/proto/types/index.js +21 -0
  89. package/dist/shared/proto/types/magic.d.ts +7 -0
  90. package/dist/shared/proto/types/magic.js +17 -0
  91. package/dist/shared/proto/types/mtu.d.ts +5 -0
  92. package/dist/shared/proto/types/mtu.js +12 -0
  93. package/dist/shared/socks5.d.ts +16 -0
  94. package/dist/shared/socks5.js +166 -0
  95. package/package.json +26 -0
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data-packet"), exports);
18
+ __exportStar(require("./offline"), exports);
19
+ __exportStar(require("./online"), exports);
@@ -0,0 +1,6 @@
1
+ export * from "./unconnected-ping";
2
+ export * from "./unconnected-pong";
3
+ export * from "./open-connection-request-one";
4
+ export * from "./open-connection-request-two";
5
+ export * from "./open-connection-reply-one";
6
+ export * from "./open-connection-reply-two";
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./unconnected-ping"), exports);
18
+ __exportStar(require("./unconnected-pong"), exports);
19
+ __exportStar(require("./open-connection-request-one"), exports);
20
+ __exportStar(require("./open-connection-request-two"), exports);
21
+ __exportStar(require("./open-connection-reply-one"), exports);
22
+ __exportStar(require("./open-connection-reply-two"), exports);
@@ -0,0 +1,13 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ export declare class OpenConnectionReplyOne extends DataPacket {
4
+ static ID: Packet;
5
+ guid: bigint;
6
+ security: boolean;
7
+ hasCookie: boolean;
8
+ cookie: number | null;
9
+ serverPublicKey: Buffer | null;
10
+ mtu: number;
11
+ serialize(): Buffer;
12
+ deserialize(): this;
13
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenConnectionReplyOne = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ const magic_1 = require("../../types/magic");
7
+ class OpenConnectionReplyOne extends data_packet_1.DataPacket {
8
+ static ID = packet_1.Packet.OpenConnectionReply1;
9
+ guid;
10
+ security;
11
+ hasCookie;
12
+ cookie;
13
+ serverPublicKey;
14
+ mtu;
15
+ serialize() {
16
+ this.writeUint8(OpenConnectionReplyOne.ID);
17
+ new magic_1.Magic().write(this);
18
+ this.writeUint64(this.guid);
19
+ this.writeBool(this.security);
20
+ if (this.security) {
21
+ if (this.cookie != null) {
22
+ this.writeUint32(this.cookie);
23
+ }
24
+ if (this.serverPublicKey) {
25
+ this.write(this.serverPublicKey);
26
+ }
27
+ }
28
+ this.writeUint16(this.mtu);
29
+ return this.getBuffer();
30
+ }
31
+ deserialize() {
32
+ magic_1.Magic.read(this);
33
+ this.guid = this.readUint64();
34
+ this.security = this.readBool();
35
+ this.cookie = null;
36
+ this.hasCookie = false;
37
+ this.serverPublicKey = null;
38
+ if (this.security) {
39
+ this.hasCookie = true;
40
+ this.cookie = this.readUint32();
41
+ }
42
+ this.mtu = this.readUint16();
43
+ return this;
44
+ }
45
+ }
46
+ exports.OpenConnectionReplyOne = OpenConnectionReplyOne;
@@ -0,0 +1,12 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ import { Address } from "../../types/address";
4
+ export declare class OpenConnectionReplyTwo extends DataPacket {
5
+ static ID: Packet;
6
+ guid: bigint;
7
+ address: Address;
8
+ mtu: number;
9
+ encryptionEnabled: boolean;
10
+ serialize(): Buffer;
11
+ deserialize(): this;
12
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenConnectionReplyTwo = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ const magic_1 = require("../../types/magic");
7
+ const address_1 = require("../../types/address");
8
+ class OpenConnectionReplyTwo extends data_packet_1.DataPacket {
9
+ static ID = packet_1.Packet.OpenConnectionReply2;
10
+ guid;
11
+ address;
12
+ mtu;
13
+ encryptionEnabled;
14
+ serialize() {
15
+ this.writeUint8(OpenConnectionReplyTwo.ID);
16
+ new magic_1.Magic().write(this);
17
+ this.writeUint64(this.guid);
18
+ address_1.Address.write(this, this.address);
19
+ this.writeInt16(this.mtu);
20
+ this.writeBool(this.encryptionEnabled);
21
+ return this.getBuffer();
22
+ }
23
+ deserialize() {
24
+ magic_1.Magic.read(this);
25
+ this.guid = this.readUint64();
26
+ this.address = address_1.Address.read(this);
27
+ this.mtu = this.readInt16();
28
+ this.encryptionEnabled = this.readBool();
29
+ return this;
30
+ }
31
+ }
32
+ exports.OpenConnectionReplyTwo = OpenConnectionReplyTwo;
@@ -0,0 +1,9 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ export declare class OpenConnectionRequestOne extends DataPacket {
4
+ static ID: Packet;
5
+ protocol: number;
6
+ mtu: number;
7
+ serialize(): Buffer;
8
+ deserialize(): this;
9
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenConnectionRequestOne = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ const magic_1 = require("../../types/magic");
7
+ const mtu_1 = require("../../types/mtu");
8
+ class OpenConnectionRequestOne extends data_packet_1.DataPacket {
9
+ static ID = packet_1.Packet.OpenConnectionRequest1;
10
+ protocol;
11
+ mtu;
12
+ serialize() {
13
+ this.writeUint8(OpenConnectionRequestOne.ID);
14
+ new magic_1.Magic().write(this);
15
+ this.writeUint8(this.protocol);
16
+ mtu_1.MTU.write(this, this.mtu);
17
+ return this.getBuffer();
18
+ }
19
+ deserialize() {
20
+ magic_1.Magic.read(this);
21
+ this.protocol = this.readUint8();
22
+ this.mtu = mtu_1.MTU.read(this);
23
+ return this;
24
+ }
25
+ }
26
+ exports.OpenConnectionRequestOne = OpenConnectionRequestOne;
@@ -0,0 +1,13 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ import { Address } from "../../types/address";
4
+ export declare class OpenConnectionRequestTwo extends DataPacket {
5
+ static ID: Packet;
6
+ address: Address;
7
+ mtu: number;
8
+ guid: bigint;
9
+ cookie: number | null;
10
+ clientSupportsecurity: boolean;
11
+ serialize(): Buffer;
12
+ deserialize(): this;
13
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenConnectionRequestTwo = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ const magic_1 = require("../../types/magic");
7
+ const address_1 = require("../../types/address");
8
+ class OpenConnectionRequestTwo extends data_packet_1.DataPacket {
9
+ static ID = packet_1.Packet.OpenConnectionRequest2;
10
+ address;
11
+ mtu;
12
+ guid;
13
+ cookie;
14
+ clientSupportsecurity;
15
+ serialize() {
16
+ this.writeUint8(OpenConnectionRequestTwo.ID);
17
+ new magic_1.Magic().write(this);
18
+ if (this.cookie != null) {
19
+ this.writeUint32(this.cookie);
20
+ this.writeBool(this.clientSupportsecurity ?? false);
21
+ }
22
+ address_1.Address.write(this, this.address);
23
+ this.writeUint16(this.mtu);
24
+ this.writeUint64(this.guid);
25
+ return this.getBuffer();
26
+ }
27
+ deserialize() {
28
+ magic_1.Magic.read(this);
29
+ const remaining = this.buffer.byteLength - this.offset;
30
+ const minWithoutCookie = 7 + 2 + 8;
31
+ this.cookie = null;
32
+ this.clientSupportsecurity = false;
33
+ if (remaining > minWithoutCookie) {
34
+ this.cookie = this.readUint32();
35
+ this.clientSupportsecurity = this.readBool();
36
+ }
37
+ this.address = address_1.Address.read(this);
38
+ this.mtu = this.readUint16();
39
+ this.guid = this.readUint64();
40
+ return this;
41
+ }
42
+ }
43
+ exports.OpenConnectionRequestTwo = OpenConnectionRequestTwo;
@@ -0,0 +1,9 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ export declare class UnconnectedPing extends DataPacket {
4
+ static ID: Packet;
5
+ timestamp: bigint;
6
+ guid: bigint;
7
+ serialize(): Buffer;
8
+ deserialize(): this;
9
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnconnectedPing = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ const magic_1 = require("../../types/magic");
7
+ class UnconnectedPing extends data_packet_1.DataPacket {
8
+ static ID = packet_1.Packet.UnconnectedPing;
9
+ timestamp;
10
+ guid;
11
+ serialize() {
12
+ this.writeUint8(UnconnectedPing.ID);
13
+ this.writeInt64(this.timestamp);
14
+ new magic_1.Magic().write(this);
15
+ this.writeUint64(this.guid);
16
+ return this.getBuffer();
17
+ }
18
+ deserialize() {
19
+ this.timestamp = this.readInt64();
20
+ magic_1.Magic.read(this);
21
+ this.guid = this.readUint64();
22
+ return this;
23
+ }
24
+ }
25
+ exports.UnconnectedPing = UnconnectedPing;
@@ -0,0 +1,10 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ export declare class UnconnectedPong extends DataPacket {
4
+ static ID: Packet;
5
+ timestamp: bigint;
6
+ guid: bigint;
7
+ message: string;
8
+ serialize(): Buffer;
9
+ deserialize(): this;
10
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnconnectedPong = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ const magic_1 = require("../../types/magic");
7
+ class UnconnectedPong extends data_packet_1.DataPacket {
8
+ static ID = packet_1.Packet.UnconnectedPong;
9
+ timestamp;
10
+ guid;
11
+ message;
12
+ serialize() {
13
+ this.writeUint8(UnconnectedPong.ID);
14
+ this.writeInt64(this.timestamp);
15
+ this.writeUint64(this.guid);
16
+ new magic_1.Magic().write(this);
17
+ this.writeString16(this.message);
18
+ return this.getBuffer();
19
+ }
20
+ deserialize() {
21
+ this.timestamp = this.readInt64();
22
+ this.guid = this.readUint64();
23
+ magic_1.Magic.read(this);
24
+ this.message = this.readString16();
25
+ return this;
26
+ }
27
+ }
28
+ exports.UnconnectedPong = UnconnectedPong;
@@ -0,0 +1,5 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { Acknowledgement } from "./acknowledgement";
3
+ export declare class Ack extends Acknowledgement {
4
+ static ID: Packet;
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Ack = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const acknowledgement_1 = require("./acknowledgement");
6
+ class Ack extends acknowledgement_1.Acknowledgement {
7
+ static ID = packet_1.Packet.Ack;
8
+ }
9
+ exports.Ack = Ack;
@@ -0,0 +1,6 @@
1
+ import { DataPacket } from "../data-packet";
2
+ export declare class Acknowledgement extends DataPacket {
3
+ sequences: Array<number>;
4
+ serialize(): Buffer;
5
+ deserialize(): this;
6
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Acknowledgement = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const data_packet_1 = require("../data-packet");
6
+ class Acknowledgement extends data_packet_1.DataPacket {
7
+ sequences = [];
8
+ serialize() {
9
+ this.writeUint8(this.constructor.ID);
10
+ const stream = new binarystream_1.BinaryStream();
11
+ this.sequences.sort((a, b) => a - b);
12
+ const count = this.sequences.length;
13
+ let records = 0;
14
+ if (count > 0) {
15
+ let cursor = 1;
16
+ let start = this.sequences[0];
17
+ let last = this.sequences[0];
18
+ while (cursor < count) {
19
+ const current = this.sequences[cursor++];
20
+ const diff = current - last;
21
+ if (diff === 1) {
22
+ last = current;
23
+ }
24
+ else if (diff > 1) {
25
+ if (start === last) {
26
+ stream.writeBool(true);
27
+ stream.writeUint24(start, binarystream_1.Endianness.Little);
28
+ }
29
+ else {
30
+ stream.writeBool(false);
31
+ stream.writeUint24(start, binarystream_1.Endianness.Little);
32
+ stream.writeUint24(last, binarystream_1.Endianness.Little);
33
+ }
34
+ start = last = current;
35
+ ++records;
36
+ }
37
+ }
38
+ if (start === last) {
39
+ stream.writeBool(true);
40
+ stream.writeUint24(start, binarystream_1.Endianness.Little);
41
+ }
42
+ else {
43
+ stream.writeBool(false);
44
+ stream.writeUint24(start, binarystream_1.Endianness.Little);
45
+ stream.writeUint24(last, binarystream_1.Endianness.Little);
46
+ }
47
+ ++records;
48
+ }
49
+ this.writeUint16(records);
50
+ this.write(stream.getBuffer());
51
+ return this.getBuffer();
52
+ }
53
+ deserialize() {
54
+ this.sequences = [];
55
+ const recordCount = this.readUint16();
56
+ for (let i = 0; i < recordCount; i++) {
57
+ const single = this.readBool();
58
+ if (single) {
59
+ this.sequences.push(this.readUint24(binarystream_1.Endianness.Little));
60
+ }
61
+ else {
62
+ const start = this.readUint24(binarystream_1.Endianness.Little);
63
+ const end = this.readUint24(binarystream_1.Endianness.Little);
64
+ for (let j = start; j <= end; j++) {
65
+ this.sequences.push(j);
66
+ }
67
+ }
68
+ }
69
+ return this;
70
+ }
71
+ }
72
+ exports.Acknowledgement = Acknowledgement;
@@ -0,0 +1,8 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ export declare class ConnectedPing extends DataPacket {
4
+ static ID: Packet;
5
+ timestamp: bigint;
6
+ serialize(): Buffer;
7
+ deserialize(): this;
8
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectedPing = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ class ConnectedPing extends data_packet_1.DataPacket {
7
+ static ID = packet_1.Packet.ConnectedPing;
8
+ timestamp;
9
+ serialize() {
10
+ this.writeUint8(ConnectedPing.ID);
11
+ this.writeInt64(this.timestamp);
12
+ return this.getBuffer();
13
+ }
14
+ deserialize() {
15
+ this.timestamp = this.readInt64();
16
+ return this;
17
+ }
18
+ }
19
+ exports.ConnectedPing = ConnectedPing;
@@ -0,0 +1,9 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ export declare class ConnectedPong extends DataPacket {
4
+ static ID: Packet;
5
+ pingTimestamp: bigint;
6
+ pongTimestamp: bigint;
7
+ serialize(): Buffer;
8
+ deserialize(): this;
9
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectedPong = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ class ConnectedPong extends data_packet_1.DataPacket {
7
+ static ID = packet_1.Packet.ConnectedPong;
8
+ pingTimestamp;
9
+ pongTimestamp;
10
+ serialize() {
11
+ this.writeUint8(ConnectedPong.ID);
12
+ this.writeInt64(this.pingTimestamp);
13
+ this.writeInt64(this.pongTimestamp);
14
+ return this.getBuffer();
15
+ }
16
+ deserialize() {
17
+ this.pingTimestamp = this.readInt64();
18
+ this.pongTimestamp = this.readInt64();
19
+ return this;
20
+ }
21
+ }
22
+ exports.ConnectedPong = ConnectedPong;
@@ -0,0 +1,13 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ import { Address } from "../../types/address";
4
+ export declare class ConnectionRequestAccepted extends DataPacket {
5
+ static ID: Packet;
6
+ address: Address;
7
+ systemIndex: number;
8
+ addresses: Array<Address>;
9
+ requestTimestamp: bigint;
10
+ timestamp: bigint;
11
+ serialize(): Buffer;
12
+ deserialize(): this;
13
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionRequestAccepted = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ const address_1 = require("../../types/address");
7
+ class ConnectionRequestAccepted extends data_packet_1.DataPacket {
8
+ static ID = packet_1.Packet.ConnectionRequestAccepted;
9
+ address;
10
+ systemIndex;
11
+ addresses;
12
+ requestTimestamp;
13
+ timestamp;
14
+ serialize() {
15
+ this.writeUint8(ConnectionRequestAccepted.ID);
16
+ address_1.Address.write(this, this.address);
17
+ this.writeUint16(this.systemIndex);
18
+ for (let i = 0; i < this.addresses.length; i++) {
19
+ address_1.Address.write(this, this.addresses[i]);
20
+ }
21
+ this.writeInt64(this.requestTimestamp);
22
+ this.writeInt64(this.timestamp);
23
+ return this.getBuffer();
24
+ }
25
+ deserialize() {
26
+ this.address = address_1.Address.read(this);
27
+ this.systemIndex = this.readUint16();
28
+ this.addresses = [];
29
+ const remaining = this.buffer.byteLength - this.offset;
30
+ const timestampsSize = 16;
31
+ let addressBytes = remaining - timestampsSize;
32
+ const startOffset = this.offset;
33
+ while (this.offset - startOffset < addressBytes) {
34
+ this.addresses.push(address_1.Address.read(this));
35
+ }
36
+ this.requestTimestamp = this.readInt64();
37
+ this.timestamp = this.readInt64();
38
+ return this;
39
+ }
40
+ }
41
+ exports.ConnectionRequestAccepted = ConnectionRequestAccepted;
@@ -0,0 +1,10 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ export declare class ConnectionRequest extends DataPacket {
4
+ static ID: Packet;
5
+ guid: bigint;
6
+ timestamp: bigint;
7
+ useSecurity: boolean;
8
+ serialize(): Buffer;
9
+ deserialize(): this;
10
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionRequest = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ class ConnectionRequest extends data_packet_1.DataPacket {
7
+ static ID = packet_1.Packet.ConnectionRequest;
8
+ guid;
9
+ timestamp;
10
+ useSecurity;
11
+ serialize() {
12
+ this.writeUint8(ConnectionRequest.ID);
13
+ this.writeUint64(this.guid);
14
+ this.writeInt64(this.timestamp);
15
+ this.writeBool(this.useSecurity);
16
+ return this.getBuffer();
17
+ }
18
+ deserialize() {
19
+ this.guid = this.readUint64();
20
+ this.timestamp = this.readInt64();
21
+ this.useSecurity = this.readBool();
22
+ return this;
23
+ }
24
+ }
25
+ exports.ConnectionRequest = ConnectionRequest;
@@ -0,0 +1,7 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ export declare class Disconnect extends DataPacket {
4
+ static ID: Packet;
5
+ serialize(): Buffer;
6
+ deserialize(): this;
7
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Disconnect = void 0;
4
+ const packet_1 = require("../../enums/packet");
5
+ const data_packet_1 = require("../data-packet");
6
+ class Disconnect extends data_packet_1.DataPacket {
7
+ static ID = packet_1.Packet.DisconnectionNotification;
8
+ serialize() {
9
+ this.writeUint8(Disconnect.ID);
10
+ return this.getBuffer();
11
+ }
12
+ deserialize() {
13
+ return this;
14
+ }
15
+ }
16
+ exports.Disconnect = Disconnect;
@@ -0,0 +1,10 @@
1
+ import { Packet } from "../../enums/packet";
2
+ import { DataPacket } from "../data-packet";
3
+ import { Frame } from "../../types/frame";
4
+ export declare class FrameSet extends DataPacket {
5
+ static ID: Packet;
6
+ sequence: number;
7
+ frames: Array<Frame>;
8
+ serialize(): Buffer;
9
+ deserialize(): this;
10
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FrameSet = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const packet_1 = require("../../enums/packet");
6
+ const data_packet_1 = require("../data-packet");
7
+ const frame_1 = require("../../types/frame");
8
+ class FrameSet extends data_packet_1.DataPacket {
9
+ static ID = packet_1.Packet.FrameSetMin;
10
+ sequence;
11
+ frames = [];
12
+ serialize() {
13
+ this.writeUint8(FrameSet.ID);
14
+ this.writeUint24(this.sequence, binarystream_1.Endianness.Little);
15
+ frame_1.Frame.write(this, this.frames);
16
+ return this.getBuffer();
17
+ }
18
+ deserialize() {
19
+ this.sequence = this.readUint24(binarystream_1.Endianness.Little);
20
+ this.frames = frame_1.Frame.read(this);
21
+ return this;
22
+ }
23
+ }
24
+ exports.FrameSet = FrameSet;