torr

package
v0.0.0-...-22766dc Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TorrentAdded = TorrentStatus(iota)
	TorrentGettingInfo
	TorrentPreload
	TorrentWorking
	TorrentClosed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BTServer

type BTServer struct {
	// contains filtered or unexported fields
}

func NewBTS

func NewBTS() *BTServer

func (*BTServer) AddTorrent

func (bt *BTServer) AddTorrent(magnet metainfo.Magnet, onAdd func(*Torrent)) (*Torrent, error)

func (*BTServer) BTState

func (bt *BTServer) BTState() *BTState

func (*BTServer) CacheState

func (bt *BTServer) CacheState(hash metainfo.Hash) *state.CacheState

func (*BTServer) Connect

func (bt *BTServer) Connect() error

func (*BTServer) Disconnect

func (bt *BTServer) Disconnect()

func (*BTServer) GetTorrent

func (bt *BTServer) GetTorrent(hash metainfo.Hash) *Torrent

func (*BTServer) List

func (bt *BTServer) List() []*Torrent

func (*BTServer) Play

func (bt *BTServer) Play(torr *Torrent, file *torrent.File, preload int64, c echo.Context) error

func (*BTServer) Reconnect

func (bt *BTServer) Reconnect() error

func (*BTServer) RemoveTorrent

func (bt *BTServer) RemoveTorrent(hash torrent.InfoHash)

func (*BTServer) View

func (bt *BTServer) View(torr *Torrent, file *torrent.File, c echo.Context) error

func (*BTServer) WriteState

func (bt *BTServer) WriteState(w io.Writer)

type BTState

type BTState struct {
	LocalPort int
	PeerID    string
	BannedIPs int
	DHTs      []*dht.Server

	Torrents []*Torrent
}

type Torrent

type Torrent struct {
	*torrent.Torrent

	DownloadSpeed       float64
	UploadSpeed         float64
	BytesReadUsefulData int64
	BytesWrittenData    int64

	PreloadSize    int64
	PreloadedBytes int64
	// contains filtered or unexported fields
}

func NewTorrent

func NewTorrent(magnet metainfo.Magnet, bt *BTServer) (*Torrent, error)

func (*Torrent) Close

func (t *Torrent) Close()

func (*Torrent) CloseReader

func (t *Torrent) CloseReader(reader torrent.Reader)

func (*Torrent) Files

func (t *Torrent) Files() []*torrent.File

func (*Torrent) GotInfo

func (t *Torrent) GotInfo() bool

func (*Torrent) Hash

func (t *Torrent) Hash() metainfo.Hash

func (*Torrent) Length

func (t *Torrent) Length() int64

func (*Torrent) NewReader

func (t *Torrent) NewReader(file *torrent.File, readahead int64) torrent.Reader

func (*Torrent) Preload

func (t *Torrent) Preload(file *torrent.File, size int64)

func (*Torrent) Stats

func (t *Torrent) Stats() TorrentStats

func (*Torrent) Status

func (t *Torrent) Status() TorrentStatus

func (*Torrent) WaitInfo

func (t *Torrent) WaitInfo() bool

type TorrentFileStat

type TorrentFileStat struct {
	Id     int
	Path   string
	Length int64
}

type TorrentStats

type TorrentStats struct {
	Name string
	Hash string

	TorrentStatus       TorrentStatus
	TorrentStatusString string

	LoadedSize  int64
	TorrentSize int64

	PreloadedBytes int64
	PreloadSize    int64

	DownloadSpeed float64
	UploadSpeed   float64

	TotalPeers       int
	PendingPeers     int
	ActivePeers      int
	ConnectedSeeders int
	HalfOpenPeers    int

	BytesWritten        int64
	BytesWrittenData    int64
	BytesRead           int64
	BytesReadData       int64
	BytesReadUsefulData int64
	ChunksWritten       int64
	ChunksRead          int64
	ChunksReadUseful    int64
	ChunksReadWasted    int64
	PiecesDirtiedGood   int64
	PiecesDirtiedBad    int64

	FileStats []TorrentFileStat
}

type TorrentStatus

type TorrentStatus int

func (TorrentStatus) String

func (t TorrentStatus) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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