Compare commits

..

4 Commits

Author SHA1 Message Date
spiritlhl
c81ebb3c7a fix: 异步函数传值需要指针传递,值传递可能会出现同步问题 2025-06-29 08:45:15 +00:00
github-actions[bot]
7896b3ead5 chore: update ECS_VERSION to 0.1.42 in goecs.sh 2025-06-29 08:33:10 +00:00
spiritlhl
eb98a7b857 fix: 更加严格的启动条件,同时避免死锁等待 2025-06-29 08:29:24 +00:00
github-actions[bot]
d4d86229de chore: update ECS_VERSION to 0.1.41 in goecs.sh 2025-06-29 07:59:30 +00:00
2 changed files with 16 additions and 22 deletions

View File

@@ -39,7 +39,7 @@ import (
) )
var ( var (
ecsVersion = "v0.1.41" ecsVersion = "v0.1.43"
menuMode bool menuMode bool
onlyChinaTest bool onlyChinaTest bool
input, choice string input, choice string
@@ -470,7 +470,7 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGrou
*emailInfo = email.EmailCheck() *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) wg1.Add(1)
go func() { go func() {
defer wg1.Done() 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" { 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)
@@ -511,9 +511,9 @@ 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) return appendTimeInfo(output, tempOutput, startTime, outputMutex)
@@ -606,7 +606,7 @@ func runDiskTest(output, tempOutput string, outputMutex *sync.Mutex) string {
}, tempOutput, output) }, 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() { return utils.PrintAndCapture(func() {
if language == "zh" { if language == "zh" {
if commTestStatus && !onlyChinaTest { if commTestStatus && !onlyChinaTest {
@@ -621,9 +621,7 @@ func runStreamingTests(wg1 *sync.WaitGroup, mediaInfo string, output, tempOutput
} else { } else {
utils.PrintCenteredTitle("Cross-Border-Streaming-Media-Unlock", width) utils.PrintCenteredTitle("Cross-Border-Streaming-Media-Unlock", width)
} }
fmt.Printf("%s", mediaInfo) fmt.Printf("%s", *mediaInfo)
} else {
wg1.Wait()
} }
}, tempOutput, output) }, tempOutput, output)
} }
@@ -641,7 +639,7 @@ func runSecurityTests(securityInfo, output, tempOutput string, outputMutex *sync
}, tempOutput, output) }, 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() { return utils.PrintAndCapture(func() {
if emailTestStatus { if emailTestStatus {
wg2.Wait() wg2.Wait()
@@ -650,14 +648,12 @@ func runEmailTests(wg2 *sync.WaitGroup, emailInfo string, output, tempOutput str
} else { } else {
utils.PrintCenteredTitle("Email-Port-Check", width) utils.PrintCenteredTitle("Email-Port-Check", width)
} }
fmt.Println(emailInfo) fmt.Println(*emailInfo)
} else {
wg2.Wait()
} }
}, tempOutput, output) }, 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() { output = utils.PrintAndCapture(func() {
if backtraceStatus && !onlyChinaTest { if backtraceStatus && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程线路检测", width) utils.PrintCenteredTitle("三网回程线路检测", width)
@@ -678,9 +674,7 @@ func runNetworkTests(wg3 *sync.WaitGroup, ptInfo string, output, tempOutput stri
if onlyChinaTest || pingTestStatus { if onlyChinaTest || pingTestStatus {
wg3.Wait() wg3.Wait()
utils.PrintCenteredTitle("三网ICMP的PING值检测", width) utils.PrintCenteredTitle("三网ICMP的PING值检测", width)
fmt.Println(ptInfo) fmt.Println(*ptInfo)
} else {
wg3.Wait()
} }
}, tempOutput, output) }, tempOutput, output)
} }

View File

@@ -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.40" ECS_VERSION="0.1.42"
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.40" _yellow "Unable to get version info, using default version 0.1.42"
ECS_VERSION="0.1.40" ECS_VERSION="0.1.42"
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