forked from TrueCloudLab/neoneo-go
pkg/network: sort messages
Just for convenience.
This commit is contained in:
parent
0f265a6a04
commit
a436e22ec1
1 changed files with 33 additions and 33 deletions
|
@ -49,26 +49,26 @@ type CommandType string
|
||||||
|
|
||||||
// Valid protocol commands used to send between nodes.
|
// Valid protocol commands used to send between nodes.
|
||||||
const (
|
const (
|
||||||
CMDVersion CommandType = "version"
|
|
||||||
CMDVerack CommandType = "verack"
|
|
||||||
CMDGetAddr CommandType = "getaddr"
|
|
||||||
CMDAddr CommandType = "addr"
|
CMDAddr CommandType = "addr"
|
||||||
CMDGetHeaders CommandType = "getheaders"
|
|
||||||
CMDHeaders CommandType = "headers"
|
|
||||||
CMDGetBlocks CommandType = "getblocks"
|
|
||||||
CMDInv CommandType = "inv"
|
|
||||||
CMDGetData CommandType = "getdata"
|
|
||||||
CMDBlock CommandType = "block"
|
CMDBlock CommandType = "block"
|
||||||
CMDTX CommandType = "tx"
|
|
||||||
CMDConsensus CommandType = "consensus"
|
CMDConsensus CommandType = "consensus"
|
||||||
CMDUnknown CommandType = "unknown"
|
|
||||||
CMDFilterAdd CommandType = "filteradd"
|
CMDFilterAdd CommandType = "filteradd"
|
||||||
CMDFilterClear CommandType = "filterclear"
|
CMDFilterClear CommandType = "filterclear"
|
||||||
CMDFilterLoad CommandType = "filterload"
|
CMDFilterLoad CommandType = "filterload"
|
||||||
CMDMerkleBlock CommandType = "merkleblock"
|
CMDGetAddr CommandType = "getaddr"
|
||||||
|
CMDGetBlocks CommandType = "getblocks"
|
||||||
|
CMDGetData CommandType = "getdata"
|
||||||
|
CMDGetHeaders CommandType = "getheaders"
|
||||||
|
CMDHeaders CommandType = "headers"
|
||||||
|
CMDInv CommandType = "inv"
|
||||||
CMDMempool CommandType = "mempool"
|
CMDMempool CommandType = "mempool"
|
||||||
|
CMDMerkleBlock CommandType = "merkleblock"
|
||||||
CMDPing CommandType = "ping"
|
CMDPing CommandType = "ping"
|
||||||
CMDPong CommandType = "pong"
|
CMDPong CommandType = "pong"
|
||||||
|
CMDTX CommandType = "tx"
|
||||||
|
CMDUnknown CommandType = "unknown"
|
||||||
|
CMDVerack CommandType = "verack"
|
||||||
|
CMDVersion CommandType = "version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewMessage returns a new message with the given payload.
|
// NewMessage returns a new message with the given payload.
|
||||||
|
@ -102,44 +102,44 @@ func NewMessage(magic config.NetMode, cmd CommandType, p payload.Payload) *Messa
|
||||||
func (m *Message) CommandType() CommandType {
|
func (m *Message) CommandType() CommandType {
|
||||||
cmd := cmdByteArrayToString(m.Command)
|
cmd := cmdByteArrayToString(m.Command)
|
||||||
switch cmd {
|
switch cmd {
|
||||||
case "version":
|
|
||||||
return CMDVersion
|
|
||||||
case "verack":
|
|
||||||
return CMDVerack
|
|
||||||
case "getaddr":
|
|
||||||
return CMDGetAddr
|
|
||||||
case "addr":
|
case "addr":
|
||||||
return CMDAddr
|
return CMDAddr
|
||||||
case "getheaders":
|
|
||||||
return CMDGetHeaders
|
|
||||||
case "headers":
|
|
||||||
return CMDHeaders
|
|
||||||
case "getblocks":
|
|
||||||
return CMDGetBlocks
|
|
||||||
case "inv":
|
|
||||||
return CMDInv
|
|
||||||
case "getdata":
|
|
||||||
return CMDGetData
|
|
||||||
case "block":
|
case "block":
|
||||||
return CMDBlock
|
return CMDBlock
|
||||||
case "tx":
|
|
||||||
return CMDTX
|
|
||||||
case "consensus":
|
case "consensus":
|
||||||
return CMDConsensus
|
return CMDConsensus
|
||||||
case "merkleblock":
|
|
||||||
return CMDMerkleBlock
|
|
||||||
case "filterload":
|
|
||||||
return CMDFilterLoad
|
|
||||||
case "filteradd":
|
case "filteradd":
|
||||||
return CMDFilterAdd
|
return CMDFilterAdd
|
||||||
case "filterclear":
|
case "filterclear":
|
||||||
return CMDFilterClear
|
return CMDFilterClear
|
||||||
|
case "filterload":
|
||||||
|
return CMDFilterLoad
|
||||||
|
case "getaddr":
|
||||||
|
return CMDGetAddr
|
||||||
|
case "getblocks":
|
||||||
|
return CMDGetBlocks
|
||||||
|
case "getdata":
|
||||||
|
return CMDGetData
|
||||||
|
case "getheaders":
|
||||||
|
return CMDGetHeaders
|
||||||
|
case "headers":
|
||||||
|
return CMDHeaders
|
||||||
|
case "inv":
|
||||||
|
return CMDInv
|
||||||
case "mempool":
|
case "mempool":
|
||||||
return CMDMempool
|
return CMDMempool
|
||||||
|
case "merkleblock":
|
||||||
|
return CMDMerkleBlock
|
||||||
case "ping":
|
case "ping":
|
||||||
return CMDPing
|
return CMDPing
|
||||||
case "pong":
|
case "pong":
|
||||||
return CMDPong
|
return CMDPong
|
||||||
|
case "tx":
|
||||||
|
return CMDTX
|
||||||
|
case "verack":
|
||||||
|
return CMDVerack
|
||||||
|
case "version":
|
||||||
|
return CMDVersion
|
||||||
default:
|
default:
|
||||||
return CMDUnknown
|
return CMDUnknown
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue