4 Protocol = "\x13BitTorrent protocol"
9 //go:generate stringer -type=MessageType
11 func (mt MessageType) FastExtension() bool {
12 return mt >= Suggest && mt <= AllowedFast
15 func (mt *MessageType) UnmarshalBinary(b []byte) error {
16 *mt = MessageType(b[0])
23 Unchoke MessageType = 1
24 Interested MessageType = 2
25 NotInterested MessageType = 3
27 Bitfield MessageType = 5
28 Request MessageType = 6
30 Cancel MessageType = 8
35 // BEP 6 - Fast extension
36 Suggest MessageType = 0x0d // 13
37 HaveAll MessageType = 0x0e // 14
38 HaveNone MessageType = 0x0f // 15
39 Reject MessageType = 0x10 // 16
40 AllowedFast MessageType = 0x11 // 17
43 Extended MessageType = 20
47 HandshakeExtendedID = 0
49 RequestMetadataExtensionMsgType ExtendedMetadataRequestMsgType = 0
50 DataMetadataExtensionMsgType ExtendedMetadataRequestMsgType = 1
51 RejectMetadataExtensionMsgType ExtendedMetadataRequestMsgType = 2