blob: a617f17328f0d5b2052a3060b456c0c8c43bc2c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)}
}
|