IPv6 hosts check

This commit is contained in:
Ben Sarmiento
2024-01-11 02:28:38 +01:00
parent 72dda4f9fd
commit 9e3d12b008
5 changed files with 156 additions and 92 deletions

View File

@@ -12,6 +12,7 @@ import (
"github.com/debridmediamanager/zurg/internal/handlers"
"github.com/debridmediamanager/zurg/internal/torrent"
"github.com/debridmediamanager/zurg/internal/universal"
"github.com/debridmediamanager/zurg/pkg/hosts"
"github.com/debridmediamanager/zurg/pkg/http"
"github.com/debridmediamanager/zurg/pkg/logutil"
"github.com/debridmediamanager/zurg/pkg/premium"
@@ -35,7 +36,7 @@ func MainApp(configPath string) {
os.Exit(1)
}
apiClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), config.GetRealDebridTimeout(), config, log.Named("httpclient"))
apiClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), config.GetRealDebridTimeout(), nil, config, log.Named("httpclient"))
rd := realdebrid.NewRealDebrid(apiClient, log.Named("realdebrid"))
@@ -51,7 +52,14 @@ func MainApp(configPath string) {
utils.EnsureDirExists("data") // Ensure the data directory exists
torrentMgr := torrent.NewTorrentManager(config, rd, p, log.Named("manager"))
downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), 0, config, log.Named("dlclient"))
var ipv6List []string
if config.ShouldForceIPv6() {
ipv6List, err = hosts.FetchHosts(hosts.IPV6)
if err != nil {
panic(err)
}
}
downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), 0, ipv6List, config, log.Named("dlclient"))
downloader := universal.NewDownloader(downloadClient)
router := chi.NewRouter()