Add network test command
This commit is contained in:
@@ -5,10 +5,13 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/debridmediamanager/zurg/internal/clear"
|
||||
"github.com/debridmediamanager/zurg/internal/version"
|
||||
"github.com/debridmediamanager/zurg/pkg/realdebrid"
|
||||
"github.com/debridmediamanager/zurg/pkg/http"
|
||||
"github.com/debridmediamanager/zurg/pkg/logutil"
|
||||
"github.com/debridmediamanager/zurg/pkg/utils"
|
||||
)
|
||||
|
||||
func ShowVersion() {
|
||||
@@ -16,8 +19,19 @@ func ShowVersion() {
|
||||
version.GetBuiltAt(), version.GetGitCommit(), version.GetVersion())
|
||||
}
|
||||
|
||||
func NetworkTest(testType string) {
|
||||
realdebrid.RunTest(testType)
|
||||
func NetworkTest() {
|
||||
utils.EnsureDirExists("logs")
|
||||
utils.EnsureDirExists("data")
|
||||
|
||||
dateStr := time.Now().Format(time.DateOnly)
|
||||
timeStr := strings.ReplaceAll(time.Now().Format(time.TimeOnly), ":", "-")
|
||||
logPath := fmt.Sprintf("logs/network-test-%s-%s.log", dateStr, timeStr)
|
||||
log := logutil.NewLogger(logPath)
|
||||
|
||||
repoClient4 := http.NewHTTPClient("", 0, 1, false, []string{}, os.Getenv("PROXY"), log.Named("network_test"))
|
||||
repoClient6 := http.NewHTTPClient("", 0, 1, true, []string{}, os.Getenv("PROXY"), log.Named("network_test"))
|
||||
repo := http.NewIPRepository(repoClient4, repoClient6, log.Named("network_test"))
|
||||
repo.NetworkTest(true)
|
||||
}
|
||||
|
||||
func ClearDownloads() {
|
||||
|
||||
Reference in New Issue
Block a user