summaryrefslogtreecommitdiff
path: root/danmaku/dmpkg/operation.go
blob: d3c13f4c5e1bdd3b55c07b7f9b9ad3cb0c98f2f7 (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
package dmpkg

type Operation uint32

// Operations
const (
	OpHeartbeat    Operation = 2
	OpHeartbeatAck Operation = 3
	OpLayer7Data   Operation = 5
	OpConnect      Operation = 7
	OpConnectOk    Operation = 8
)

var opStringMap = map[Operation]string{
	OpHeartbeat:    "HeartBeat",
	OpHeartbeatAck: "HeartBeatAck",
	OpLayer7Data:   "AppData",
	OpConnect:      "Connect",
	OpConnectOk:    "ConnectOk",
}

func (o Operation) String() string {
	s, exists := opStringMap[o]
	if !exists {
		return "<Unknown>"
	}
	return s
}