Add network test command

This commit is contained in:
Ben Adrian Sarmiento
2024-06-16 09:47:29 +02:00
parent f4d3f273f6
commit 42a08583ce
7 changed files with 60 additions and 47 deletions

View File

@@ -52,8 +52,10 @@ func MainApp(configPath string) {
os.Exit(1)
}
repoClient4 := http.NewHTTPClient("", 0, 1, false, []string{}, config, log.Named("network_test"))
repoClient6 := http.NewHTTPClient("", 0, 1, true, []string{}, config, log.Named("network_test"))
proxyURL := os.Getenv("PROXY")
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)
@@ -63,7 +65,7 @@ func MainApp(configPath string) {
config.GetApiTimeoutSecs(), // default api timeout = 60
false, // no need for ipv6 support
[]string{}, // no optimal hosts needed
config,
proxyURL,
log.Named("api_client"),
)
@@ -73,7 +75,7 @@ func MainApp(configPath string) {
config.GetDownloadTimeoutSecs(), // default download timeout = 10
false, // no need for ipv6 support
[]string{}, // no optimal hosts needed
config,
proxyURL,
log.Named("unrestrict_client"),
)
@@ -86,7 +88,7 @@ func MainApp(configPath string) {
config.GetDownloadTimeoutSecs(),
config.ShouldForceIPv6(),
hosts,
config,
proxyURL,
log.Named("download_client"),
)