fuse integreated

This commit is contained in:
Ben Sarmiento
2023-11-11 11:52:34 +01:00
29 changed files with 1074 additions and 1001 deletions

View File

@@ -16,12 +16,17 @@ import (
"github.com/debridmediamanager.com/zurg/internal/zfs"
"github.com/debridmediamanager.com/zurg/pkg/chunk"
"github.com/debridmediamanager.com/zurg/pkg/logutil"
"github.com/debridmediamanager.com/zurg/pkg/realdebrid"
"github.com/hashicorp/golang-lru/v2/expirable"
)
func main() {
rlog := logutil.NewLogger()
log := rlog.Named("zurg")
if len(os.Args) > 1 && os.Args[1] == "networktest" {
realdebrid.RunTest()
return
}
log := logutil.NewLogger().Named("zurg")
config, configErr := config.LoadZurgConfig("./config.yml")
if configErr != nil {
@@ -30,7 +35,9 @@ func main() {
cache := expirable.NewLRU[string, string](1e4, nil, time.Hour)
torrentMgr := torrent.NewTorrentManager(config, cache)
rd := realdebrid.NewRealDebrid(config.GetToken(), config, logutil.NewLogger().Named("realdebrid"))
torrentMgr := torrent.NewTorrentManager(config, rd)
mux := http.NewServeMux()
net.Router(mux, config, torrentMgr, cache)
@@ -53,7 +60,8 @@ func main() {
1, // 1 chunk - load ahead (1MB total)
max(runtime.NumCPU()/2, 1), // check threads
max(runtime.NumCPU()/2, 1), // load threads
runtime.NumCPU()*2, // max chunks
runtime.NumCPU()*2,
torrentMgr, // max chunks
config)
if nil != err {
log.Panicf("Failed to initialize chunk manager: %v", err)