@serenityjs/raknet 1.0.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.
@@ -0,0 +1,829 @@
1
+ import { BinaryStream, Endianness, Bool, Byte, Float32, Float64, Int8, Int16, Int24, Int32, Int64, Long, Short, String16, String32, Uint8, Uint16, Uint24, Uint32, Uint64, ULong, UShort, Uuid, VarInt, VarLong, VarString, ZigZag, ZigZong } from '@serenityjs/binarystream';
2
+ import { Socket } from 'node:dgram';
3
+ import { Emitter } from '@serenityjs/emitter';
4
+ import { Logger } from '@serenityjs/logger';
5
+
6
+ /**
7
+ * Represents a data type.
8
+ */
9
+ declare abstract class DataType {
10
+ /**
11
+ * Creates a new data type.
12
+ */
13
+ constructor(..._arguments_: Array<unknown>);
14
+ /**
15
+ * Reads the data type from a binary stream.
16
+ * @param _stream The binary stream to read from.
17
+ * @param _endian The endianness to use.
18
+ * @param _parameter An optional parameter.
19
+ * @returns The data type.
20
+ */
21
+ static read(_stream: BinaryStream, _endian?: Endianness, _parameter?: unknown): unknown;
22
+ /**
23
+ * Writes the data type to a binary stream.
24
+ * @param _stream The binary stream to write to.
25
+ * @param _value The data type to write.
26
+ * @param _endian The endianness to use.
27
+ * @param _parameter An optional parameter.
28
+ */
29
+ static write(_stream: BinaryStream, _value: unknown, _endian?: Endianness, _parameter?: unknown): void;
30
+ }
31
+
32
+ /**
33
+ * Represents a magic data type.
34
+ * Magic is used when establishing a connection in RakNet.
35
+ */
36
+ declare class Magic extends DataType {
37
+ /**
38
+ * Reads the magic data type from a binary stream.
39
+ * @param stream The binary stream to read from.
40
+ * @returns The magic data type.
41
+ */
42
+ static read(stream: BinaryStream): Buffer;
43
+ /**
44
+ * Writes the magic data type to a binary stream.
45
+ * @param stream The binary stream to write to.
46
+ */
47
+ static write(stream: BinaryStream): void;
48
+ }
49
+
50
+ /**
51
+ * Represents a maximum transmission unit data type.
52
+ * MTU is used when establishing a connection in RakNet.
53
+ */
54
+ declare class MTU extends DataType {
55
+ /**
56
+ * Reads the mtu data type from a binary stream.
57
+ * @param stream The binary stream to read from.
58
+ * @returns The mtu data type.
59
+ */
60
+ static read(stream: BinaryStream): number;
61
+ /**
62
+ * Writes the mtu data type to a binary stream.
63
+ * @param stream The binary stream to write to.
64
+ * @param value The value to write.
65
+ */
66
+ static write(stream: BinaryStream, value: number): void;
67
+ }
68
+
69
+ type ValidTypes = typeof Bool | typeof Byte | typeof DataType | typeof Float32 | typeof Float64 | typeof Int8 | typeof Int16 | typeof Int24 | typeof Int32 | typeof Int64 | typeof Long | typeof Short | typeof String16 | typeof String32 | typeof Uint8 | typeof Uint16 | typeof Uint24 | typeof Uint32 | typeof Uint64 | typeof ULong | typeof UShort | typeof Uuid | typeof VarInt | typeof VarLong | typeof VarString | typeof ZigZag | typeof ZigZong;
70
+
71
+ interface PacketMetadata {
72
+ endian: Endianness;
73
+ name: string;
74
+ parameter: string;
75
+ type: ValidTypes;
76
+ }
77
+
78
+ interface NetworkIdentifier {
79
+ address: string;
80
+ port: number;
81
+ version: number;
82
+ }
83
+
84
+ declare enum Packet {
85
+ ConnectedPing = 0,// 0
86
+ UnconnectedPing = 1,// 1
87
+ ConnectedPong = 3,// 3
88
+ OpenConnectionRequest1 = 5,// 5
89
+ OpenConnectionReply1 = 6,// 6
90
+ OpenConnectionRequest2 = 7,// 7
91
+ OpenConnectionReply2 = 8,// 8
92
+ ConnectionRequest = 9,// 9
93
+ ConnectionRequestAccepted = 16,// 16
94
+ NewIncomingConnection = 19,// 19
95
+ Disconnect = 21,// 21
96
+ IncompatibleProtocolVersion = 25,// 25
97
+ UnconnectedPong = 28,// 28
98
+ FrameSet = 128,// 128
99
+ Nack = 160,// 160
100
+ Ack = 192
101
+ }
102
+
103
+ declare enum Bitflags {
104
+ Valid = 128,
105
+ Ack = 64,
106
+ Nak = 32,
107
+ Split = 16
108
+ }
109
+
110
+ declare enum Priority {
111
+ Normal = 0,
112
+ Immediate = 1
113
+ }
114
+
115
+ declare enum Status {
116
+ Connecting = 0,
117
+ Connected = 1,
118
+ Disconnecting = 2,
119
+ Disconnected = 3
120
+ }
121
+
122
+ declare enum Reliability {
123
+ Unreliable = 0,
124
+ UnreliableSequenced = 1,
125
+ Reliable = 2,
126
+ ReliableOrdered = 3,
127
+ ReliableSequenced = 4,
128
+ UnreliableWithAckReceipt = 5,
129
+ ReliableWithAckReceipt = 6,
130
+ ReliableOrderedWithAckReceipt = 7
131
+ }
132
+
133
+ /**
134
+ * Represents a connection in the server
135
+ */
136
+ declare class Connection {
137
+ /**
138
+ * The server instance
139
+ */
140
+ protected readonly server: RaknetServer;
141
+ /**
142
+ * The status of the connection
143
+ */
144
+ status: Status;
145
+ /**
146
+ * The network identifier of the connection
147
+ */
148
+ readonly identifier: NetworkIdentifier;
149
+ /**
150
+ * The GUID of the connection
151
+ */
152
+ readonly guid: bigint;
153
+ /**
154
+ * The maximum transmission unit of the connection
155
+ */
156
+ readonly mtu: number;
157
+ protected readonly receivedFrameSequences: Set<number>;
158
+ protected readonly lostFrameSequences: Set<number>;
159
+ protected readonly inputHighestSequenceIndex: Array<number>;
160
+ protected readonly fragmentsQueue: Map<number, Map<number, Frame>>;
161
+ protected readonly inputOrderIndex: Array<number>;
162
+ protected inputOrderingQueue: Map<number, Map<number, Frame>>;
163
+ protected lastInputSequence: number;
164
+ protected readonly outputBackupQueue: Map<number, Frame[]>;
165
+ protected readonly outputOrderIndex: Array<number>;
166
+ protected readonly outputSequenceIndex: Array<number>;
167
+ protected outputFrameQueue: FrameSet;
168
+ protected outputSequence: number;
169
+ protected outputReliableIndex: number;
170
+ protected outputFragmentIndex: number;
171
+ /**
172
+ * Creates a new connection
173
+ * @param server The server instance
174
+ * @param identifier The network identifier
175
+ * @param guid The GUID
176
+ * @param mtu The maximum transmission unit
177
+ */
178
+ constructor(server: RaknetServer, identifier: NetworkIdentifier, guid: bigint, mtu: number);
179
+ /**
180
+ * Ticks the connection
181
+ */
182
+ tick(): void;
183
+ /**
184
+ * Sends a buffer to the connection
185
+ */
186
+ send(buffer: Buffer): void;
187
+ /**
188
+ * Disconnects the connection
189
+ */
190
+ disconnect(): void;
191
+ /**
192
+ * Handles incoming packets
193
+ * @param buffer The packet buffer
194
+ */
195
+ incoming(buffer: Buffer): void;
196
+ /**
197
+ * Handles incoming batch packets
198
+ * @param buffer The packet buffer
199
+ */
200
+ incomingBatch(buffer: Buffer): void;
201
+ /**
202
+ * Handles incoming acks
203
+ * @param buffer The packet buffer
204
+ */
205
+ private handleIncomingAck;
206
+ /**
207
+ * Handles incoming nacks
208
+ * @param buffer The packet buffer
209
+ */
210
+ private handleIncomingNack;
211
+ /**
212
+ * Handles incoming framesets
213
+ * @param buffer The packet buffer
214
+ */
215
+ private handleIncomingFrameSet;
216
+ /**
217
+ * Handles incoming frames
218
+ * @param frame The frame
219
+ */
220
+ private handleFrame;
221
+ /**
222
+ * Handles fragmented frames
223
+ * @param frame The frame
224
+ */
225
+ private handleFragment;
226
+ /**
227
+ * Sends a frame to the connection.
228
+ *
229
+ * @param frame - The frame to send
230
+ * @param priority - The priority of the frame
231
+ */
232
+ sendFrame(frame: Frame, priority: Priority): void;
233
+ /**
234
+ * Adds a frame to the output queue
235
+ * @param frame The frame
236
+ * @param priority The priority
237
+ */
238
+ private addFrameToQueue;
239
+ /**
240
+ * Sends the output frame queue
241
+ */
242
+ sendFrameQueue(): void;
243
+ /**
244
+ * Sends a frame set to the connection
245
+ * @param frameset The frame set
246
+ */
247
+ private sendFrameSet;
248
+ /**
249
+ * Handles an incoming connection request
250
+ * @param buffer The packet buffer
251
+ */
252
+ private handleIncomingConnectionRequest;
253
+ /**
254
+ * Handles an incoming connected ping
255
+ * @param buffer The packet buffer
256
+ */
257
+ private handleIncomingConnectedPing;
258
+ }
259
+
260
+ /**
261
+ * The raknet server
262
+ */
263
+ declare class RaknetServer extends Emitter<RaknetEvents> {
264
+ /**
265
+ * The server tick interval
266
+ */
267
+ protected interval: NodeJS.Timeout | null;
268
+ /**
269
+ * The raknet server logger
270
+ */
271
+ readonly logger: Logger;
272
+ /**
273
+ * The server socket
274
+ */
275
+ readonly socket: Socket;
276
+ /**
277
+ * The server address
278
+ */
279
+ readonly address: string;
280
+ /**
281
+ * The server port
282
+ */
283
+ readonly port: number;
284
+ /**
285
+ * The server guid
286
+ */
287
+ readonly guid: bigint;
288
+ /**
289
+ * The server connections
290
+ */
291
+ readonly connections: Map<string, Connection>;
292
+ /**
293
+ * The server protocol
294
+ */
295
+ protocol: number | null;
296
+ /**
297
+ * The server version
298
+ */
299
+ version: string | null;
300
+ /**
301
+ * The server message
302
+ */
303
+ message: string | null;
304
+ /**
305
+ * The server max connections
306
+ */
307
+ maxConnections: number | null;
308
+ /**
309
+ * Creates a new raknet server
310
+ * @param address the server address
311
+ * @param port the server port
312
+ */
313
+ constructor(address: string, port?: number);
314
+ /**
315
+ * Starts the server
316
+ */
317
+ start(): void;
318
+ /**
319
+ * Stops the server
320
+ */
321
+ stop(): void;
322
+ /**
323
+ * Sends a buffer to the specified network identifier
324
+ * @param buffer the buffer to send
325
+ * @param identifier the network identifier to send the buffer to
326
+ */
327
+ send(buffer: Buffer, identifier: NetworkIdentifier): void;
328
+ /**
329
+ * Handles incoming packets
330
+ * @param buffer the packet buffer
331
+ * @param rinfo the remote info
332
+ */
333
+ private incoming;
334
+ }
335
+
336
+ /**
337
+ * Handles all ofline raknet server operations
338
+ */
339
+ declare class Offline {
340
+ /**
341
+ * The server instance
342
+ */
343
+ static server: RaknetServer;
344
+ /**
345
+ * Handles all incoming offline packets
346
+ * @param buffer The packet buffer
347
+ * @param identifier The network identifier
348
+ */
349
+ static incoming(buffer: Buffer, identifier: NetworkIdentifier): void;
350
+ /**
351
+ * Handles an unconnected ping
352
+ * @param buffer The packet buffer
353
+ * @param identifier The network identifier
354
+ */
355
+ private static handleUnconnectedPing;
356
+ /**
357
+ * Handles an open connection request 1
358
+ * @param buffer The packet buffer
359
+ * @param identifier The network identifier
360
+ */
361
+ private static handleOpenConnectionRequest1;
362
+ /**
363
+ * Handles an open connection request 2
364
+ * @param buffer The packet buffer
365
+ * @param identifier The network identifier
366
+ */
367
+ private static handleOpenConnectionRequest2;
368
+ }
369
+
370
+ interface RaknetEvents {
371
+ error: [Error];
372
+ connect: [Connection];
373
+ disconnect: [Connection];
374
+ encapsulated: [Connection, Buffer];
375
+ }
376
+
377
+ /**
378
+ * Represents an address data type.
379
+ * Address is used when establishing a connection in RakNet.
380
+ */
381
+ declare class Address extends DataType {
382
+ /**
383
+ * The address of the data type.
384
+ */
385
+ address: string;
386
+ /**
387
+ * The port of the data type.
388
+ */
389
+ port: number;
390
+ /**
391
+ * The version of the data type.
392
+ */
393
+ version: number;
394
+ /**
395
+ * Initializes a new instance of the Address data type.
396
+ * @param address The address of the data type.
397
+ * @param port The port of the data type.
398
+ * @param version The version of the data type.
399
+ */
400
+ constructor(address: string, port: number, version: number);
401
+ /**
402
+ * Converts the Address data type to a NetworkIdentifier.
403
+ *
404
+ * @param identifier The NetworkIdentifier.
405
+ * @returns The NetworkIdentifier.
406
+ */
407
+ static fromIdentifier(identifier: NetworkIdentifier): Address;
408
+ /**
409
+ * Reads the Address data type from a binary stream.
410
+ * @param stream The binary stream to read from.
411
+ * @returns The Address data type.
412
+ */
413
+ static read(stream: BinaryStream): Address;
414
+ /**
415
+ * Writes the Address data type to a binary stream.
416
+ * @param stream The binary stream to write to.
417
+ * @param value The value to write.
418
+ */
419
+ static write(stream: BinaryStream, value: Address): void;
420
+ }
421
+
422
+ /**
423
+ * Represents a frame data type.
424
+ * Frame is used when sending data in RakNet.
425
+ */
426
+ declare class Frame extends DataType {
427
+ /**
428
+ * The reliability of the frame.
429
+ */
430
+ reliability: Reliability;
431
+ /**
432
+ * The reliable index of the frame.
433
+ */
434
+ reliableIndex: number;
435
+ /**
436
+ * The sequence index of the frame.
437
+ */
438
+ sequenceIndex: number;
439
+ /**
440
+ * The order index of the frame.
441
+ */
442
+ orderIndex: number;
443
+ /**
444
+ * The order channel of the frame.
445
+ */
446
+ orderChannel: number;
447
+ /**
448
+ * The fragment size of the frame.
449
+ */
450
+ fragmentSize: number;
451
+ /**
452
+ * The fragment id of the frame.
453
+ */
454
+ fragmentId: number;
455
+ /**
456
+ * The fragment index of the frame.
457
+ */
458
+ fragmentIndex: number;
459
+ /**
460
+ * The payload of the frame.
461
+ */
462
+ payload: Buffer;
463
+ /**
464
+ * Checks if the frame is fragmented.
465
+ * @returns True if the frame is fragmented; otherwise, false.
466
+ */
467
+ isFragmented(): boolean;
468
+ /**
469
+ * Checks if the frame is reliable.
470
+ * @returns True if the frame is reliable; otherwise, false.
471
+ */
472
+ isReliable(): boolean;
473
+ /**
474
+ * Checks if the frame is sequenced.
475
+ * @returns True if the frame is sequenced; otherwise, false.
476
+ */
477
+ isSequenced(): boolean;
478
+ /**
479
+ * Checks if the frame is ordered.
480
+ * @returns True if the frame is ordered; otherwise, false.
481
+ */
482
+ isOrdered(): boolean;
483
+ /**
484
+ * Checks if the frame is order exclusive.
485
+ * @returns True if the frame is order exclusive; otherwise, false.
486
+ */
487
+ isOrderExclusive(): boolean;
488
+ /**
489
+ * Gets the byte length of the frame.
490
+ * @returns The byte length of the frame.
491
+ */
492
+ getByteLength(): number;
493
+ /**
494
+ * Reads the Frame data type from a binary stream.
495
+ * @param stream The binary stream to read from.
496
+ * @returns The Frame data type.
497
+ */
498
+ static read(stream: BinaryStream): Array<Frame>;
499
+ /**
500
+ * Writes the Frame data type to a binary stream.
501
+ * @param stream The binary stream to write to.
502
+ */
503
+ static write(stream: BinaryStream, value: Array<Frame>): void;
504
+ }
505
+
506
+ /**
507
+ * Represents an address data type.
508
+ * Address is used when establishing a connection in RakNet.
509
+ */
510
+ declare class SystemAddress extends DataType {
511
+ /**
512
+ * Converts the Address data type to a NetworkIdentifier.
513
+ *
514
+ * @param identifier The NetworkIdentifier.
515
+ * @returns The NetworkIdentifier.
516
+ */
517
+ static fromIdentifier(identifier: NetworkIdentifier): Address;
518
+ /**
519
+ * Reads the Address data type from a binary stream.
520
+ * @param stream The binary stream to read from.
521
+ * @returns The Address data type.
522
+ */
523
+ static read(stream: BinaryStream): Array<Address>;
524
+ /**
525
+ * Writes the Address data type to a binary stream.
526
+ * @param stream The binary stream to write to.
527
+ * @param value The value to write.
528
+ */
529
+ static write(stream: BinaryStream): void;
530
+ }
531
+
532
+ /**
533
+ * Represents a packet.
534
+ */
535
+ declare abstract class BasePacket extends BinaryStream {
536
+ /**
537
+ * The packet id.
538
+ */
539
+ static id: number;
540
+ /**
541
+ * The packet id data type.
542
+ */
543
+ static id_type: ValidTypes;
544
+ /**
545
+ * Flushes the binary stream.
546
+ */
547
+ flush(): void;
548
+ /**
549
+ * Gets the packet id.
550
+ * @returns The packet id.
551
+ */
552
+ getId(): number;
553
+ /**
554
+ * Gets the packet id data type.
555
+ * @returns The packet id data type.
556
+ */
557
+ getIdType(): ValidTypes;
558
+ /**
559
+ * Serializes the packet.
560
+ * @returns The serialized packet.
561
+ */
562
+ serialize(): Buffer;
563
+ /**
564
+ * Deserializes the packet.
565
+ */
566
+ deserialize(): this;
567
+ }
568
+
569
+ /**
570
+ * Represents an unconnected ping packet.
571
+ */
572
+ declare class UnconnectedPing extends BasePacket {
573
+ /**
574
+ * The timestamp of the ping.
575
+ */
576
+ timestamp: bigint;
577
+ /**
578
+ * The magic bytes of the ping.
579
+ */
580
+ magic: Buffer;
581
+ /**
582
+ * The client guid of the ping.
583
+ */
584
+ client: bigint;
585
+ }
586
+
587
+ /**
588
+ * Represents an unconnected pong packet.
589
+ */
590
+ declare class UnconnectedPong extends BasePacket {
591
+ /**
592
+ * The timestamp of the pong.
593
+ */
594
+ timestamp: bigint;
595
+ /**
596
+ * The server guid of the pong.
597
+ */
598
+ guid: bigint;
599
+ /**
600
+ * The magic bytes of the pong.
601
+ */
602
+ magic: Buffer;
603
+ /**
604
+ * The server message of the pong.
605
+ */
606
+ message: string;
607
+ }
608
+
609
+ /**
610
+ * Represents an open connection request 1 packet.
611
+ */
612
+ declare class OpenConnectionRequest1 extends BasePacket {
613
+ /**
614
+ * The magic bytes of the request.
615
+ */
616
+ magic: Buffer;
617
+ /**
618
+ * The protocol version of the request.
619
+ */
620
+ protocol: number;
621
+ /**
622
+ * The maximum transfer unit of the request.
623
+ */
624
+ mtu: number;
625
+ }
626
+
627
+ /**
628
+ * Represents an open connection reply 1 packet.
629
+ */
630
+ declare class OpenConnectionReply1 extends BasePacket {
631
+ /**
632
+ * The magic bytes of the reply.
633
+ */
634
+ magic: Buffer;
635
+ /**
636
+ * The server guid of the reply.
637
+ */
638
+ guid: bigint;
639
+ /**
640
+ * If raknet is using security.
641
+ */
642
+ security: boolean;
643
+ /**
644
+ * The maximum transfer unit of the reply.
645
+ */
646
+ mtu: number;
647
+ }
648
+
649
+ /**
650
+ * Represents an open connection request 2 packet.
651
+ */
652
+ declare class OpenConnectionRequest2 extends BasePacket {
653
+ /**
654
+ * The magic bytes of the request.
655
+ */
656
+ magic: Buffer;
657
+ /**
658
+ * The protocol version of the request.
659
+ */
660
+ address: Address;
661
+ /**
662
+ * The mtu of the request.
663
+ */
664
+ mtu: number;
665
+ /**
666
+ * The client guid of the request.
667
+ */
668
+ client: bigint;
669
+ }
670
+
671
+ /**
672
+ * Represents an open connection reply 2 packet.
673
+ */
674
+ declare class OpenConnectionReply2 extends BasePacket {
675
+ /**
676
+ * The magic bytes of the reply.
677
+ */
678
+ magic: Buffer;
679
+ /**
680
+ * The server guid of the reply.
681
+ */
682
+ guid: bigint;
683
+ /**
684
+ * Client adrress.
685
+ */
686
+ address: Address;
687
+ /**
688
+ * The maximum transfer unit of the reply.
689
+ */
690
+ mtu: number;
691
+ /**
692
+ * If raknet is using encryption.
693
+ */
694
+ encryption: boolean;
695
+ }
696
+
697
+ /**
698
+ * Represents an connected pong packet.
699
+ */
700
+ declare class ConnectedPong extends BasePacket {
701
+ /**
702
+ * The timestamp of the ping.
703
+ */
704
+ pingTimestamp: bigint;
705
+ /**
706
+ * The timestamp of the pong.
707
+ */
708
+ timestamp: bigint;
709
+ }
710
+
711
+ /**
712
+ * Represents an connected ping packet.
713
+ */
714
+ declare class ConnectedPing extends BasePacket {
715
+ /**
716
+ * The timestamp of the ping.
717
+ */
718
+ timestamp: bigint;
719
+ }
720
+
721
+ /**
722
+ * Represents an connection request packet.
723
+ */
724
+ declare class ConnectionRequest extends BasePacket {
725
+ /**
726
+ * The client guid of the request.
727
+ */
728
+ client: bigint;
729
+ /**
730
+ * The timestamp of the request.
731
+ */
732
+ timestamp: bigint;
733
+ }
734
+
735
+ /**
736
+ * Represents a frame set packet.
737
+ * This packet hold multiple frames.
738
+ */
739
+ declare class FrameSet extends BasePacket {
740
+ /**
741
+ * The sequence of the frame set.
742
+ */
743
+ sequence: number;
744
+ /**
745
+ * The frames of the frame set.
746
+ */
747
+ frames: Array<Frame>;
748
+ }
749
+
750
+ declare class Ack extends BasePacket {
751
+ sequences: Array<number>;
752
+ serialize(): Buffer;
753
+ deserialize(): this;
754
+ }
755
+
756
+ declare class Nack extends BasePacket {
757
+ sequences: Array<number>;
758
+ serialize(): Buffer;
759
+ deserialize(): this;
760
+ }
761
+
762
+ /**
763
+ * Represents a disconnect packet.
764
+ */
765
+ declare class Disconnect extends BasePacket {
766
+ }
767
+
768
+ /**
769
+ * Represents an connection request accepted packet.
770
+ */
771
+ declare class ConnectionRequestAccepted extends BasePacket {
772
+ /**
773
+ * The client address of the request.
774
+ */
775
+ address: Address;
776
+ /**
777
+ * The system index of the request.
778
+ */
779
+ systemIndex: number;
780
+ /**
781
+ * The system address of the request.
782
+ */
783
+ systemAddress: Array<Address>;
784
+ /**
785
+ * The request timestamp of the request.
786
+ */
787
+ requestTimestamp: bigint;
788
+ /**
789
+ * The timestamp of the request.
790
+ */
791
+ timestamp: bigint;
792
+ }
793
+
794
+ /**
795
+ * Proto decorator for packet classes.
796
+ *
797
+ * @param id Packet id.
798
+ * @returns The packet decorator.
799
+ */
800
+ declare function Proto(id: number): (target: typeof BasePacket) => void;
801
+
802
+ declare function Serialize(type: ValidTypes, endian?: Endianness, parameter?: string): (target: BasePacket, name: string) => void;
803
+
804
+ /**
805
+ * Raknet protocol version.
806
+ */
807
+ declare const Protocol = 11;
808
+ /**
809
+ * The tick rate of the Raknet protocol.
810
+ */
811
+ declare const RaknetTPS = 100;
812
+ /**
813
+ * The length of a Raknet tick in seconds.
814
+ */
815
+ declare const RaknetTickLength: number;
816
+ /**
817
+ * The size of a UDP header.
818
+ */
819
+ declare const udpHeaderSize = 28;
820
+ /**
821
+ * The minimum size of a Raknet packet.
822
+ */
823
+ declare const MinMtuSize = 400;
824
+ /**
825
+ * The maximum size of a Raknet packet.
826
+ */
827
+ declare const MaxMtuSize = 1492;
828
+
829
+ export { Ack, Address, BasePacket, Bitflags, ConnectedPing, ConnectedPong, Connection, ConnectionRequest, ConnectionRequestAccepted, DataType, Disconnect, Frame, FrameSet, MTU, Magic, MaxMtuSize, MinMtuSize, Nack, type NetworkIdentifier, Offline, OpenConnectionReply1, OpenConnectionReply2, OpenConnectionRequest1, OpenConnectionRequest2, Packet, type PacketMetadata, Priority, Proto, Protocol, type RaknetEvents, RaknetServer, RaknetTPS, RaknetTickLength, Reliability, Serialize, Status, SystemAddress, UnconnectedPing, UnconnectedPong, type ValidTypes, udpHeaderSize };