Documentation ¶
Index ¶
Constants ¶
View Source
const BlockSize = 16 * 1024
BlockSize is the size of smallest piece data that we are going to request from peers.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Index int // index in piece Begin uint32 // offset in piece Length uint32 // always equal to BlockSize except the last block of a piece. }
Block is part of a Piece that is specified in peerprotocol.Request messages.
type Piece ¶
type Piece struct { Index uint32 // index in torrent Length uint32 // always equal to Info.PieceLength except last piece Data filesection.Piece // the place to write downloaded bytes Hash []byte Writing bool Done bool }
Piece of a torrent.
func (*Piece) FindBlock ¶ added in v0.3.8
FindBlock returns the block at offset `begin` and length `length`.
Click to show internal directories.
Click to hide internal directories.