client

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

This package is the embeded version of 'github.com/Sioro-Neoku/go-peerflix/'. We did some modifications on it in order to let it fit into 'Torrodle'

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client       *torrent.Client
	ClientConfig *torrent.ClientConfig
	Torrent      *torrent.Torrent
	Source       models.Source
	URL          string
	HostPort     int
}

Client manages the torrent downloading.

func NewClient

func NewClient(dataDir string, torrentPort int, hostPort int) (Client, error)

NewClient initializes a new torrent client.

func (*Client) Close

func (client *Client) Close()

Close cleans up the connections of the client.

func (*Client) PrintProgress

func (client *Client) PrintProgress()

PrintProgress prints out the current download progress of the client for the CLI.

func (*Client) Serve

func (client *Client) Serve()

Serve serves the torrent via HTTP localhost:{port}.

func (*Client) SetSource

func (client *Client) SetSource(source models.Source) (*Client, error)

SetSource sets the source (magnet uri) which the client is based on. * must be called before `Client.Start()`

func (*Client) Start

func (client *Client) Start()

Start starts the client by getting the torrent information and allocating the priorities of each piece.

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.

Jump to

Keyboard shortcuts

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