Optimize network hosts
This commit is contained in:
@@ -52,16 +52,17 @@ func MainApp(configPath string) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
repoClient4 := http.NewHTTPClient("", 0, 1, false, config, log.Named("network_test"))
|
||||
repoClient6 := http.NewHTTPClient("", 0, 1, true, config, log.Named("network_test"))
|
||||
repoClient4 := http.NewHTTPClient("", 0, 1, false, []string{}, config, log.Named("network_test"))
|
||||
repoClient6 := http.NewHTTPClient("", 0, 1, true, []string{}, config, log.Named("network_test"))
|
||||
repo := http.NewIPRepository(repoClient4, repoClient6, log.Named("network_test"))
|
||||
repo.NetworkTest(true)
|
||||
repo.NetworkTest(false)
|
||||
|
||||
apiClient := http.NewHTTPClient(
|
||||
config.GetToken(),
|
||||
config.GetRetriesUntilFailed(), // default retries = 2
|
||||
config.GetApiTimeoutSecs(), // default api timeout = 60
|
||||
false, // no need for ipv6 support
|
||||
[]string{}, // no optimal hosts needed
|
||||
config,
|
||||
log.Named("api_client"),
|
||||
)
|
||||
@@ -71,15 +72,20 @@ func MainApp(configPath string) {
|
||||
config.GetRetriesUntilFailed(), // default retries = 2
|
||||
config.GetDownloadTimeoutSecs(), // default download timeout = 10
|
||||
false, // no need for ipv6 support
|
||||
[]string{}, // no optimal hosts needed
|
||||
config,
|
||||
log.Named("unrestrict_client"),
|
||||
)
|
||||
|
||||
hosts := repo.GetOptimalHosts(config.ShouldForceIPv6())
|
||||
zurglog.Debugf("Optimal hosts (%d): %v", len(hosts), hosts)
|
||||
|
||||
downloadClient := http.NewHTTPClient(
|
||||
"",
|
||||
config.GetRetriesUntilFailed(),
|
||||
config.GetDownloadTimeoutSecs(),
|
||||
config.ShouldForceIPv6(),
|
||||
hosts,
|
||||
config,
|
||||
log.Named("download_client"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user