From ca90ebdfa8789654766c5d7969baa7afacd9ebd2 Mon Sep 17 00:00:00 2001 From: BanceDev Date: Mon, 16 Feb 2026 16:31:54 -0500 Subject: initial commit --- packet/svc/parse.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 packet/svc/parse.go (limited to 'packet/svc/parse.go') diff --git a/packet/svc/parse.go b/packet/svc/parse.go new file mode 100644 index 0000000..a95a33a --- /dev/null +++ b/packet/svc/parse.go @@ -0,0 +1,18 @@ +package svc + +import ( + "github.com/osm/quake/common/buffer" + "github.com/osm/quake/common/context" + "github.com/osm/quake/packet" +) + +func Parse(ctx *context.Context, data []byte) (packet.Packet, error) { + buf := buffer.New(buffer.WithData(data)) + + header, _ := buf.PeekInt32() + if header == -1 { + return parseConnectionless(ctx, buf) + } + + return parseGameData(ctx, buf) +} -- cgit v1.2.3-59-g8ed1b