]> Sergey Matveev's repositories - btrtrc.git/blob - peer_protocol/protocol.go
8f914591111d4afdfdb1b0fe12a19a933c69f18c
[btrtrc.git] / peer_protocol / protocol.go
1 package peer_protocol
2
3 const (
4         Protocol = "\x13BitTorrent protocol"
5 )
6
7 type (
8         MessageType byte
9 )
10
11 const (
12         Choke         MessageType = iota
13         Unchoke                   // 1
14         Interested                // 2
15         NotInterested             // 3
16         Have                      // 4
17         Bitfield                  // 5
18         Request                   // 6
19         Piece                     // 7
20         Cancel                    // 8
21         Port                      // 9
22
23         // BEP 6
24         Suggest     = 0xd  // 13
25         HaveAll     = 0xe  // 14
26         HaveNone    = 0xf  // 15
27         Reject      = 0x10 // 16
28         AllowedFast = 0x11 // 17
29
30         Extended = 20
31
32         HandshakeExtendedID = 0
33
34         RequestMetadataExtensionMsgType = 0
35         DataMetadataExtensionMsgType    = 1
36         RejectMetadataExtensionMsgType  = 2
37 )