mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-15 12:53:41 +00:00
重构fetcher接口
This commit is contained in:
1 parent
871185e7ea
commit
bdce3c84a3
12 files changed
+347
-397
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package base
|
||||
|
||||
// 对应协议的下载支持
|
||||
type Fetcher interface {
|
||||
Init(ctl Controller)
|
||||
// 解析请求
|
||||
Resolve(req *Request) (*Resource, error)
|
||||
// 创建任务
|
||||
Create(res *Resource, opts *Options) error
|
||||
Start() error
|
||||
Pause() error
|
||||
Continue() error
|
||||
Delete() error
|
||||
}
|
||||
|
||||
type DefaultFetcher struct {
|
||||
Ctl Controller
|
||||
}
|
||||
|
||||
func (f *DefaultFetcher) Init(ctl Controller) {
|
||||
f.Ctl = ctl
|
||||
}
|
||||
Reference in new issue
Block a user