torrent

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MimeBitTorrent = "application/x-bittorrent"

Variables

View Source
var ErrTorrentAlreadyAdded = errors.New("torrent already added")

Functions

This section is empty.

Types

type Client

type Client interface {
	ClientBuilder

	Start() error
	Stop()

	AddURI(uri string) (chan Torrent, error)
	Torrents() []Torrent
	Stats() Stats
	ReadTorrentFiles() error
	OutputDir() string
}

func NewClient

func NewClient(logger log.Logger) (Client, error)

type ClientBuilder

type ClientBuilder interface {
	WithSeed(seed bool) Client
	WithOutput(output string) Client
	WithPublisher(pub stream.Publisher) Client
	WithDownloadLimit(limit int) Client
	WithUploadLimit(limit int) Client
	WithWatchDir(dir string) Client
	WithBiggestFirst(b bool) Client
}

type File

type File interface {
	Priority
	DisplayPath() string
	Path() string
	BytesCompleted() int64
	Length() int64
	Offset() int64
	Name() string
}

func BiggestFileFromTorrent

func BiggestFileFromTorrent(t Torrent) (biggest File)

type Priority

type Priority interface {
	GetPriority() byte
	Now()
	High()
	Normal()
	Zero()
}

type Stats

type Stats struct {
	BytesRead      uint64 `json:"bytesRead"`
	BytesWritten   uint64 `json:"bytesWritten"`
	TotalCount     uint32 `json:"totalCount"`
	CompletedCount uint32 `json:"completedCount"`
}

type Torrent

type Torrent interface {
	Files() []File
	InfoHash() string
	Name() string
	TotalLength() uint64
	URI() string
	BytesCompleted() uint64
	Completed() bool
	MarshalJSON() ([]byte, error)
	String() string
}

Jump to

Keyboard shortcuts

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