torrent

package
v0.0.0-...-b07f661 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMagnet

func BuildMagnet(infoHash string, title string) string

BuildMagnet builds a magnet link from an info hash and a static list of trackers.

Types

type Client

type Client struct {
	Client   *torrent.Client
	Torrents map[string]*Torrent
}

Client stores active Torrents and a reference to the BitTorrent client.

func NewClient

func NewClient() (client *Client, err error)

NewClient creates a new BitTorrent client.

func (*Client) AddTorrent

func (c *Client) AddTorrent(infoHash string) (err error)

AddTorrent adds Torrent to the client. If the torrent is already added returns without error.

func (*Client) GetFile

func (c *Client) GetFile(w http.ResponseWriter, r *http.Request)

GetFile is an http handler to serve the biggest file managed by the client.

func (*Client) MovieDelete

func (c *Client) MovieDelete(w http.ResponseWriter, r *http.Request)

MovieDelete deletes a torrent identified by an info hash from the BitTorrent Client.

func (*Client) MovieRequest

func (c *Client) MovieRequest(w http.ResponseWriter, r *http.Request)

MovieRequest adds a torrent identified by an info hash to the BitTorrent Client.

func (*Client) Status

func (c *Client) Status(w http.ResponseWriter, r *http.Request)

Status serves a html with an overview of all active torrents.

func (*Client) TorrentStatus

func (c *Client) TorrentStatus(w http.ResponseWriter, r *http.Request)

TorrentStatus returns download progress information about all active torrents.

type FileEntry

type FileEntry struct {
	*torrent.File
	torrent.Reader
}

FileEntry helps reading a torrent file.

func (FileEntry) Seek

func (f FileEntry) Seek(offset int64, whence int) (int64, error)

Seek seeks to the correct file position, paying attention to the offset.

type SeekableContent

type SeekableContent interface {
	io.ReadSeeker
	io.Closer
}

SeekableContent describes an io.ReadSeeker that can be closed as well.

func NewFileReader

func NewFileReader(f *torrent.File) (SeekableContent, error)

NewFileReader sets up a torrent file for streaming reading.

type Status

type Status struct {
	Name            string
	InfoHash        string
	BytesDownloaded int64
	BytesMissing    int64
}

Status stores Information about the download progress of a torrent.

type Torrent

type Torrent struct {
	*torrent.Torrent
	Fetched bool
}

Torrent stores general information about a torrent with flag indicating information and torrent availability.

Jump to

Keyboard shortcuts

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