feat: support custom tracker url (#59)

This commit is contained in:
Li Wei authored and GitHub committed 2022-12-12 15:58:11 +08:00
1 parent 9ef3405e43
commit 691c2f496e
71 files changed
+2209 -891

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
_______ ______ .______ _______ _______ _______
/ _____| / __ \ | _ \ | ____|| ____|| \
| | __ | | | | | |_) | | |__ | |__ | .--. |
| | |_ | | | | | | ___/ | __| | __| | | | |
| |__| | | `--' | | | | |____ | |____ | '--' |
\______| \______/ | _| |_______||_______||_______/
+29
View File
@@ -0,0 +1,29 @@
package main
import (
_ "embed"
"fmt"
"github.com/monkeyWie/gopeed/pkg/rest"
"github.com/monkeyWie/gopeed/pkg/rest/model"
"net/http"
)
//go:embed banner.txt
var banner string
func main() {
cfg := &model.StartConfig{
Network: "tcp",
Address: "127.0.0.1:9999",
Storage: model.StorageBolt,
}
fmt.Println(banner)
srv, listener, err := rest.BuildServer(cfg)
if err != nil {
panic(err)
}
fmt.Printf("Server start success on http://%s\n", listener.Addr().String())
if err := srv.Serve(listener); err != nil && err != http.ErrServerClosed {
panic(err)
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ func parse() *args {
if len(t) > 0 {
args.url = t[0]
} else {
gPrintln("missing url parameter")
gPrintln("missing url parameter, for example: gopeed https://www.google.com or gopeed bt.torrent or gopeed magnet:?xt=urn:btih:...")
gPrintln("try 'gopeed -h' for more information")
os.Exit(1)
}
+3 -2
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/monkeyWie/gopeed/pkg/base"
"github.com/monkeyWie/gopeed/pkg/download"
"github.com/monkeyWie/gopeed/pkg/protocol/http"
"github.com/monkeyWie/gopeed/pkg/util"
"strings"
"sync"
@@ -39,8 +40,8 @@ func main() {
}
}).
Create(&base.Options{
Path: *args.dir,
Connections: *args.connections,
Path: *args.dir,
Extra: http.OptsExtra{Connections: *args.connections},
})
if err != nil {
panic(err)