@sanctumterra/raknet 1.3.80 → 1.4.0

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 (275) hide show
  1. package/README.md +1 -1
  2. package/dist/client/client.d.ts +19 -20
  3. package/dist/client/client.d.ts.map +1 -1
  4. package/dist/client/client.js +139 -184
  5. package/dist/client/types/client-events.d.ts +5 -20
  6. package/dist/client/types/client-events.d.ts.map +1 -1
  7. package/dist/client/types/client-options.d.ts +7 -8
  8. package/dist/client/types/client-options.d.ts.map +1 -1
  9. package/dist/client/types/client-options.js +9 -9
  10. package/dist/client/types/index.d.ts +1 -1
  11. package/dist/client/types/index.d.ts.map +1 -1
  12. package/dist/client/types/index.js +1 -1
  13. package/dist/index.d.ts +1 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -3
  16. package/dist/server/connection.d.ts +20 -59
  17. package/dist/server/connection.d.ts.map +1 -1
  18. package/dist/server/connection.js +53 -365
  19. package/dist/server/index.d.ts +2 -3
  20. package/dist/server/index.d.ts.map +1 -1
  21. package/dist/server/index.js +2 -3
  22. package/dist/server/server.d.ts +11 -18
  23. package/dist/server/server.d.ts.map +1 -1
  24. package/dist/server/server.js +98 -137
  25. package/dist/{proto → server}/types/advertisement.d.ts +1 -1
  26. package/dist/server/types/advertisement.d.ts.map +1 -0
  27. package/dist/{proto → server}/types/advertisement.js +14 -10
  28. package/dist/server/types/connection-events.d.ts +4 -0
  29. package/dist/server/types/connection-events.d.ts.map +1 -0
  30. package/dist/server/types/index.d.ts +5 -0
  31. package/dist/server/types/index.d.ts.map +1 -0
  32. package/dist/{proto → server}/types/index.js +3 -1
  33. package/dist/server/types/server-events.d.ts +7 -0
  34. package/dist/server/types/server-events.d.ts.map +1 -0
  35. package/dist/server/types/server-options.d.ts +12 -0
  36. package/dist/server/types/server-options.d.ts.map +1 -0
  37. package/dist/server/types/server-options.js +14 -0
  38. package/dist/shared/emitter.d.ts +28 -0
  39. package/dist/shared/emitter.d.ts.map +1 -0
  40. package/dist/shared/emitter.js +71 -0
  41. package/dist/shared/index.d.ts +5 -0
  42. package/dist/shared/index.d.ts.map +1 -0
  43. package/dist/{proto/decorators → shared}/index.js +4 -2
  44. package/dist/{utils/Logger.d.ts → shared/logger.d.ts} +1 -1
  45. package/dist/shared/logger.d.ts.map +1 -0
  46. package/dist/shared/network_session.d.ts +34 -0
  47. package/dist/shared/network_session.d.ts.map +1 -0
  48. package/dist/shared/network_session.js +247 -0
  49. package/dist/shared/proto/enums/connectionStatus.d.ts +8 -0
  50. package/dist/shared/proto/enums/connectionStatus.d.ts.map +1 -0
  51. package/dist/shared/proto/enums/connectionStatus.js +11 -0
  52. package/dist/shared/proto/enums/index.d.ts +5 -0
  53. package/dist/shared/proto/enums/index.d.ts.map +1 -0
  54. package/dist/{proto → shared/proto}/enums/index.js +2 -3
  55. package/dist/shared/proto/enums/packets.d.ts +19 -0
  56. package/dist/shared/proto/enums/packets.d.ts.map +1 -0
  57. package/dist/shared/proto/enums/packets.js +23 -0
  58. package/dist/shared/proto/enums/priority.d.ts +6 -0
  59. package/dist/shared/proto/enums/priority.d.ts.map +1 -0
  60. package/dist/shared/proto/enums/priority.js +4 -0
  61. package/dist/shared/proto/enums/reliability.d.ts.map +1 -0
  62. package/dist/shared/proto/index.d.ts +5 -0
  63. package/dist/shared/proto/index.d.ts.map +1 -0
  64. package/dist/{proto → shared/proto}/index.js +3 -3
  65. package/dist/shared/proto/offline/index.d.ts +7 -0
  66. package/dist/shared/proto/offline/index.d.ts.map +1 -0
  67. package/dist/shared/proto/offline/index.js +22 -0
  68. package/dist/shared/proto/offline/open-connection-reply-one.d.ts +9 -0
  69. package/dist/shared/proto/offline/open-connection-reply-one.d.ts.map +1 -0
  70. package/dist/shared/proto/offline/open-connection-reply-one.js +28 -0
  71. package/dist/shared/proto/offline/open-connection-reply-two.d.ts +11 -0
  72. package/dist/shared/proto/offline/open-connection-reply-two.d.ts.map +1 -0
  73. package/dist/shared/proto/offline/open-connection-reply-two.js +31 -0
  74. package/dist/shared/proto/offline/open-connection-request-one.d.ts +8 -0
  75. package/dist/shared/proto/offline/open-connection-request-one.d.ts.map +1 -0
  76. package/dist/shared/proto/offline/open-connection-request-one.js +25 -0
  77. package/dist/shared/proto/offline/open-connection-request-two.d.ts +10 -0
  78. package/dist/shared/proto/offline/open-connection-request-two.d.ts.map +1 -0
  79. package/dist/shared/proto/offline/open-connection-request-two.js +28 -0
  80. package/dist/shared/proto/offline/unconnected-ping.d.ts +8 -0
  81. package/dist/shared/proto/offline/unconnected-ping.d.ts.map +1 -0
  82. package/dist/shared/proto/offline/unconnected-ping.js +25 -0
  83. package/dist/shared/proto/offline/unconnected-pong.d.ts +9 -0
  84. package/dist/shared/proto/offline/unconnected-pong.d.ts.map +1 -0
  85. package/dist/shared/proto/offline/unconnected-pong.js +28 -0
  86. package/dist/shared/proto/online/ack.d.ts +7 -0
  87. package/dist/shared/proto/online/ack.d.ts.map +1 -0
  88. package/dist/{proto/packets → shared/proto/online}/ack.js +16 -31
  89. package/dist/shared/proto/online/connected-ping.d.ts +7 -0
  90. package/dist/shared/proto/online/connected-ping.d.ts.map +1 -0
  91. package/dist/shared/proto/online/connected-ping.js +19 -0
  92. package/dist/shared/proto/online/connected-pong.d.ts +8 -0
  93. package/dist/shared/proto/online/connected-pong.d.ts.map +1 -0
  94. package/dist/shared/proto/online/connected-pong.js +22 -0
  95. package/dist/shared/proto/online/connection-request-accepted.d.ts +12 -0
  96. package/dist/shared/proto/online/connection-request-accepted.d.ts.map +1 -0
  97. package/dist/shared/proto/online/connection-request-accepted.js +37 -0
  98. package/dist/shared/proto/online/connection-request.d.ts +9 -0
  99. package/dist/shared/proto/online/connection-request.d.ts.map +1 -0
  100. package/dist/shared/proto/online/connection-request.js +25 -0
  101. package/dist/shared/proto/online/disconnect-message.d.ts +6 -0
  102. package/dist/shared/proto/online/disconnect-message.d.ts.map +1 -0
  103. package/dist/shared/proto/online/disconnect-message.js +15 -0
  104. package/dist/shared/proto/online/frame-set.d.ts +9 -0
  105. package/dist/shared/proto/online/frame-set.d.ts.map +1 -0
  106. package/dist/shared/proto/online/frame-set.js +23 -0
  107. package/dist/shared/proto/online/index.d.ts +9 -0
  108. package/dist/shared/proto/online/index.d.ts.map +1 -0
  109. package/dist/shared/proto/online/index.js +24 -0
  110. package/dist/shared/proto/online/new-incomming-connection.d.ts +11 -0
  111. package/dist/shared/proto/online/new-incomming-connection.d.ts.map +1 -0
  112. package/dist/shared/proto/online/new-incomming-connection.js +33 -0
  113. package/dist/shared/proto/types/address.d.ts +12 -0
  114. package/dist/shared/proto/types/address.d.ts.map +1 -0
  115. package/dist/shared/proto/types/address.js +61 -0
  116. package/dist/shared/proto/types/frame.d.ts +23 -0
  117. package/dist/shared/proto/types/frame.d.ts.map +1 -0
  118. package/dist/shared/proto/types/frame.js +119 -0
  119. package/dist/{proto/packets → shared/proto}/types/index.d.ts +0 -2
  120. package/dist/shared/proto/types/index.d.ts.map +1 -0
  121. package/dist/{proto/packets → shared/proto}/types/index.js +0 -2
  122. package/dist/shared/proto/types/magic.d.ts +7 -0
  123. package/dist/shared/proto/types/magic.d.ts.map +1 -0
  124. package/dist/shared/proto/types/magic.js +15 -0
  125. package/dist/shared/proto/types/mtu.d.ts +7 -0
  126. package/dist/shared/proto/types/mtu.d.ts.map +1 -0
  127. package/dist/shared/proto/types/mtu.js +13 -0
  128. package/dist/tests/client-connect.d.ts +2 -0
  129. package/dist/tests/client-connect.d.ts.map +1 -0
  130. package/dist/tests/client-connect.js +32 -0
  131. package/dist/tests/client-once.d.ts +2 -0
  132. package/dist/tests/client-once.d.ts.map +1 -0
  133. package/dist/tests/client-once.js +11 -0
  134. package/dist/tests/server-listen.d.ts +2 -0
  135. package/dist/tests/server-listen.d.ts.map +1 -0
  136. package/dist/tests/server-listen.js +5 -0
  137. package/package.json +6 -6
  138. package/bun.lock +0 -67
  139. package/dist/client/framer.d.ts +0 -55
  140. package/dist/client/framer.d.ts.map +0 -1
  141. package/dist/client/framer.js +0 -458
  142. package/dist/proto/decorators/create.d.ts +0 -8
  143. package/dist/proto/decorators/create.d.ts.map +0 -1
  144. package/dist/proto/decorators/create.js +0 -77
  145. package/dist/proto/decorators/index.d.ts +0 -3
  146. package/dist/proto/decorators/index.d.ts.map +0 -1
  147. package/dist/proto/decorators/serialize.d.ts +0 -4
  148. package/dist/proto/decorators/serialize.d.ts.map +0 -1
  149. package/dist/proto/decorators/serialize.js +0 -12
  150. package/dist/proto/enums/flags.d.ts +0 -7
  151. package/dist/proto/enums/flags.d.ts.map +0 -1
  152. package/dist/proto/enums/flags.js +0 -10
  153. package/dist/proto/enums/index.d.ts +0 -6
  154. package/dist/proto/enums/index.d.ts.map +0 -1
  155. package/dist/proto/enums/packet.d.ts +0 -122
  156. package/dist/proto/enums/packet.d.ts.map +0 -1
  157. package/dist/proto/enums/packet.js +0 -125
  158. package/dist/proto/enums/priority.d.ts +0 -5
  159. package/dist/proto/enums/priority.d.ts.map +0 -1
  160. package/dist/proto/enums/priority.js +0 -8
  161. package/dist/proto/enums/reliability.d.ts.map +0 -1
  162. package/dist/proto/enums/status.d.ts +0 -7
  163. package/dist/proto/enums/status.d.ts.map +0 -1
  164. package/dist/proto/enums/status.js +0 -10
  165. package/dist/proto/index.d.ts +0 -5
  166. package/dist/proto/index.d.ts.map +0 -1
  167. package/dist/proto/packets/ack.d.ts +0 -10
  168. package/dist/proto/packets/ack.d.ts.map +0 -1
  169. package/dist/proto/packets/base-packet.d.ts +0 -26
  170. package/dist/proto/packets/base-packet.d.ts.map +0 -1
  171. package/dist/proto/packets/base-packet.js +0 -37
  172. package/dist/proto/packets/connected-ping.d.ts +0 -5
  173. package/dist/proto/packets/connected-ping.d.ts.map +0 -1
  174. package/dist/proto/packets/connected-ping.js +0 -27
  175. package/dist/proto/packets/connected-pong.d.ts +0 -6
  176. package/dist/proto/packets/connected-pong.d.ts.map +0 -1
  177. package/dist/proto/packets/connected-pong.js +0 -32
  178. package/dist/proto/packets/connection-request-accepted.d.ts +0 -10
  179. package/dist/proto/packets/connection-request-accepted.d.ts.map +0 -1
  180. package/dist/proto/packets/connection-request-accepted.js +0 -48
  181. package/dist/proto/packets/connection-request.d.ts +0 -7
  182. package/dist/proto/packets/connection-request.d.ts.map +0 -1
  183. package/dist/proto/packets/connection-request.js +0 -37
  184. package/dist/proto/packets/disconnect.d.ts +0 -5
  185. package/dist/proto/packets/disconnect.d.ts.map +0 -1
  186. package/dist/proto/packets/disconnect.js +0 -17
  187. package/dist/proto/packets/frame.d.ts +0 -1
  188. package/dist/proto/packets/frame.d.ts.map +0 -1
  189. package/dist/proto/packets/frame.js +0 -1
  190. package/dist/proto/packets/frameset.d.ts +0 -11
  191. package/dist/proto/packets/frameset.d.ts.map +0 -1
  192. package/dist/proto/packets/frameset.js +0 -37
  193. package/dist/proto/packets/incompatible-protocol-version.d.ts +0 -8
  194. package/dist/proto/packets/incompatible-protocol-version.d.ts.map +0 -1
  195. package/dist/proto/packets/incompatible-protocol-version.js +0 -38
  196. package/dist/proto/packets/index.d.ts +0 -19
  197. package/dist/proto/packets/index.d.ts.map +0 -1
  198. package/dist/proto/packets/index.js +0 -34
  199. package/dist/proto/packets/nack.d.ts +0 -8
  200. package/dist/proto/packets/nack.d.ts.map +0 -1
  201. package/dist/proto/packets/nack.js +0 -88
  202. package/dist/proto/packets/new-incoming-connection.d.ts +0 -9
  203. package/dist/proto/packets/new-incoming-connection.d.ts.map +0 -1
  204. package/dist/proto/packets/new-incoming-connection.js +0 -43
  205. package/dist/proto/packets/open-connection-reply-one.d.ts +0 -8
  206. package/dist/proto/packets/open-connection-reply-one.d.ts.map +0 -1
  207. package/dist/proto/packets/open-connection-reply-one.js +0 -43
  208. package/dist/proto/packets/open-connection-reply-two.d.ts +0 -10
  209. package/dist/proto/packets/open-connection-reply-two.d.ts.map +0 -1
  210. package/dist/proto/packets/open-connection-reply-two.js +0 -48
  211. package/dist/proto/packets/open-connection-request-one.d.ts +0 -7
  212. package/dist/proto/packets/open-connection-request-one.d.ts.map +0 -1
  213. package/dist/proto/packets/open-connection-request-one.js +0 -38
  214. package/dist/proto/packets/open-connection-request-two.d.ts +0 -9
  215. package/dist/proto/packets/open-connection-request-two.d.ts.map +0 -1
  216. package/dist/proto/packets/open-connection-request-two.js +0 -43
  217. package/dist/proto/packets/types/address.d.ts +0 -48
  218. package/dist/proto/packets/types/address.d.ts.map +0 -1
  219. package/dist/proto/packets/types/address.js +0 -99
  220. package/dist/proto/packets/types/data-type.d.ts +0 -21
  221. package/dist/proto/packets/types/data-type.d.ts.map +0 -1
  222. package/dist/proto/packets/types/data-type.js +0 -29
  223. package/dist/proto/packets/types/frame.d.ts +0 -23
  224. package/dist/proto/packets/types/frame.d.ts.map +0 -1
  225. package/dist/proto/packets/types/frame.js +0 -94
  226. package/dist/proto/packets/types/index.d.ts.map +0 -1
  227. package/dist/proto/packets/types/magic.d.ts +0 -7
  228. package/dist/proto/packets/types/magic.d.ts.map +0 -1
  229. package/dist/proto/packets/types/magic.js +0 -14
  230. package/dist/proto/packets/types/mtu.d.ts +0 -9
  231. package/dist/proto/packets/types/mtu.d.ts.map +0 -1
  232. package/dist/proto/packets/types/mtu.js +0 -18
  233. package/dist/proto/packets/types/sys-address.d.ts +0 -11
  234. package/dist/proto/packets/types/sys-address.d.ts.map +0 -1
  235. package/dist/proto/packets/types/sys-address.js +0 -32
  236. package/dist/proto/packets/unconnected-ping.d.ts +0 -7
  237. package/dist/proto/packets/unconnected-ping.d.ts.map +0 -1
  238. package/dist/proto/packets/unconnected-ping.js +0 -38
  239. package/dist/proto/packets/unconnected-pong.d.ts +0 -8
  240. package/dist/proto/packets/unconnected-pong.d.ts.map +0 -1
  241. package/dist/proto/packets/unconnected-pong.js +0 -43
  242. package/dist/proto/types/advertisement.d.ts.map +0 -1
  243. package/dist/proto/types/index.d.ts +0 -3
  244. package/dist/proto/types/index.d.ts.map +0 -1
  245. package/dist/proto/types/valid.d.ts +0 -4
  246. package/dist/proto/types/valid.d.ts.map +0 -1
  247. package/dist/server/server-events.d.ts +0 -9
  248. package/dist/server/server-events.d.ts.map +0 -1
  249. package/dist/server/server-options.d.ts +0 -26
  250. package/dist/server/server-options.d.ts.map +0 -1
  251. package/dist/server/server-options.js +0 -20
  252. package/dist/tests/client.d.ts +0 -2
  253. package/dist/tests/client.d.ts.map +0 -1
  254. package/dist/tests/client.js +0 -15
  255. package/dist/tests/localhost.d.ts +0 -2
  256. package/dist/tests/localhost.d.ts.map +0 -1
  257. package/dist/tests/localhost.js +0 -34
  258. package/dist/tests/server.d.ts +0 -2
  259. package/dist/tests/server.d.ts.map +0 -1
  260. package/dist/tests/server.js +0 -32
  261. package/dist/tests/test.d.ts +0 -2
  262. package/dist/tests/test.d.ts.map +0 -1
  263. package/dist/tests/test.js +0 -49
  264. package/dist/utils/Logger.d.ts.map +0 -1
  265. package/dist/utils/decorators.d.ts +0 -2
  266. package/dist/utils/decorators.d.ts.map +0 -1
  267. package/dist/utils/decorators.js +0 -17
  268. package/dist/utils/index.d.ts +0 -3
  269. package/dist/utils/index.d.ts.map +0 -1
  270. package/dist/utils/index.js +0 -18
  271. /package/dist/{proto/types/valid.js → server/types/connection-events.js} +0 -0
  272. /package/dist/server/{server-events.js → types/server-events.js} +0 -0
  273. /package/dist/{utils/Logger.js → shared/logger.js} +0 -0
  274. /package/dist/{proto → shared/proto}/enums/reliability.d.ts +0 -0
  275. /package/dist/{proto → shared/proto}/enums/reliability.js +0 -0
