torrentfile

package
v0.0.0-...-ef7f9f6 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const Port uint16 = 6881

Port to listen on

Variables

This section is empty.

Functions

This section is empty.

Types

type TorrentFile

type TorrentFile struct {
	Announce    string
	Nodes       []dht.Addr
	InfoHash    [20]byte
	PieceHashes [][20]byte
	PieceLength int
	Length      int
	Name        string
	Content     []byte
}

TorrentFile encodes the metadata from a .torrent file

func Open

func Open(path string) (TorrentFile, error)

Open parses a torrent file

func (*TorrentFile) DownloadToFile

func (t *TorrentFile) DownloadToFile(path string, peer string, local string, pathSelectionResponsibility string, pc *config.PeerDiscoveryConfig) error

DownloadToFile downloads a torrent and writes it to a file This function leeches all pieces of a torrent but never starts seeding. When DHT is enabled in the PeerDiscoveryConfig, the peer will still announce its presence to receive other peers. We therefore announces our presence on a port we are not listening to.

Jump to

Keyboard shortcuts

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