From 3830a8ad69fd861558f4d8ee7ee67b05c244eb47 Mon Sep 17 00:00:00 2001 From: bt Date: Sat, 7 Mar 2026 20:42:54 +0100 Subject: Create core package --- core/data.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 core/data.go (limited to 'core/data.go') diff --git a/core/data.go b/core/data.go new file mode 100644 index 0000000..a617f17 --- /dev/null +++ b/core/data.go @@ -0,0 +1,30 @@ +package core + +type Marshaler interface { + Marshal() []any +} + +type DataType uint8 + +const ( + TypeHandshake DataType = 0x01 + TypePing = 0x02 + TypePong = 0x03 + TypeTest = 0xFF +) + +type Handshake struct { + Version uint8 +} + +func (h Handshake) Marshal() []any { + return []any{h.Version} +} + +type Test struct { + Message string +} + +func (h Test) Marshal() []any { + return []any{[]byte(h.Message)} +} -- cgit v1.2.3