forked from sampork/go-sniffer
/
opcode_string.go
47 lines (41 loc) · 1.18 KB
/
opcode_string.go
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Code generated by "stringer -linecomment -type OpCode"; DO NOT EDIT.
package wire
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[OpCodeReply-1]
_ = x[OpCodeUpdate-2001]
_ = x[OpCodeInsert-2002]
_ = x[OpCodeGetByOID-2003]
_ = x[OpCodeQuery-2004]
_ = x[OpCodeGetMore-2005]
_ = x[OpCodeDelete-2006]
_ = x[OpCodeKillCursors-2007]
_ = x[OpCodeCompressed-2012]
_ = x[OpCodeMsg-2013]
}
const (
_OpCode_name_0 = "OP_REPLY"
_OpCode_name_1 = "OP_UPDATEOP_INSERTOP_GET_BY_OIDOP_QUERYOP_GET_MOREOP_DELETEOP_KILL_CURSORS"
_OpCode_name_2 = "OP_COMPRESSEDOP_MSG"
)
var (
_OpCode_index_1 = [...]uint8{0, 9, 18, 31, 39, 50, 59, 74}
_OpCode_index_2 = [...]uint8{0, 13, 19}
)
func (i OpCode) String() string {
switch {
case i == 1:
return _OpCode_name_0
case 2001 <= i && i <= 2007:
i -= 2001
return _OpCode_name_1[_OpCode_index_1[i]:_OpCode_index_1[i+1]]
case 2012 <= i && i <= 2013:
i -= 2012
return _OpCode_name_2[_OpCode_index_2[i]:_OpCode_index_2[i+1]]
default:
return "OpCode(" + strconv.FormatInt(int64(i), 10) + ")"
}
}