mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-28 04:02:12 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c81ebb3c7a | ||
![]() |
7896b3ead5 | ||
![]() |
eb98a7b857 | ||
![]() |
d4d86229de |
32
goecs.go
32
goecs.go
@@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ecsVersion = "v0.1.41"
|
||||
ecsVersion = "v0.1.43"
|
||||
menuMode bool
|
||||
onlyChinaTest bool
|
||||
input, choice string
|
||||
@@ -470,7 +470,7 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGrou
|
||||
*emailInfo = email.EmailCheck()
|
||||
}()
|
||||
}
|
||||
if utTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||
if utTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" && !onlyChinaTest {
|
||||
wg1.Add(1)
|
||||
go func() {
|
||||
defer wg1.Done()
|
||||
@@ -478,12 +478,12 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGrou
|
||||
}()
|
||||
}
|
||||
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||
output = runStreamingTests(wg1, *mediaInfo, output, tempOutput, outputMutex)
|
||||
output = runStreamingTests(wg1, mediaInfo, output, tempOutput, outputMutex)
|
||||
output = runSecurityTests(*securityInfo, output, tempOutput, outputMutex)
|
||||
output = runEmailTests(wg2, *emailInfo, output, tempOutput, outputMutex)
|
||||
output = runEmailTests(wg2, emailInfo, output, tempOutput, outputMutex)
|
||||
}
|
||||
if runtime.GOOS != "windows" && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||
output = runNetworkTests(wg3, *ptInfo, output, tempOutput, outputMutex)
|
||||
output = runNetworkTests(wg3, ptInfo, output, tempOutput, outputMutex)
|
||||
}
|
||||
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||
output = runSpeedTests(output, tempOutput, outputMutex)
|
||||
@@ -511,9 +511,9 @@ func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, ba
|
||||
*emailInfo = email.EmailCheck()
|
||||
}()
|
||||
}
|
||||
output = runStreamingTests(wg1, *mediaInfo, output, tempOutput, outputMutex)
|
||||
output = runStreamingTests(wg1, mediaInfo, output, tempOutput, outputMutex) // 传递指针
|
||||
output = runSecurityTests(*securityInfo, output, tempOutput, outputMutex)
|
||||
output = runEmailTests(wg2, *emailInfo, output, tempOutput, outputMutex)
|
||||
output = runEmailTests(wg2, emailInfo, output, tempOutput, outputMutex)
|
||||
output = runEnglishSpeedTests(output, tempOutput, outputMutex)
|
||||
}
|
||||
return appendTimeInfo(output, tempOutput, startTime, outputMutex)
|
||||
@@ -606,7 +606,7 @@ func runDiskTest(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
}, tempOutput, output)
|
||||
}
|
||||
|
||||
func runStreamingTests(wg1 *sync.WaitGroup, mediaInfo string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
func runStreamingTests(wg1 *sync.WaitGroup, mediaInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
return utils.PrintAndCapture(func() {
|
||||
if language == "zh" {
|
||||
if commTestStatus && !onlyChinaTest {
|
||||
@@ -621,9 +621,7 @@ func runStreamingTests(wg1 *sync.WaitGroup, mediaInfo string, output, tempOutput
|
||||
} else {
|
||||
utils.PrintCenteredTitle("Cross-Border-Streaming-Media-Unlock", width)
|
||||
}
|
||||
fmt.Printf("%s", mediaInfo)
|
||||
} else {
|
||||
wg1.Wait()
|
||||
fmt.Printf("%s", *mediaInfo)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
}
|
||||
@@ -641,7 +639,7 @@ func runSecurityTests(securityInfo, output, tempOutput string, outputMutex *sync
|
||||
}, tempOutput, output)
|
||||
}
|
||||
|
||||
func runEmailTests(wg2 *sync.WaitGroup, emailInfo string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
func runEmailTests(wg2 *sync.WaitGroup, emailInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
return utils.PrintAndCapture(func() {
|
||||
if emailTestStatus {
|
||||
wg2.Wait()
|
||||
@@ -650,14 +648,12 @@ func runEmailTests(wg2 *sync.WaitGroup, emailInfo string, output, tempOutput str
|
||||
} else {
|
||||
utils.PrintCenteredTitle("Email-Port-Check", width)
|
||||
}
|
||||
fmt.Println(emailInfo)
|
||||
} else {
|
||||
wg2.Wait()
|
||||
fmt.Println(*emailInfo)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
}
|
||||
|
||||
func runNetworkTests(wg3 *sync.WaitGroup, ptInfo string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
func runNetworkTests(wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if backtraceStatus && !onlyChinaTest {
|
||||
utils.PrintCenteredTitle("三网回程线路检测", width)
|
||||
@@ -678,9 +674,7 @@ func runNetworkTests(wg3 *sync.WaitGroup, ptInfo string, output, tempOutput stri
|
||||
if onlyChinaTest || pingTestStatus {
|
||||
wg3.Wait()
|
||||
utils.PrintCenteredTitle("三网ICMP的PING值检测", width)
|
||||
fmt.Println(ptInfo)
|
||||
} else {
|
||||
wg3.Wait()
|
||||
fmt.Println(*ptInfo)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
}
|
||||
|
6
goecs.sh
6
goecs.sh
@@ -143,7 +143,7 @@ goecs_check() {
|
||||
os=$(uname -s 2>/dev/null || echo "Unknown")
|
||||
arch=$(uname -m 2>/dev/null || echo "Unknown")
|
||||
check_china
|
||||
ECS_VERSION="0.1.40"
|
||||
ECS_VERSION="0.1.42"
|
||||
for api in \
|
||||
"https://api.github.com/repos/oneclickvirt/ecs/releases/latest" \
|
||||
"https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" \
|
||||
@@ -155,8 +155,8 @@ goecs_check() {
|
||||
sleep 1
|
||||
done
|
||||
if [ -z "$ECS_VERSION" ]; then
|
||||
_yellow "Unable to get version info, using default version 0.1.40"
|
||||
ECS_VERSION="0.1.40"
|
||||
_yellow "Unable to get version info, using default version 0.1.42"
|
||||
ECS_VERSION="0.1.42"
|
||||
fi
|
||||
version_output=""
|
||||
for cmd_path in "goecs" "./goecs" "/usr/bin/goecs" "/usr/local/bin/goecs"; do
|
||||
|
Reference in New Issue
Block a user