@@ -0,0 +1,9 @@
1
+ import { BinaryStream } from "@serenityjs/binarystream";
2
+ export declare class UnconnectedPong extends BinaryStream {
3
+ timestamp: bigint;
4
+ guid: bigint;
5
+ message: string;
6
+ serialize(): Buffer;
7
+ deserialize(): UnconnectedPong;
8
+ }
9
+ //# sourceMappingURL=unconnected-pong.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unconnected-pong.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/offline/unconnected-pong.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAIhF,qBAAa,eAAgB,SAAQ,YAAY;IACzC,SAAS,EAAG,MAAM,CAAC;IACnB,IAAI,EAAG,MAAM,CAAC;IACd,OAAO,EAAG,MAAM,CAAC;IAEjB,SAAS,IAAI,MAAM;IASnB,WAAW,IAAI,eAAe;CAQrC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnconnectedPong = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const types_1 = require("../types");
6
+ const enums_1 = require("../enums");
7
+ class UnconnectedPong extends binarystream_1.BinaryStream {
8
+ timestamp; // Int64
9
+ guid; // Int64
10
+ message; // String16
11
+ serialize() {
12
+ binarystream_1.Uint8.write(this, enums_1.Packets.UnconnectedPong);
13
+ binarystream_1.Int64.write(this, this.timestamp);
14
+ binarystream_1.Int64.write(this, this.guid);
15
+ types_1.Magic.write(this);
16
+ binarystream_1.String16.write(this, this.message);
17
+ return this.getBuffer();
18
+ }
19
+ deserialize() {
20
+ binarystream_1.Uint8.read(this);
21
+ this.timestamp = binarystream_1.Int64.read(this);
22
+ this.guid = binarystream_1.Int64.read(this);
23
+ types_1.Magic.read(this);
24
+ this.message = binarystream_1.String16.read(this);
25
+ return this;
26
+ }
27
+ }
28
+ exports.UnconnectedPong = UnconnectedPong;
@@ -0,0 +1,7 @@
1
+ import { BinaryStream } from "@serenityjs/binarystream";
2
+ export declare class Ack extends BinaryStream {
3
+ sequences: Array<number>;
4
+ serialize(): Buffer;
5
+ deserialize(): Ack;
6
+ }
7
+ //# sourceMappingURL=ack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ack.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/online/ack.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EAIZ,MAAM,0BAA0B,CAAC;AAGlC,qBAAa,GAAI,SAAQ,YAAY;IAC7B,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAE9B,SAAS,IAAI,MAAM;IA+CnB,WAAW,IAAI,GAAG;CAkBzB"}
@@ -1,24 +1,12 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var Ack_1;
9
2
  Object.defineProperty(exports, "__esModule", { value: true });
