From d2ccb5fde285afbc9be514b48b411636c8424328 Mon Sep 17 00:00:00 2001 From: cubexteam Date: Wed, 4 Mar 2026 18:05:56 +0300 Subject: [PATCH] Update const.go refactor: replace var with const for timeouts, fix RaknetMagic allocation --- raknet/const.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/raknet/const.go b/raknet/const.go index 2faa0b4..8259b4a 100644 --- a/raknet/const.go +++ b/raknet/const.go @@ -2,17 +2,20 @@ package raknet import "time" +var raknetMagic = [16]byte{0x00, 0xff, 0xff, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0x12, 0x34, 0x56, 0x78} + func RaknetMagic() []byte { - return []byte{0x00, 0xff, 0xff, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0x12, 0x34, 0x56, 0x78} + b := raknetMagic + return b[:] } const ( - MaxMTU = 1400 - MinMTU = 400 + MaxMTU = 1400 + MinMTU = 400 MaxChannels = 32 ) -var ( +const ( SessionTimeout = 10 * time.Second PingSendInterval = 2500 * time.Millisecond DetectionSendInterval = 5 * time.Second