forked from aergoio/aergo
/
subprotocol_string.go
43 lines (37 loc) · 1.35 KB
/
subprotocol_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
/*
* @file
* @copyright defined in aergo/LICENSE.txt
*/
// Code generated by "stringer -type=SubProtocol"; DO NOT EDIT.
package p2pcommon
import (
"strconv"
)
const (
_SubProtocol_name_0 = "StatusRequestPingRequestPingResponseGoAwayAddressesRequestAddressesResponse"
_SubProtocol_name_1 = "GetBlocksRequestGetBlocksResponseGetBlockHeadersRequestGetBlockHeadersResponseGetMissingRequestGetMissingResponseNewBlockNoticeGetAncestorRequestGetAncestorResponseGetHashesRequestGetHashesResponseGetHashByNoRequestGetHashByNoResponse"
_SubProtocol_name_2 = "GetTXsRequestGetTXsResponseNewTxNotice"
_SubProtocol_name_3 = "BlockProducedNotice"
)
var (
_SubProtocol_index_0 = [...]uint8{0, 13, 24, 36, 42, 58, 75}
_SubProtocol_index_1 = [...]uint8{0, 16, 33, 55, 78, 95, 113, 127, 145, 164, 180, 197, 215, 234}
_SubProtocol_index_2 = [...]uint8{0, 13, 27, 38}
)
func (i SubProtocol) String() string {
switch {
case 1 <= i && i <= 6:
i -= 1
return _SubProtocol_name_0[_SubProtocol_index_0[i]:_SubProtocol_index_0[i+1]]
case 16 <= i && i <= 28:
i -= 16
return _SubProtocol_name_1[_SubProtocol_index_1[i]:_SubProtocol_index_1[i+1]]
case 32 <= i && i <= 34:
i -= 32
return _SubProtocol_name_2[_SubProtocol_index_2[i]:_SubProtocol_index_2[i+1]]
case i == 48:
return _SubProtocol_name_3
default:
return "SubProtocol(" + strconv.FormatInt(int64(i), 10) + ")"
}
}