mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-07 00:50:27 +00:00
feat: support custom tracker url (#59)
This commit is contained in:
1 parent
9ef3405e43
commit
691c2f496e
71 files changed
+2209
-891
No files matched your search
@@ -6,19 +6,29 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type Controller interface {
|
||||
Touch(name string, size int64) (file *os.File, err error)
|
||||
type Controller struct {
|
||||
GetConfig func(v any) (bool, error)
|
||||
FileController
|
||||
//ContextDialer() (proxy.Dialer, error)
|
||||
}
|
||||
|
||||
type DefaultController struct {
|
||||
type FileController interface {
|
||||
Touch(name string, size int64) (file *os.File, err error)
|
||||
}
|
||||
|
||||
func NewController() *DefaultController {
|
||||
return &DefaultController{}
|
||||
type DefaultFileController struct {
|
||||
}
|
||||
|
||||
func (c *DefaultController) Touch(name string, size int64) (file *os.File, err error) {
|
||||
func NewController() *Controller {
|
||||
return &Controller{
|
||||
FileController: &DefaultFileController{},
|
||||
GetConfig: func(v any) (bool, error) {
|
||||
return false, nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (c *DefaultFileController) Touch(name string, size int64) (file *os.File, err error) {
|
||||
dir := filepath.Dir(name)
|
||||
if err = os.MkdirAll(dir, os.ModePerm); err != nil {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user