-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparcelType.go
44 lines (40 loc) · 1.35 KB
/
parcelType.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
package p2p
// ParcelType is a list of parcel types that this node understands
type ParcelType uint16
const ( // iota is reset to 0
// TypeHeartbeat is deprecated
TypeHeartbeat ParcelType = iota
// TypePing is sent if no other parcels have been sent in a while
TypePing
// TypePong is a response to a Ping
TypePong
// TypePeerRequest indicates a peer wants to be be updated of endpoints
TypePeerRequest
// TypePeerResponse carries a payload with protocol specific endpoints
TypePeerResponse
// TypeAlert is deprecated
TypeAlert
// TypeMessage carries an application message in the payload
TypeMessage
// TypeMessagePart is a partial message. deprecated in p2p 2.0
TypeMessagePart
// TypeHandshake is the first parcel sent after making a connection
TypeHandshake
// TypeRejectAlternative is sent instead of a handshake if the server refuses connection
TypeRejectAlternative
)
var typeStrings = map[ParcelType]string{
TypeHeartbeat: "Heartbeat",
TypePing: "Ping",
TypePong: "Pong",
TypePeerRequest: "Peer-Request",
TypePeerResponse: "Peer-Response",
TypeAlert: "Alert",
TypeMessage: "Message",
TypeMessagePart: "MessagePart",
TypeHandshake: "Handshake",
TypeRejectAlternative: "Rejection-Alternative",
}
func (t ParcelType) String() string {
return typeStrings[t]
}