2
0
mirror of synced 2025-02-24 06:38:14 +00:00
torrent/peer_protocol/protocol.go

37 lines
401 B
Go

package peer_protocol
type (
MessageType byte
Integer uint32
)
const (
Protocol = "\x13BitTorrent protocol"
)
const (
Choke MessageType = iota
Unchoke
Interested
NotInterested
Have
Bitfield
RequestType
Piece
Cancel
)
type Request struct {
Index, Begin, Length Integer
}
type Message interface {
Encode() []byte
}
type Bytes []byte
func (b Bytes) Encode() []byte {
return b
}