mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-27 11:42:23 +08:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5d2f3c7f96 | ||
![]() |
61247a206e | ||
![]() |
f0daad1360 | ||
![]() |
2d23fb55a0 | ||
![]() |
a73dbf2d0b | ||
![]() |
b38dd713d9 | ||
![]() |
e66ef1f106 |
2
go.mod
2
go.mod
@@ -13,7 +13,7 @@ require (
|
||||
github.com/oneclickvirt/disktest v0.0.10-20250808140407
|
||||
github.com/oneclickvirt/gostun v0.0.5-20250727155022
|
||||
github.com/oneclickvirt/memorytest v0.0.9-20250808065154
|
||||
github.com/oneclickvirt/nt3 v0.0.8-20250810151538
|
||||
github.com/oneclickvirt/nt3 v0.0.8-20250811123903
|
||||
github.com/oneclickvirt/pingtest v0.0.8-20250728015259
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250728015900
|
||||
github.com/oneclickvirt/security v0.0.6-20250805090112
|
||||
|
4
go.sum
4
go.sum
@@ -118,8 +118,8 @@ github.com/oneclickvirt/mbw v0.0.1-20250808061222 h1:WGXOe6QvHiDRhPVMI0VcctjzW08
|
||||
github.com/oneclickvirt/mbw v0.0.1-20250808061222/go.mod h1:0Vq6NRpyLmGUdfHfL3uDcFsuZhi7KlG+OCs5ky2757Y=
|
||||
github.com/oneclickvirt/memorytest v0.0.9-20250808065154 h1:mjYOvpFz2mpDU9MNjj66oIDcc2r6+zoW8veP616/+4Q=
|
||||
github.com/oneclickvirt/memorytest v0.0.9-20250808065154/go.mod h1:DBxiVZX7mWCe0Fy+qu57ENheLo00sLfjKzvxiICrUtU=
|
||||
github.com/oneclickvirt/nt3 v0.0.8-20250810151538 h1:pXxtvTwTFWAh/+Hz89wDat42CFjqNdlFyASPRxSdE5g=
|
||||
github.com/oneclickvirt/nt3 v0.0.8-20250810151538/go.mod h1:F1v+6xInBKnbUa8gV1M40R1HOzxg+obtduNhx3CTnmA=
|
||||
github.com/oneclickvirt/nt3 v0.0.8-20250811123903 h1:ubSPLh/DSrXj+tOgmRABgi2vrVmbmjjSne+NrVFNmNc=
|
||||
github.com/oneclickvirt/nt3 v0.0.8-20250811123903/go.mod h1:F1v+6xInBKnbUa8gV1M40R1HOzxg+obtduNhx3CTnmA=
|
||||
github.com/oneclickvirt/pingtest v0.0.8-20250728015259 h1:egoxZRZBOWN3JqBwqEsULDyRo2/dpGMeWcmV3U87zig=
|
||||
github.com/oneclickvirt/pingtest v0.0.8-20250728015259/go.mod h1:gxwsxxwitNQiGq2OI0ZogYoOLwc8DtuOdSRe6/EvRqs=
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250728015900 h1:AomzdppSOFB70AJESQhlp0IPbsHTTJGimAWDk2TzCWM=
|
||||
|
44
goecs.go
44
goecs.go
@@ -40,7 +40,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ecsVersion = "v0.1.77"
|
||||
ecsVersion = "v0.1.81"
|
||||
menuMode bool
|
||||
onlyChinaTest bool
|
||||
input, choice string
|
||||
@@ -100,7 +100,7 @@ func getMenuChoice(language string) string {
|
||||
if re.MatchString(input) {
|
||||
inChoice := input
|
||||
switch inChoice {
|
||||
case "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
|
||||
case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
|
||||
return inChoice
|
||||
default:
|
||||
if language == "zh" {
|
||||
@@ -546,7 +546,7 @@ func handleSignalInterrupt(sig chan os.Signal, startTime *time.Time, output *str
|
||||
}
|
||||
}
|
||||
|
||||
func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3, wg4, wg5 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo *string, output *string, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) {
|
||||
func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3, wg4 *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 = runCPUTest(*output, tempOutput, outputMutex)
|
||||
*output = runMemoryTest(*output, tempOutput, outputMutex)
|
||||
@@ -554,7 +554,7 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3, wg4, wg5 *syn
|
||||
if onlyIpInfoCheckStatus && !basicStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||
*output = runIpInfoCheck(*output, tempOutput, outputMutex)
|
||||
}
|
||||
var backtraceInfo, nt3Info string
|
||||
var backtraceInfo string
|
||||
if utTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" && !onlyChinaTest {
|
||||
wg1.Add(1)
|
||||
go func() {
|
||||
@@ -582,21 +582,10 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3, wg4, wg5 *syn
|
||||
go func() {
|
||||
defer wg4.Done()
|
||||
backtraceInfo = utils.PrintAndCapture(func() {
|
||||
utils.PrintCenteredTitle("上游及回程线路检测", width)
|
||||
upstreams.UpstreamsCheck()
|
||||
}, "", "")
|
||||
}()
|
||||
}
|
||||
if nt3Status && !onlyChinaTest {
|
||||
wg5.Add(1)
|
||||
go func() {
|
||||
defer wg5.Done()
|
||||
nt3Info = utils.PrintAndCapture(func() {
|
||||
utils.PrintCenteredTitle("三网回程路由检测", width)
|
||||
nexttrace.NextTrace3Check(language, nt3Location, nt3CheckType)
|
||||
}, "", "")
|
||||
}()
|
||||
}
|
||||
}
|
||||
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||
*output = runStreamingTests(wg1, mediaInfo, *output, tempOutput, outputMutex)
|
||||
@@ -604,7 +593,7 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3, wg4, wg5 *syn
|
||||
*output = runEmailTests(wg2, emailInfo, *output, tempOutput, outputMutex)
|
||||
}
|
||||
if runtime.GOOS != "windows" && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||
*output = runNetworkTests(wg3, wg4, wg5, ptInfo, &backtraceInfo, &nt3Info, *output, tempOutput, outputMutex)
|
||||
*output = runNetworkTests(wg3, wg4, ptInfo, &backtraceInfo, *output, tempOutput, outputMutex)
|
||||
}
|
||||
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
|
||||
*output = runSpeedTests(*output, tempOutput, outputMutex)
|
||||
@@ -816,23 +805,24 @@ func runEmailTests(wg2 *sync.WaitGroup, emailInfo *string, output, tempOutput st
|
||||
}, tempOutput, output)
|
||||
}
|
||||
|
||||
func runNetworkTests(wg3, wg4, wg5 *sync.WaitGroup, ptInfo, backtraceInfo, nt3Info *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
func runNetworkTests(wg3, wg4 *sync.WaitGroup, ptInfo, backtraceInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
outputMutex.Lock()
|
||||
defer outputMutex.Unlock()
|
||||
return utils.PrintAndCapture(func() {
|
||||
if backtraceStatus && !onlyChinaTest && *backtraceInfo != "" {
|
||||
if wg4 != nil {
|
||||
wg4.Wait()
|
||||
}
|
||||
if wg5 != nil {
|
||||
wg5.Wait()
|
||||
}
|
||||
return utils.PrintAndCapture(func() {
|
||||
if backtraceStatus && !onlyChinaTest && *backtraceInfo != "" {
|
||||
utils.PrintCenteredTitle("上游及回程线路检测", width)
|
||||
fmt.Print(*backtraceInfo)
|
||||
}
|
||||
if nt3Status && !onlyChinaTest && *nt3Info != "" {
|
||||
fmt.Print(*nt3Info)
|
||||
if nt3Status && !onlyChinaTest {
|
||||
utils.PrintCenteredTitle("三网回程路由检测", width)
|
||||
utils.PrintAndCapture(func() {
|
||||
nexttrace.NextTrace3Check(language, nt3Location, nt3CheckType) // 不能在重定向的同时外部并发,此处仅可以顺序执行
|
||||
}, "", "")
|
||||
}
|
||||
if onlyChinaTest || pingTestStatus {
|
||||
if (onlyChinaTest || pingTestStatus) && *ptInfo != "" {
|
||||
wg3.Wait()
|
||||
utils.PrintCenteredTitle("三网ICMP的PING值检测", width)
|
||||
fmt.Println(*ptInfo)
|
||||
@@ -929,7 +919,7 @@ func main() {
|
||||
enabelUpload = false
|
||||
}
|
||||
var (
|
||||
wg1, wg2, wg3, wg4, wg5 sync.WaitGroup
|
||||
wg1, wg2, wg3, wg4 sync.WaitGroup
|
||||
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
|
||||
output, tempOutput string
|
||||
outputMutex sync.Mutex
|
||||
@@ -941,7 +931,7 @@ func main() {
|
||||
go handleSignalInterrupt(sig, &startTime, &output, tempOutput, uploadDone, &outputMutex)
|
||||
switch language {
|
||||
case "zh":
|
||||
runChineseTests(preCheck, &wg1, &wg2, &wg3, &wg4, &wg5, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, &output, tempOutput, startTime, &outputMutex)
|
||||
runChineseTests(preCheck, &wg1, &wg2, &wg3, &wg4, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, &output, tempOutput, startTime, &outputMutex)
|
||||
case "en":
|
||||
runEnglishTests(preCheck, &wg1, &wg2, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &output, tempOutput, startTime, &outputMutex)
|
||||
default:
|
||||
|
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.76"
|
||||
ECS_VERSION="0.1.79"
|
||||
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.76"
|
||||
ECS_VERSION="0.1.76"
|
||||
_yellow "Unable to get version info, using default version 0.1.79"
|
||||
ECS_VERSION="0.1.79"
|
||||
fi
|
||||
version_output=""
|
||||
for cmd_path in "goecs" "./goecs" "/usr/bin/goecs" "/usr/local/bin/goecs"; do
|
||||
|
Reference in New Issue
Block a user