Reachable hosts

This commit is contained in:
Ben Adrian Sarmiento
2024-06-24 01:21:09 +02:00
parent 449c0f71cf
commit 2e9a068780
5 changed files with 68 additions and 48 deletions

View File

@@ -64,7 +64,7 @@ func MainApp(configPath string) {
repoClient4 := http.NewHTTPClient("", 0, 1, false, []string{}, proxyURL, log.Named("network_test"))
repoClient6 := http.NewHTTPClient("", 0, 1, true, []string{}, proxyURL, log.Named("network_test"))
repo := http.NewIPRepository(repoClient4, repoClient6, "", log.Named("network_test"))
repo.NetworkTest(false)
repo.NetworkTest(false, config.ShouldCacheNetworkTestResults())
apiClient := http.NewHTTPClient(
config.GetToken(),
@@ -86,14 +86,11 @@ func MainApp(configPath string) {
log.Named("unrestrict_client"),
)
hosts := repo.GetOptimalHosts(config.GetNumberOfHosts(), config.ShouldForceIPv6())
hosts := repo.GetHosts(config.GetNumberOfHosts(), config.ShouldForceIPv6())
if len(hosts) == 0 {
zurglog.Fatal("No optimal hosts found. We cannot continue! (check if Real-Debrid is down or they have blocked your IP address)")
zurglog.Fatal("No reachable hosts found. We cannot continue! (check if Real-Debrid is down or they have blocked your IP address)")
}
zurglog.Debugf("Optimal hosts (%d): %v", len(hosts), hosts)
// help message
zurglog.Debug("To reset optimal hosts, run 'zurg network-test' (Using docker compose? 'docker compose exec zurg ./zurg network-test')")
zurglog.Debug("To run network-test with a proxy, set the PROXY environment variable 'PROXY=http://xyz:123 zurg network-test'")
zurglog.Debugf("Reachable hosts (%d): %v", len(hosts), hosts)
downloadClient := http.NewHTTPClient(
"",