file

package
v0.0.0-...-2f17533 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TorrentFile

type TorrentFile struct {
	Announce    string
	InfoHash    [20]byte
	PieceHashes [][20]byte
	PieceLength int
	Length      int
	Name        string
}

TorrentFile struct of the torrent file

func Open

func Open(path string) (TorrentFile, error)

Open is used to open the file,unmarshall the contents of the file and convert it to the form of a torrentFile

func (*TorrentFile) DownloadFile

func (t *TorrentFile) DownloadFile(path string) error

DownloadFile is used generate a random id for us to be identified with and get a list of all the peer swith their ips and ports

type Tracker

type Tracker struct {
	Interval int    `bencode:"interval"`
	Peers    string `bencode:"peers"`
}

Tracker has the peers string and the time interval after which to send another request

Jump to

Keyboard shortcuts

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