mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-10-01 05:32:18 +08:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7339f0336c | ||
![]() |
54bbe16563 |
48
goecs.go
48
goecs.go
@@ -39,7 +39,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ecsVersion = "v0.1.54"
|
ecsVersion = "v0.1.55"
|
||||||
menuMode bool
|
menuMode bool
|
||||||
onlyChinaTest bool
|
onlyChinaTest bool
|
||||||
input, choice string
|
input, choice string
|
||||||
@@ -462,11 +462,11 @@ func handleSignalInterrupt(sig chan os.Signal, startTime *time.Time, output *str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo *string, output, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) string {
|
func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo *string, output *string, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) {
|
||||||
output = runBasicTests(preCheck, basicInfo, securityInfo, output, tempOutput, outputMutex)
|
*output = runBasicTests(preCheck, basicInfo, securityInfo, *output, tempOutput, outputMutex)
|
||||||
output = runCPUTest(output, tempOutput, outputMutex)
|
*output = runCPUTest(*output, tempOutput, outputMutex)
|
||||||
output = runMemoryTest(output, tempOutput, outputMutex)
|
*output = runMemoryTest(*output, tempOutput, outputMutex)
|
||||||
output = runDiskTest(output, tempOutput, outputMutex)
|
*output = runDiskTest(*output, tempOutput, outputMutex)
|
||||||
if (onlyChinaTest || pingTestStatus) && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
if (onlyChinaTest || pingTestStatus) && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||||
wg3.Add(1)
|
wg3.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
@@ -489,24 +489,24 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGrou
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
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 = 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" {
|
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" {
|
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||||
output = runSpeedTests(output, tempOutput, outputMutex)
|
*output = runSpeedTests(*output, tempOutput, outputMutex)
|
||||||
}
|
}
|
||||||
return appendTimeInfo(output, tempOutput, startTime, outputMutex)
|
*output = appendTimeInfo(*output, tempOutput, startTime, outputMutex)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo *string, output, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) string {
|
func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo *string, output *string, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) {
|
||||||
output = runBasicTests(preCheck, basicInfo, securityInfo, output, tempOutput, outputMutex)
|
*output = runBasicTests(preCheck, basicInfo, securityInfo, *output, tempOutput, outputMutex)
|
||||||
output = runCPUTest(output, tempOutput, outputMutex)
|
*output = runCPUTest(*output, tempOutput, outputMutex)
|
||||||
output = runMemoryTest(output, tempOutput, outputMutex)
|
*output = runMemoryTest(*output, tempOutput, outputMutex)
|
||||||
output = runDiskTest(output, tempOutput, outputMutex)
|
*output = runDiskTest(*output, tempOutput, outputMutex)
|
||||||
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||||
if utTestStatus {
|
if utTestStatus {
|
||||||
wg1.Add(1)
|
wg1.Add(1)
|
||||||
@@ -522,12 +522,12 @@ func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, ba
|
|||||||
*emailInfo = email.EmailCheck()
|
*emailInfo = email.EmailCheck()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
output = runStreamingTests(wg1, mediaInfo, output, tempOutput, outputMutex) // 传递指针
|
*output = runStreamingTests(wg1, mediaInfo, *output, tempOutput, outputMutex)
|
||||||
output = runSecurityTests(*securityInfo, 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)
|
*output = runEnglishSpeedTests(*output, tempOutput, outputMutex)
|
||||||
}
|
}
|
||||||
return appendTimeInfo(output, tempOutput, startTime, outputMutex)
|
*output = appendTimeInfo(*output, tempOutput, startTime, outputMutex)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runBasicTests(preCheck utils.NetCheckResult, basicInfo, securityInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
func runBasicTests(preCheck utils.NetCheckResult, basicInfo, securityInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||||
@@ -810,9 +810,9 @@ func main() {
|
|||||||
go handleSignalInterrupt(sig, &startTime, &output, tempOutput, uploadDone, &outputMutex)
|
go handleSignalInterrupt(sig, &startTime, &output, tempOutput, uploadDone, &outputMutex)
|
||||||
switch language {
|
switch language {
|
||||||
case "zh":
|
case "zh":
|
||||||
output = runChineseTests(preCheck, &wg1, &wg2, &wg3, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, output, tempOutput, startTime, &outputMutex)
|
runChineseTests(preCheck, &wg1, &wg2, &wg3, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, &output, tempOutput, startTime, &outputMutex)
|
||||||
case "en":
|
case "en":
|
||||||
output = runEnglishTests(preCheck, &wg1, &wg2, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, output, tempOutput, startTime, &outputMutex)
|
runEnglishTests(preCheck, &wg1, &wg2, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &output, tempOutput, startTime, &outputMutex)
|
||||||
default:
|
default:
|
||||||
fmt.Println("Unsupported language")
|
fmt.Println("Unsupported language")
|
||||||
}
|
}
|
||||||
|
6
goecs.sh
6
goecs.sh
@@ -143,7 +143,7 @@ goecs_check() {
|
|||||||
os=$(uname -s 2>/dev/null || echo "Unknown")
|
os=$(uname -s 2>/dev/null || echo "Unknown")
|
||||||
arch=$(uname -m 2>/dev/null || echo "Unknown")
|
arch=$(uname -m 2>/dev/null || echo "Unknown")
|
||||||
check_china
|
check_china
|
||||||
ECS_VERSION="0.1.53"
|
ECS_VERSION="0.1.54"
|
||||||
for api in \
|
for api in \
|
||||||
"https://api.github.com/repos/oneclickvirt/ecs/releases/latest" \
|
"https://api.github.com/repos/oneclickvirt/ecs/releases/latest" \
|
||||||
"https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" \
|
"https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" \
|
||||||
@@ -155,8 +155,8 @@ goecs_check() {
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
if [ -z "$ECS_VERSION" ]; then
|
if [ -z "$ECS_VERSION" ]; then
|
||||||
_yellow "Unable to get version info, using default version 0.1.53"
|
_yellow "Unable to get version info, using default version 0.1.54"
|
||||||
ECS_VERSION="0.1.53"
|
ECS_VERSION="0.1.54"
|
||||||
fi
|
fi
|
||||||
version_output=""
|
version_output=""
|
||||||
for cmd_path in "goecs" "./goecs" "/usr/bin/goecs" "/usr/local/bin/goecs"; do
|
for cmd_path in "goecs" "./goecs" "/usr/bin/goecs" "/usr/local/bin/goecs"; do
|
||||||
|
Reference in New Issue
Block a user