Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PieceResult ¶
type PieceResult struct { Downloader *URLDownloader Buffer bufferpool.Buffer Index uint32 Error error Done bool // URL downloader finished downloading all requested pieces }
PieceResult wraps the downloaded piece data.
type URLDownloader ¶
type URLDownloader struct { URL string Begin, End uint32 // piece index // contains filtered or unexported fields }
URLDownloader downloads files from a HTTP source.
func New ¶
func New(source string, begin, end uint32, b *ratelimit.Bucket) *URLDownloader
New returns a new URLDownloader for the given source and piece range.
func (*URLDownloader) ReadCurrent ¶ added in v0.8.0
func (d *URLDownloader) ReadCurrent() uint32
ReadCurrent returns the index of piece that is currently being downloaded.
func (*URLDownloader) Run ¶
func (d *URLDownloader) Run(client *http.Client, pieces []piece.Piece, multifile bool, resultC chan *PieceResult, pool *bufferpool.Pool, readTimeout time.Duration)
Run the URLDownloader and download pieces.
func (*URLDownloader) String ¶ added in v0.8.0
func (d *URLDownloader) String() string
String returns the URL being downloaded.
func (*URLDownloader) UpdateEnd ¶ added in v0.8.0
func (d *URLDownloader) UpdateEnd(value uint32)
UpdateEnd updates the end index of the piece range being downloaded.
Click to show internal directories.
Click to hide internal directories.