]> Sergey Matveev's repositories - btrtrc.git/blob - peer_protocol/protocol.go
Begin implementing the adding of peers, and initiating of connections
[btrtrc.git] / peer_protocol / protocol.go
1 package peer_protocol
2
3 type (
4         MessageType byte
5         Integer     uint32
6 )
7
8 const (
9         Choke MessageType = iota
10         Unchoke
11         Interested
12         NotInterested
13         Have
14         Bitfield
15         RequestType
16         Piece
17         Cancel
18 )
19
20 type Request struct {
21         Index, Begin, Length Integer
22 }
23
24 type Message struct {
25         KeepAlive bool
26         Type      MessageType
27         Bitfield  []bool
28         Piece     []byte
29 }