Documentation ¶
Index ¶
- Constants
- Variables
- func SendPiece(index, begin, blockSize uint32, writer io.Writer) error
- func SendRequest(index, begin, length uint32, writer io.Writer) error
- func TryParseHave(msg *BittorrentMessage) (index uint32, err error)
- func TryParsePiece(msg *BittorrentMessage) (index, begin uint32, err error)
- func TryParseRequest(msg *BittorrentMessage) (index, begin, length uint32, err error)
- func WriteHave(index uint32, writer io.Writer) error
- type BittorrentMessage
Constants ¶
View Source
const ( MsgChoke msgID = 0 MsgUnchoke msgID = 1 MsgInterested msgID = 2 MsgNotInterested msgID = 3 MsgHave msgID = 4 MsgBitfield msgID = 5 MsgRequest msgID = 6 MsgPiece msgID = 7 )
View Source
const PieceMessageByteLength = 17
Variables ¶
View Source
var EmptyPayload []byte
Functions ¶
func TryParseHave ¶
func TryParseHave(msg *BittorrentMessage) (index uint32, err error)
func TryParsePiece ¶
func TryParsePiece(msg *BittorrentMessage) (index, begin uint32, err error)
func TryParseRequest ¶
func TryParseRequest(msg *BittorrentMessage) (index, begin, length uint32, err error)
Types ¶
type BittorrentMessage ¶
type BittorrentMessage struct { ID msgID Payload []byte }
func (*BittorrentMessage) Validate ¶
func (m *BittorrentMessage) Validate() error
Click to show internal directories.
Click to hide internal directories.