10
3
  exports.Ack = void 0;
11
4
  const binarystream_1 = require("@serenityjs/binarystream");
12
- const decorators_1 = require("../decorators");
13
5
  const enums_1 = require("../enums");
14
- const base_packet_1 = require("./base-packet");
15
- /**
16
- * Thanks SerenityJS
17
- */
18
- let Ack = Ack_1 = class Ack extends base_packet_1.BasePacket {
6
+ class Ack extends binarystream_1.BinaryStream {
19
7
  sequences = [];
20
8
  serialize() {
21
- this.writeUint8(Ack_1.id);
9
+ binarystream_1.Uint8.write(this, enums_1.Packets.Ack);
22
10
  const stream = new binarystream_1.BinaryStream();
23
11
  this.sequences.sort((a, b) => a - b);
24
12
  const count = this.sequences.length;
@@ -36,13 +24,13 @@ let Ack = Ack_1 = class Ack extends base_packet_1.BasePacket {
36
24
  else if (diff > 1) {
37
25
  if (start === last) {
38
26
  stream.writeBool(true); // single?
39
- stream.writeUint24(start, 1 /* Endianness.Little */);
27
+ stream.writeUint24(start, binarystream_1.Endianness.Little);
40
28
  start = last = current;
41
29
  }
42
30
  else {
43
31
  stream.writeBool(false); // single?
44
- stream.writeUint24(start, 1 /* Endianness.Little */);
45
- stream.writeUint24(last, 1 /* Endianness.Little */);
32
+ stream.writeUint24(start, binarystream_1.Endianness.Little);
33
+ stream.writeUint24(last, binarystream_1.Endianness.Little);
46
34
  start = last = current;
47
35
  }
48
36
  ++records;
@@ -51,31 +39,31 @@ let Ack = Ack_1 = class Ack extends base_packet_1.BasePacket {
51
39
  // last iteration
52
40
  if (start === last) {
53
41
  stream.writeBool(true); // single?
54
- stream.writeUint24(start, 1 /* Endianness.Little */);
42
+ stream.writeUint24(start, binarystream_1.Endianness.Little);
55
43
  }
56
44
  else {
57
45
  stream.writeBool(false); // single?
58
- stream.writeUint24(start, 1 /* Endianness.Little */);
59
- stream.writeUint24(last, 1 /* Endianness.Little */);
46
+ stream.writeUint24(start, binarystream_1.Endianness.Little);
47
+ stream.writeUint24(last, binarystream_1.Endianness.Little);
60
48
  }
61
49
  ++records;
62
50
  }
63
- this.writeUShort(records);
64
- this.writeBuffer(stream.getBuffer());
51
+ this.writeUint16(records);
52
+ this.write(stream.getBuffer());
65
53
  return this.getBuffer();
66
54
  }
67
55
  deserialize() {
68
- this.readUint8();
56
+ binarystream_1.Uint8.read(this);
69
57
  this.sequences = [];
70
- const recordCount = this.readUShort();
58
+ const recordCount = this.readUint16();
71
59
  for (let index = 0; index < recordCount; index++) {
72
60
  const range = this.readBool(); // False for range, True for no range
73
61
  if (range) {
74
- this.sequences.push(this.readUint24(1 /* Endianness.Little */));
62
+ this.sequences.push(this.readUint24(binarystream_1.Endianness.Little));
75
63
  }
76
64
  else {
77
- const start = this.readUint24(1 /* Endianness.Little */);
78
- const end = this.readUint24(1 /* Endianness.Little */);
65
+ const start = this.readUint24(binarystream_1.Endianness.Little);
66
+ const end = this.readUint24(binarystream_1.Endianness.Little);
79
67
  for (let index = start; index <= end; index++) {
80
68
  this.sequences.push(index);
81
69
  }
@@ -83,8 +71,5 @@ let Ack = Ack_1 = class Ack extends base_packet_1.BasePacket {
83
71
  }
84
72
  return this;
85
73
  }
86
- };
74
+ }
87
75
  exports.Ack = Ack;
88
- exports.Ack = Ack = Ack_1 = __decorate([
89
- (0, decorators_1.Create)(enums_1.Packet.Ack)
90
- ], Ack);
@@ -0,0 +1,7 @@
1
+ import { BinaryStream } from "@serenityjs/binarystream";
2
+ export declare class ConnectedPing extends BinaryStream {
3
+ timestamp: bigint;
4
+ serialize(): Buffer;
5
+ deserialize(): ConnectedPing;
6
+ }
7
+ //# sourceMappingURL=connected-ping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connected-ping.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/online/connected-ping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,0BAA0B,CAAC;AAGtE,qBAAa,aAAc,SAAQ,YAAY;IACvC,SAAS,EAAG,MAAM,CAAC;IAEnB,SAAS,IAAI,MAAM;IAMnB,WAAW,IAAI,aAAa;CAKnC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectedPing = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const enums_1 = require("../enums");
6
+ class ConnectedPing extends binarystream_1.BinaryStream {
7
+ timestamp; // Int64
8
+ serialize() {
9
+ binarystream_1.Uint8.write(this, enums_1.Packets.ConnectedPong);
10
+ binarystream_1.Int64.write(this, this.timestamp);
11
+ return this.getBuffer();
12
+ }
13
+ deserialize() {
14
+ binarystream_1.Uint8.read(this);
15
+ this.timestamp = binarystream_1.Int64.read(this);
16
+ return this;
17
+ }
18
+ }
19
+ exports.ConnectedPing = ConnectedPing;
@@ -0,0 +1,8 @@
1
+ import { BinaryStream } from "@serenityjs/binarystream";
2
+ export declare class ConnectedPong extends BinaryStream {
3
+ pingTimestamp: bigint;
4
+ pongTimestamp: bigint;
5
+ serialize(): Buffer;
6
+ deserialize(): ConnectedPong;
7
+ }
8
+ //# sourceMappingURL=connected-pong.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connected-pong.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/online/connected-pong.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,0BAA0B,CAAC;AAGtE,qBAAa,aAAc,SAAQ,YAAY;IACvC,aAAa,EAAG,MAAM,CAAC;IACvB,aAAa,EAAG,MAAM,CAAC;IAEvB,SAAS,IAAI,MAAM;IAOnB,WAAW,IAAI,aAAa;CAMnC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectedPong = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const enums_1 = require("../enums");
6
+ class ConnectedPong extends binarystream_1.BinaryStream {
7
+ pingTimestamp; // Int64
8
+ pongTimestamp; // Int64
9
+ serialize() {
10
+ binarystream_1.Uint8.write(this, enums_1.Packets.ConnectedPing);
11
+ binarystream_1.Int64.write(this, this.pingTimestamp);
12
+ binarystream_1.Int64.write(this, this.pongTimestamp);
13
+ return this.getBuffer();
14
+ }
15
+ deserialize() {
16
+ binarystream_1.Uint8.read(this);
17
+ this.pingTimestamp = binarystream_1.Int64.read(this);
18
+ this.pongTimestamp = binarystream_1.Int64.read(this);
19
+ return this;
20
+ }
21
+ }
22
+ exports.ConnectedPong = ConnectedPong;
@@ -0,0 +1,12 @@
1
+ import { BinaryStream } from "@serenityjs/binarystream";
2
+ import { Address } from "../types";
3
+ export declare class ConnectionRequestAccepted extends BinaryStream {
4
+ address: Address;
5
+ systemIndex: number;
6
+ addresses: Array<Address>;
7
+ requestTimestamp: bigint;
8
+ timestamp: bigint;
9
+ serialize(): Buffer;
10
+ deserialize(): ConnectionRequestAccepted;
11
+ }
12
+ //# sourceMappingURL=connection-request-accepted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-request-accepted.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/online/connection-request-accepted.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EAKZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,qBAAa,yBAA0B,SAAQ,YAAY;IACnD,OAAO,EAAG,OAAO,CAAC;IAClB,WAAW,EAAG,MAAM,CAAC;IACrB,SAAS,EAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,gBAAgB,EAAG,MAAM,CAAC;IAC1B,SAAS,EAAG,MAAM,CAAC;IAEnB,SAAS,IAAI,MAAM;IAYnB,WAAW,IAAI,yBAAyB;CAe/C"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionRequestAccepted = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const enums_1 = require("../enums");
6
+ const types_1 = require("../types");
7
+ class ConnectionRequestAccepted extends binarystream_1.BinaryStream {
8
+ address; // Address
9
+ systemIndex; // Int16
10
+ addresses; // Array<Address>
11
+ requestTimestamp; // Int64
12
+ timestamp; // Int64
13
+ serialize() {
14
+ binarystream_1.Uint8.write(this, enums_1.Packets.ConnectionRequestAccepted);
15
+ types_1.Address.write(this, this.address);
16
+ binarystream_1.Uint16.write(this, this.systemIndex);
17
+ for (let i = 0; i < this.addresses.length; i++) {
18
+ types_1.Address.write(this, this.addresses[i]);
19
+ }
20
+ binarystream_1.Int64.write(this, this.requestTimestamp);
21
+ binarystream_1.Int64.write(this, this.timestamp);
22
+ return this.getBuffer();
23
+ }
24
+ deserialize() {
25
+ binarystream_1.Uint8.read(this);
26
+ this.address = types_1.Address.read(this);
27
+ this.systemIndex = binarystream_1.Uint16.read(this);
28
+ this.addresses = [];
29
+ for (let i = 0; i < 20; i++) {
30
+ this.addresses.push(types_1.Address.read(this));
31
+ }
32
+ this.requestTimestamp = binarystream_1.Int64.read(this);
33
+ this.timestamp = binarystream_1.Int64.read(this);
34
+ return this;
35
+ }
36
+ }
37
+ exports.ConnectionRequestAccepted = ConnectionRequestAccepted;
@@ -0,0 +1,9 @@
1
+ import { BinaryStream } from "@serenityjs/binarystream";
2
+ export declare class ConnectionRequest extends BinaryStream {
3
+ guid: bigint;
4
+ timestamp: bigint;
5
+ useSecurity: boolean;
6
+ serialize(): Buffer;
7
+ deserialize(): ConnectionRequest;
8
+ }
9
+ //# sourceMappingURL=connection-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-request.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/online/connection-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAsB,MAAM,0BAA0B,CAAC;AAG5E,qBAAa,iBAAkB,SAAQ,YAAY;IAC3C,IAAI,EAAG,MAAM,CAAC;IACd,SAAS,EAAG,MAAM,CAAC;IACnB,WAAW,EAAG,OAAO,CAAC;IAEtB,SAAS,IAAI,MAAM;IAQnB,WAAW,IAAI,iBAAiB;CAOvC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionRequest = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const enums_1 = require("../enums");
6
+ class ConnectionRequest extends binarystream_1.BinaryStream {
7
+ guid; // Int64
8
+ timestamp; // Int64
9
+ useSecurity; // Bool
10
+ serialize() {
11
+ binarystream_1.Uint8.write(this, enums_1.Packets.ConnectionRequest);
12
+ binarystream_1.Int64.write(this, this.guid);
13
+ binarystream_1.Int64.write(this, this.timestamp);
14
+ binarystream_1.Bool.write(this, this.useSecurity);
15
+ return this.getBuffer();
16
+ }
17
+ deserialize() {
18
+ binarystream_1.Uint8.read(this);
19
+ this.timestamp = binarystream_1.Int64.read(this);
20
+ this.guid = binarystream_1.Int64.read(this);
21
+ this.useSecurity = binarystream_1.Bool.read(this);
22
+ return this;
23
+ }
24
+ }
25
+ exports.ConnectionRequest = ConnectionRequest;
@@ -0,0 +1,6 @@
1
+ import { BinaryStream } from "@serenityjs/binarystream";
2
+ export declare class DisconnectMessage extends BinaryStream {
3
+ serialize(): Buffer;
4
+ deserialize(buffer: Buffer): DisconnectMessage;
5
+ }
6
+ //# sourceMappingURL=disconnect-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disconnect-message.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/online/disconnect-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,qBAAa,iBAAkB,SAAQ,YAAY;IAC3C,SAAS,IAAI,MAAM;IAKnB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB;CAGrD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DisconnectMessage = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const enums_1 = require("../enums");
6
+ class DisconnectMessage extends binarystream_1.BinaryStream {
7
+ serialize() {
8
+ this.writeUint8(enums_1.Packets.Disconnect);
9
+ return this.getBuffer();
10
+ }
11
+ deserialize(buffer) {
12
+ return this;
13
+ }
14
+ }
15
+ exports.DisconnectMessage = DisconnectMessage;
@@ -0,0 +1,9 @@
1
+ import { BinaryStream } from "@serenityjs/binarystream";
2
+ import { Frame } from "../types";
3
+ export declare class FrameSet extends BinaryStream {
4
+ sequence: number;
5
+ frames: Array<Frame>;
6
+ serialize(): Buffer;
7
+ deserialize(): FrameSet;
8
+ }
9
+ //# sourceMappingURL=frame-set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-set.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/online/frame-set.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EAIZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,qBAAa,QAAS,SAAQ,YAAY;IAClC,QAAQ,EAAG,MAAM,CAAC;IAClB,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAM;IAE1B,SAAS,IAAI,MAAM;IAOnB,WAAW,IAAI,QAAQ;CAM9B"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FrameSet = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const types_1 = require("../types");
6
+ const enums_1 = require("../enums");
7
+ class FrameSet extends binarystream_1.BinaryStream {
8
+ sequence;
9
+ frames = [];
10
+ serialize() {
11
+ binarystream_1.Uint8.write(this, enums_1.Packets.FrameSet);
12
+ binarystream_1.Uint24.write(this, this.sequence, { endian: binarystream_1.Endianness.Little });
13
+ types_1.Frame.write(this, this.frames);
14
+ return this.getBuffer();
15
+ }
16
+ deserialize() {
17
+ binarystream_1.Uint8.read(this);
18
+ this.sequence = binarystream_1.Uint24.read(this, { endian: binarystream_1.Endianness.Little });
19
+ this.frames = types_1.Frame.read(this);
20
+ return this;
21
+ }
22
+ }
23
+ exports.FrameSet = FrameSet;
@@ -0,0 +1,9 @@
1
+ export * from "./ack";
2
+ export * from "./frame-set";
3
+ export * from "./connection-request";
4
+ export * from "./connection-request-accepted";
5
+ export * from "./new-incomming-connection";
6
+ export * from "./connected-ping";
7
+ export * from "./connected-pong";
8
+ export * from "./disconnect-message";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/online/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,24 @@
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("./ack"), exports);
18
+ __exportStar(require("./frame-set"), exports);
19
+ __exportStar(require("./connection-request"), exports);
20
+ __exportStar(require("./connection-request-accepted"), exports);
21
+ __exportStar(require("./new-incomming-connection"), exports);
22
+ __exportStar(require("./connected-ping"), exports);
23
+ __exportStar(require("./connected-pong"), exports);
24
+ __exportStar(require("./disconnect-message"), exports);
@@ -0,0 +1,11 @@
1
+ import { BinaryStream } from "@serenityjs/binarystream";
2
+ import { Address } from "../types";
3
+ export declare class NewIncomingConnection extends BinaryStream {
4
+ address: Address;
5
+ internalAddress: Address;
6
+ incomingTimestamp: bigint;
7
+ serverTimestamp: bigint;
8
+ serialize(): Buffer;
9
+ deserialize(): NewIncomingConnection;
10
+ }
11
+ //# sourceMappingURL=new-incomming-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-incomming-connection.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/online/new-incomming-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,0BAA0B,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,qBAAa,qBAAsB,SAAQ,YAAY;IAC/C,OAAO,EAAG,OAAO,CAAC;IAClB,eAAe,EAAG,OAAO,CAAC;IAC1B,iBAAiB,EAAG,MAAM,CAAC;IAC3B,eAAe,EAAG,MAAM,CAAC;IAEzB,SAAS,IAAI,MAAM;IAWnB,WAAW,IAAI,qBAAqB;CAU3C"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NewIncomingConnection = void 0;
4
+ const binarystream_1 = require("@serenityjs/binarystream");
5
+ const enums_1 = require("../enums");
6
+ const types_1 = require("../types");
7
+ class NewIncomingConnection extends binarystream_1.BinaryStream {
8
+ address; // Address
9
+ internalAddress; // Internal Address
10
+ incomingTimestamp; // Int64
11
+ serverTimestamp; // Int64
12
+ serialize() {
13
+ binarystream_1.Uint8.write(this, enums_1.Packets.NewIncomingConnection);
14
+ types_1.Address.write(this, this.address);
15
+ for (let i = 0; i < 10; i++) {
16
+ types_1.Address.write(this, this.internalAddress);
17
+ }
18
+ binarystream_1.Int64.write(this, this.incomingTimestamp);
19
+ binarystream_1.Int64.write(this, this.serverTimestamp);
20
+ return this.getBuffer();
21
+ }
22
+ deserialize() {
23
+ binarystream_1.Uint8.read(this);
24
+ this.address = types_1.Address.read(this);
25
+ for (let i = 0; i < 10; i++) {
26
+ this.internalAddress = types_1.Address.read(this);
27
+ }
28
+ this.incomingTimestamp = binarystream_1.Int64.read(this);
29
+ this.serverTimestamp = binarystream_1.Int64.read(this);
30
+ return this;
31
+ }
32
+ }
33
+ exports.NewIncomingConnection = NewIncomingConnection;
@@ -0,0 +1,12 @@
1
+ import type { RemoteInfo } from "node:dgram";
2
+ import type { BinaryStream } from "@serenityjs/binarystream";
3
+ export declare class Address {
4
+ address: string;
5
+ port: number;
6
+ version: number;
7
+ constructor(address: string, port: number, version: number);
8
+ static fromIdentifier(identifier: RemoteInfo): Address;
9
+ static write(stream: BinaryStream, address: Address): void;
10
+ static read(stream: BinaryStream): Address;
11
+ }
12
+ //# sourceMappingURL=address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/types/address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,qBAAa,OAAO;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;gBAEJ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;WAMnD,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAQ7D,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;WAqB5C,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO;CAuBjD"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Address = void 0;
4
+ class Address {
5
+ address;
6
+ port;
7
+ version;
8
+ constructor(address, port, version) {
9
+ this.address = address;
10
+ this.port = port;
11
+ this.version = version;
12
+ }
13
+ static fromIdentifier(identifier) {
14
+ return new Address(identifier.address, identifier.port, identifier.family === "IPv4" ? 4 : 6);
15
+ }
16
+ static write(stream, address) {
17
+ stream.writeUint8(address.version);
18
+ if (address.version === 4) {
19
+ const addressBits = address.address.split(".", 4);
20
+ for (const bit of addressBits) {
21
+ stream.writeUint8(Number.parseInt(bit, 10) ^ 0xff);
22
+ }
23
+ stream.writeUint16(address.port);
24
+ }
25
+ else {
26
+ stream.writeUint16(23);
27
+ stream.writeUint16(address.port);
28
+ stream.writeUint32(0);
29
+ const addressParts = address.address.split(":");
30
+ for (const part of addressParts) {
31
+ const num = Number.parseInt(part, 16);
32
+ stream.writeUint16(num ^ 0xffff);
33
+ }
34
+ stream.writeUint32(0);
35
+ }
36
+ }
37
+ static read(stream) {
38
+ const version = stream.readUint8();
39
+ if (version === 4) {
40
+ const bytes = stream.read(4);
41
+ const address = bytes.map((byte) => byte ^ 0xff).join(".");
42
+ const port = stream.readUint16();
43
+ return new Address(address, port, version);
44
+ }
45
+ if (version === 6) {
46
+ stream.offset += 2;
47
+ const port = stream.readUint16();
48
+ stream.offset += 4;
49
+ const addressParts = [];
50
+ for (let i = 0; i < 8; i++) {
51
+ const part = stream.readUint16() ^ 0xffff;
52
+ addressParts.push(part.toString(16).padStart(4, "0"));
53
+ }
54
+ const address = addressParts.join(":");
55
+ stream.offset += 4;
56
+ return new Address(address, port, version);
57
+ }
58
+ return new Address("0.0.0.0", 0, 0);
59
+ }
60
+ }
61
+ exports.Address = Address;
@@ -0,0 +1,23 @@
1
+ import { type BinaryStream } from "@serenityjs/binarystream";
2
+ import { Reliability } from "../enums";
3
+ export declare const SplitFlag = 16;
4
+ export declare class Frame {
5
+ reliability: Reliability;
6
+ reliableFrameIndex: number;
7
+ sequenceFrameIndex: number;
8
+ orderedFrameIndex: number;
9
+ orderChannel: number;
10
+ splitFrameIndex: number;
11
+ splitSize: number;
12
+ splitId: number;
13
+ payload: Buffer;
14
+ static write(stream: BinaryStream, frames: Array<Frame>): void;
15
+ static read(stream: BinaryStream): Array<Frame>;
16
+ isSplit(): boolean;
17
+ isReliable(): boolean;
18
+ isSequenced(): boolean;
19
+ isOrdered(): boolean;
20
+ isOrderExclusive(): boolean;
21
+ getByteLength(): number;
22
+ }
23
+ //# sourceMappingURL=frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/types/frame.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EAMjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,SAAS,KAAO,CAAC;AAC9B,qBAAa,KAAK;IACV,WAAW,EAAG,WAAW,CAAC;IAC1B,kBAAkB,EAAG,MAAM,CAAC;IAC5B,kBAAkB,EAAG,MAAM,CAAC;IAC5B,iBAAiB,EAAG,MAAM,CAAC;IAC3B,YAAY,EAAG,MAAM,CAAC;IACtB,eAAe,EAAG,MAAM,CAAC;IACzB,SAAS,EAAG,MAAM,CAAC;IACnB,OAAO,EAAG,MAAM,CAAC;IACjB,OAAO,EAAG,MAAM,CAAC;IAExB,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC;IA2BvD,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC;IAkCxC,OAAO,IAAI,OAAO;IAIlB,UAAU,IAAI,OAAO;IAYrB,WAAW,IAAI,OAAO;IAStB,SAAS,IAAI,OAAO;IAWpB,gBAAgB,IAAI,OAAO;IAS3B,aAAa,IAAI,MAAM;CAU9B"}