Documentation ¶
Index ¶
- func Handler(basePath string, svc *Service) http.Handler
- type Config
- type Event
- type EventType
- type Eventer
- type EventerOptionFunc
- type File
- type MultiEventer
- type Service
- func (svc *Service) AddMagnetURI(magnetURI string) (*Torrent, error)
- func (svc *Service) AddTorrentReader(torrentReader io.Reader) (*Torrent, error)
- func (svc *Service) AddTorrentURL(torrentURL string) (*Torrent, error)
- func (svc *Service) Drop(infoHash string, deleteFiles bool) error
- func (svc *Service) Eventer(infoHash string) (*TorrentEventer, error)
- func (svc *Service) MultiEventer() *MultiEventer
- func (svc *Service) Torrent(infoHash string) (*Torrent, error)
- func (svc *Service) Torrents() (torrents []Torrent)
- type Torrent
- type TorrentEventer
- func (e *TorrentEventer) Added() <-chan struct{}
- func (e *TorrentEventer) Closed() <-chan struct{}
- func (e *TorrentEventer) DownloadDone() <-chan struct{}
- func (e *TorrentEventer) Events(done <-chan struct{}) <-chan Event
- func (e *TorrentEventer) FileDone(filePath string) (<-chan struct{}, bool)
- func (e *TorrentEventer) GotInfo() <-chan struct{}
- func (e *TorrentEventer) PieceDone(index int) (<-chan struct{}, bool)
- func (e *TorrentEventer) SeedingDone() <-chan struct{}
- func (e *TorrentEventer) SetSeedRatio(seedRatio float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EventerOptionFunc ¶
type EventerOptionFunc func(e *TorrentEventer)
func SeedRatio ¶
func SeedRatio(seedRatio float64) EventerOptionFunc
SeedRatio returns an OptionFunc that sets the given seed ratio when the Torrent is initialized.
type File ¶
func (File) MarshalJSON ¶
type MultiEventer ¶
type MultiEventer struct {
// contains filtered or unexported fields
}
func (*MultiEventer) Events ¶
func (e *MultiEventer) Events(done <-chan struct{}) <-chan Event
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) AddTorrentReader ¶
func (*Service) AddTorrentURL ¶
func (*Service) MultiEventer ¶
func (svc *Service) MultiEventer() *MultiEventer
type Torrent ¶
func (Torrent) MarshalJSON ¶
type TorrentEventer ¶
type TorrentEventer struct {
// contains filtered or unexported fields
}
func (*TorrentEventer) Added ¶
func (e *TorrentEventer) Added() <-chan struct{}
Added returns a channel that will be closed when the torrent is added.
func (*TorrentEventer) Closed ¶
func (e *TorrentEventer) Closed() <-chan struct{}
Closed returns a channel that will be closed when the torrent is closed.
func (*TorrentEventer) DownloadDone ¶
func (e *TorrentEventer) DownloadDone() <-chan struct{}
DownloadDone returns a channel that will be closed when the torrent download is complete.
func (*TorrentEventer) Events ¶
func (e *TorrentEventer) Events(done <-chan struct{}) <-chan Event
Events returns a channel on which all of the events will be sent. The channel will be closed after the closed event is sent.
func (*TorrentEventer) FileDone ¶
func (e *TorrentEventer) FileDone(filePath string) (<-chan struct{}, bool)
FileDone returns a channel that will be closed when the file at the given path has completed downloading.
func (*TorrentEventer) GotInfo ¶
func (e *TorrentEventer) GotInfo() <-chan struct{}
GotInfo returns a channel that will be closed when the torrent info is ready.
func (*TorrentEventer) PieceDone ¶
func (e *TorrentEventer) PieceDone(index int) (<-chan struct{}, bool)
func (*TorrentEventer) SeedingDone ¶
func (e *TorrentEventer) SeedingDone() <-chan struct{}
SeedingDone returns a channel that will be closed when the torrent seeding is complete, based on the Torrent's configured seed ratio. Changes to the seed ratio after the returned channel is closed will have no effect.
func (*TorrentEventer) SetSeedRatio ¶
func (e *TorrentEventer) SetSeedRatio(seedRatio float64)
SetSeedRatio sets the monitored seed ratio for the torrent. If the channel returned by SeedingDone() has already been closed, this will have no effect.