mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-09 10:00:27 +00:00
30 lines
515 B
Go
30 lines
515 B
Go
package common
|
|
|
|
// 对应协议的下载支持
|
|
type Fetcher interface {
|
|
BaseFetch
|
|
// 支持的协议列表
|
|
Protocols() []string
|
|
// 解析请求
|
|
Resolve(req *Request) (*Resource, error)
|
|
// 创建任务
|
|
Create(res *Resource, opts *Options) (Process, error)
|
|
}
|
|
|
|
type BaseFetch interface {
|
|
InitCtl(ctl *Controller)
|
|
GetCtl() *Controller
|
|
}
|
|
|
|
type BaseFetcher struct {
|
|
ctl *Controller
|
|
}
|
|
|
|
func (b *BaseFetcher) InitCtl(ctl *Controller) {
|
|
b.ctl = ctl
|
|
}
|
|
|
|
func (b *BaseFetcher) GetCtl() *Controller {
|
|
return b.ctl
|
|
}
|