torr

package
v0.0.0-...-78dab50 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTorrentDB

func AddTorrentDB(torr *Torrent)

func DropTorrent

func DropTorrent(hashHex string)

func InitApiHelper

func InitApiHelper(bt *BTServer)

func ListTorrentsDB

func ListTorrentsDB() map[metainfo.Hash]*Torrent

func Preload

func Preload(torr *Torrent, index int)

func RemTorrent

func RemTorrent(hashHex string)

func RemTorrentDB

func RemTorrentDB(hash metainfo.Hash)

func SaveTorrentToDB

func SaveTorrentToDB(torr *Torrent)

func SetDefSettings

func SetDefSettings()

func SetSettings

func SetSettings(set *sets.BTSets)

func Shutdown

func Shutdown()

func WriteStatus

func WriteStatus(w io.Writer)

Types

type BTServer

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

func NewBTS

func NewBTS() *BTServer

func (*BTServer) Connect

func (bt *BTServer) Connect() error

func (*BTServer) Disconnect

func (bt *BTServer) Disconnect()

func (*BTServer) GetTorrent

func (bt *BTServer) GetTorrent(hash torrent.InfoHash) *Torrent

func (*BTServer) ListTorrents

func (bt *BTServer) ListTorrents() map[metainfo.Hash]*Torrent

func (*BTServer) RemoveTorrent

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

type Torrent

type Torrent struct {
	Title  string
	Poster string
	Data   string
	*torrent.TorrentSpec

	Stat      state.TorrentStat
	Timestamp int64
	Size      int64

	*torrent.Torrent

	DownloadSpeed       float64
	UploadSpeed         float64
	BytesReadUsefulData int64
	BytesWrittenData    int64

	PreloadSize    int64
	PreloadedBytes int64

	DurationSeconds float64
	BitRate         string
	// contains filtered or unexported fields
}

func AddTorrent

func AddTorrent(spec *torrent.TorrentSpec, title, poster string, data string) (*Torrent, error)

func GetTorrent

func GetTorrent(hashHex string) *Torrent

func GetTorrentDB

func GetTorrentDB(hash metainfo.Hash) *Torrent

func ListTorrent

func ListTorrent() []*Torrent

func LoadTorrent

func LoadTorrent(tor *Torrent) *Torrent

func NewTorrent

func NewTorrent(spec *torrent.TorrentSpec, bt *BTServer) (*Torrent, error)

func SetTorrent

func SetTorrent(hashHex, title, poster, data string) *Torrent

func (*Torrent) AddExpiredTime

func (t *Torrent) AddExpiredTime(duration time.Duration)

func (*Torrent) CacheState

func (t *Torrent) CacheState() *cacheSt.CacheState

func (*Torrent) Close

func (t *Torrent) Close() bool

func (*Torrent) CloseReader

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

func (*Torrent) Files

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

func (*Torrent) GetCache

func (t *Torrent) GetCache() *torrstor.Cache

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) *torrstor.Reader

func (*Torrent) Preload

func (t *Torrent) Preload(index int, size int64)

func (*Torrent) Status

func (t *Torrent) Status() *state.TorrentStatus

func (*Torrent) Stream

func (t *Torrent) Stream(fileID int, req *http.Request, resp http.ResponseWriter) error

func (*Torrent) WaitInfo

func (t *Torrent) WaitInfo() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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