diff options
Diffstat (limited to 'packet/svc/parse.go')
| -rw-r--r-- | packet/svc/parse.go | 18 |
1 files changed, 18 insertions, 0 deletions
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) +} |
