Documentation ¶
Index ¶
- func Hash(d Downloadable) string
- type CollectorConfig
- type CollectorOption
- type Downloadable
- type DownloadableCollector
- type Downloader
- type HttpConfig
- type Magnet
- type MagnetCollector
- type MagnetDLMagnetCollector
- type NyaaMagnetCollector
- type Source
- type TransmissionConfig
- type TransmissionDownloader
- type WebTorrentDownloader
- type XDGDownloader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hash ¶
func Hash(d Downloadable) string
Types ¶
type CollectorConfig ¶
type CollectorConfig struct { HTTP HttpConfig PageCount int }
type CollectorOption ¶
type CollectorOption func(*CollectorConfig) error
func WithHTTPConfig ¶
func WithHTTPConfig(http HttpConfig) CollectorOption
func WithPageCount ¶
func WithPageCount(page int) CollectorOption
type Downloadable ¶
type Downloadable interface { fmt.Stringer Name() string URI() string Size() uint64 Date() time.Time }
Downloadable is an interface that defines a method to get the name and URI of a downloadable.
type DownloadableCollector ¶
type DownloadableCollector interface {
Collect(ctx context.Context) ([]Downloadable, error)
}
DownloadableCollector is an interface that defines a method to collect downloadables.
func Factory ¶
func Factory(source Source) (DownloadableCollector, error)
type Downloader ¶
type Downloader interface {
Download(d Downloadable) error
}
Downloader is an interface that defines a method to open a downloadable.
type HttpConfig ¶
type HttpConfig struct { UserAgent string DNSResolver string DNSProto string DNSTimeout int Insecure bool RetryMax int }
func (*HttpConfig) SetDefaultsOnEmptyFields ¶
func (cfg *HttpConfig) SetDefaultsOnEmptyFields()
type MagnetCollector ¶
type MagnetCollector struct {
// contains filtered or unexported fields
}
func NewMagnetCollector ¶
func NewMagnetCollector(uri string, opts ...CollectorOption) (*MagnetCollector, error)
func (*MagnetCollector) Collect ¶
func (c *MagnetCollector) Collect(ctx context.Context) ([]Downloadable, error)
type MagnetDLMagnetCollector ¶
type MagnetDLMagnetCollector struct {
// contains filtered or unexported fields
}
func NewMagnetDLMagnetCollector ¶
func NewMagnetDLMagnetCollector(uri string, opts ...CollectorOption) (*MagnetDLMagnetCollector, error)
func (*MagnetDLMagnetCollector) Collect ¶
func (c *MagnetDLMagnetCollector) Collect(ctx context.Context) ([]Downloadable, error)
type NyaaMagnetCollector ¶
type NyaaMagnetCollector struct {
// contains filtered or unexported fields
}
func NewNyaaMagnetCollector ¶
func NewNyaaMagnetCollector(uri string, opts ...CollectorOption) (*NyaaMagnetCollector, error)
func (*NyaaMagnetCollector) Collect ¶
func (c *NyaaMagnetCollector) Collect(ctx context.Context) ([]Downloadable, error)
type TransmissionConfig ¶
type TransmissionDownloader ¶
type TransmissionDownloader struct { Transmission *TransmissionConfig // contains filtered or unexported fields }
TransmissionDownloader is a type that implements the Downloader interface to open a downloadable using xdg-open.
func NewTransmissionDownloader ¶
func NewTransmissionDownloader(connection *TransmissionConfig) *TransmissionDownloader
NewTransmissionDownloader creates a new TransmissionDownloader
func (*TransmissionDownloader) Download ¶
func (d *TransmissionDownloader) Download(dl Downloadable) error
Download does an http post to a trasmission server to download the torrent file
type WebTorrentDownloader ¶
type WebTorrentDownloader struct{}
WebTorrentDownloader is a type that implements the Downloader interface to open a downloadable using WebTorrent-open.
func (WebTorrentDownloader) Download ¶
func (d WebTorrentDownloader) Download(dl Downloadable) error
Download opens the URI of the downloadable using WebTorrent-open.
type XDGDownloader ¶
type XDGDownloader struct{}
XDGDownloader is a type that implements the Downloader interface to open a downloadable using xdg-open.
func (XDGDownloader) Download ¶
func (d XDGDownloader) Download(dl Downloadable) error
Download opens the URI of the downloadable using xdg-open.