infodownloader

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfoDownloader

type InfoDownloader struct {
	Peer  Peer
	Bytes []byte
	// contains filtered or unexported fields
}

InfoDownloader downloads metadata of a torrent from a single peer.

func New

func New(pe Peer) *InfoDownloader

New return new InfoDownloader for a single Peer.

func (*InfoDownloader) Done

func (d *InfoDownloader) Done() bool

Done returns true if all pieces of the metadata is downloaded.

func (*InfoDownloader) GotBlock

func (d *InfoDownloader) GotBlock(index uint32, data []byte) error

GotBlock must be called when a metadata block is received from the peer.

func (*InfoDownloader) RequestBlocks

func (d *InfoDownloader) RequestBlocks(queueLength int)

RequestBlocks is called to request remaining blocks of metadata from the peer.

type Peer added in v0.5.0

type Peer interface {
	MetadataSize() uint32
	RequestMetadataPiece(index uint32)
}

Peer of a torrent.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL