summaryrefslogtreecommitdiff
path: root/danmaku/dmpkg/operation.go
diff options
context:
space:
mode:
Diffstat (limited to 'danmaku/dmpkg/operation.go')
-rw-r--r--danmaku/dmpkg/operation.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/danmaku/dmpkg/operation.go b/danmaku/dmpkg/operation.go
new file mode 100644
index 0000000..d3c13f4
--- /dev/null
+++ b/danmaku/dmpkg/operation.go
@@ -0,0 +1,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
+}