mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-12-24 12:37:53 +08:00
fix: 修复PING值测试的过滤条件
This commit is contained in:
4
go.mod
4
go.mod
@@ -14,10 +14,10 @@ require (
|
||||
github.com/oneclickvirt/gostun v0.0.5-20250727155022
|
||||
github.com/oneclickvirt/memorytest v0.0.10-20250924154648
|
||||
github.com/oneclickvirt/nt3 v0.0.9-20251031045617
|
||||
github.com/oneclickvirt/pingtest v0.0.9-20251102142946
|
||||
github.com/oneclickvirt/pingtest v0.0.9-20251102150730
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250728015900
|
||||
github.com/oneclickvirt/security v0.0.7-20251030094114
|
||||
github.com/oneclickvirt/speedtest v0.0.10-20250728015734
|
||||
github.com/oneclickvirt/speedtest v0.0.11-20251102151740
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
8
go.sum
8
go.sum
@@ -120,14 +120,14 @@ github.com/oneclickvirt/memorytest v0.0.10-20250924154648 h1:trk6oZ7xs1eVtr+6oIv
|
||||
github.com/oneclickvirt/memorytest v0.0.10-20250924154648/go.mod h1:4kiHsEWkW9r3/1ZcV5xIweU0smiKP0IRfQj74AUIiVI=
|
||||
github.com/oneclickvirt/nt3 v0.0.9-20251031045617 h1:g42R4kwOL4s6sDsG+axEXJsI82pldv42HLMYCDFypNg=
|
||||
github.com/oneclickvirt/nt3 v0.0.9-20251031045617/go.mod h1:yo1ufkduFt9QjqG7nqSUf1D3YlQOmFpdlTYniJfclQI=
|
||||
github.com/oneclickvirt/pingtest v0.0.9-20251102142946 h1:Brgvrdtg/4fE8D44+w953Tr8RQNvhyzsNL1ltH1a3dM=
|
||||
github.com/oneclickvirt/pingtest v0.0.9-20251102142946/go.mod h1:gxwsxxwitNQiGq2OI0ZogYoOLwc8DtuOdSRe6/EvRqs=
|
||||
github.com/oneclickvirt/pingtest v0.0.9-20251102150730 h1:pipqyJUaUI0K5waFvDNNfqbIikMp+9Kg8Dw/kLEUYF8=
|
||||
github.com/oneclickvirt/pingtest v0.0.9-20251102150730/go.mod h1:gxwsxxwitNQiGq2OI0ZogYoOLwc8DtuOdSRe6/EvRqs=
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250728015900 h1:AomzdppSOFB70AJESQhlp0IPbsHTTJGimAWDk2TzCWM=
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250728015900/go.mod h1:9sjMDPCd4Z40wkYB0S9gQPGH8YPtnNE1ZJthVIuHUzA=
|
||||
github.com/oneclickvirt/security v0.0.7-20251030094114 h1:Ax8J1TYqprXyiWNAIJJ3xhoyGhvBlKw4m9j6va5Q2nM=
|
||||
github.com/oneclickvirt/security v0.0.7-20251030094114/go.mod h1:YfDilPFW22szjdUNgv4VOuSwHnZzsFsdPOfRYiMoc3I=
|
||||
github.com/oneclickvirt/speedtest v0.0.10-20250728015734 h1:HKO7/JQ74ueXA8Wo8NIvcK9DphbEG/YTfAAVz/akSiY=
|
||||
github.com/oneclickvirt/speedtest v0.0.10-20250728015734/go.mod h1:0W8vnMbA3iucXLXFdGfe9Ia6RPS0izRO7jvu/SnH1P8=
|
||||
github.com/oneclickvirt/speedtest v0.0.11-20251102151740 h1:1NUrNt5ay6/xVNC5x62UrQjPqK8jgbKtyjBml/3boZg=
|
||||
github.com/oneclickvirt/speedtest v0.0.11-20251102151740/go.mod h1:fy0II2Wo7kDWVBKTwcHdodZwyfmJo0g8N9V02EwQDZE=
|
||||
github.com/oneclickvirt/stream v0.0.2-20250924154001 h1:GuJWdiPkoK84+y/+oHKr2Ghl3c/MzS9Z5m1nM+lMmy4=
|
||||
github.com/oneclickvirt/stream v0.0.2-20250924154001/go.mod h1:oWaizaHTC2VQciBC9RfaLbAOf8qeR6n20/gY7QxriDE=
|
||||
github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE=
|
||||
|
||||
54
goecs.go
54
goecs.go
@@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ecsVersion = "v0.1.94"
|
||||
ecsVersion = "v0.1.95"
|
||||
menuMode bool
|
||||
onlyChinaTest bool
|
||||
input, choice string
|
||||
@@ -312,11 +312,11 @@ func printMenuOptions(preCheck utils.NetCheckResult) {
|
||||
fmt.Println("3. 精简版(系统信息+CPU+内存+磁盘+常用流媒体+路由+测速节点5个)")
|
||||
fmt.Println("4. 精简网络版(系统信息+CPU+内存+磁盘+回程+路由+测速节点5个)")
|
||||
fmt.Println("5. 精简解锁版(系统信息+CPU+内存+磁盘IO+御三家+常用流媒体+测速节点5个)")
|
||||
fmt.Println("6. 网络单项(IP质量检测+上游及三网回程+广州三网回程详细路由+全国延迟+TGDC+网站+测速节点11个)")
|
||||
fmt.Println("6. 网络单项(IP质量检测+上游及三网回程+广州三网回程详细路由+全国延迟+TGDC+网站延迟+测速节点11个)")
|
||||
fmt.Println("7. 解锁单项(御三家解锁+常用流媒体解锁)")
|
||||
fmt.Println("8. 硬件单项(系统信息+CPU+dd磁盘测试+fio磁盘测试)")
|
||||
fmt.Println("9. IP质量检测(15个数据库的IP质量检测+邮件端口检测)")
|
||||
fmt.Println("10. 三网回程线路检测+三网回程详细路由(北京上海广州成都)+三网延迟测试(全国)+TGDC+网站测试")
|
||||
fmt.Println("10. 三网回程线路检测+三网回程详细路由(北京上海广州成都)+全国延迟+TGDC+网站延迟")
|
||||
fmt.Println("0. 退出程序")
|
||||
case "en":
|
||||
fmt.Printf("VPS Fusion Monster Test Version: %s\n", ecsVersion)
|
||||
@@ -353,6 +353,8 @@ func setFullTestStatus(preCheck utils.NetCheckResult) {
|
||||
backtraceStatus = true
|
||||
nt3Status = true
|
||||
speedTestStatus = true
|
||||
tgdcTestStatus = true
|
||||
webTestStatus = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +583,7 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGrou
|
||||
*output = appendTimeInfo(*output, tempOutput, startTime, outputMutex)
|
||||
}
|
||||
|
||||
func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo *string, output *string, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) {
|
||||
func runEnglishTests(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 = runCPUTest(*output, tempOutput, outputMutex)
|
||||
*output = runMemoryTest(*output, tempOutput, outputMutex)
|
||||
@@ -604,10 +606,17 @@ func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, ba
|
||||
*emailInfo = email.EmailCheck()
|
||||
}()
|
||||
}
|
||||
if pingTestStatus {
|
||||
wg3.Add(1)
|
||||
go func() {
|
||||
defer wg3.Done()
|
||||
*ptInfo = pt.PingTest()
|
||||
}()
|
||||
}
|
||||
*output = runStreamingTests(wg1, mediaInfo, *output, tempOutput, outputMutex)
|
||||
*output = runSecurityTests(*securityInfo, *output, tempOutput, outputMutex)
|
||||
*output = runEmailTests(wg2, emailInfo, *output, tempOutput, outputMutex)
|
||||
*output = runEnglishNetworkTests(*output, tempOutput, outputMutex)
|
||||
*output = runEnglishNetworkTests(wg3, ptInfo, *output, tempOutput, outputMutex)
|
||||
*output = runEnglishSpeedTests(*output, tempOutput, outputMutex)
|
||||
}
|
||||
*output = appendTimeInfo(*output, tempOutput, startTime, outputMutex)
|
||||
@@ -798,10 +807,27 @@ func runNetworkTests(wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput str
|
||||
utils.PrintCenteredTitle("三网回程路由检测", width)
|
||||
nexttrace.NextTrace3Check(language, nt3Location, nt3CheckType) // 不能在重定向的同时外部并发,此处仅可以顺序执行
|
||||
}
|
||||
if (onlyChinaTest || pingTestStatus) && *ptInfo != "" {
|
||||
// 中国模式:显示三网 PING 测试
|
||||
if onlyChinaTest && *ptInfo != "" {
|
||||
wg3.Wait()
|
||||
utils.PrintCenteredTitle("PING值检测", width)
|
||||
fmt.Println(*ptInfo)
|
||||
}
|
||||
// 选项 6/10:显示三网 PING + TGDC + 网站
|
||||
if pingTestStatus && *ptInfo != "" {
|
||||
wg3.Wait()
|
||||
utils.PrintCenteredTitle("PING值检测", width)
|
||||
fmt.Println(*ptInfo)
|
||||
if tgdcTestStatus {
|
||||
fmt.Println(pt.TelegramDCTest())
|
||||
}
|
||||
if webTestStatus {
|
||||
fmt.Println(pt.WebsiteTest())
|
||||
}
|
||||
}
|
||||
// 非中国模式且非 pingTestStatus:只显示 TGDC + 网站(选项 1 的情况)
|
||||
if !onlyChinaTest && !pingTestStatus && (tgdcTestStatus || webTestStatus) {
|
||||
utils.PrintCenteredTitle("PING值检测", width)
|
||||
if tgdcTestStatus {
|
||||
fmt.Println(pt.TelegramDCTest())
|
||||
}
|
||||
@@ -834,15 +860,25 @@ func runSpeedTests(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
}, tempOutput, output)
|
||||
}
|
||||
|
||||
func runEnglishNetworkTests(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
func runEnglishNetworkTests(wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
outputMutex.Lock()
|
||||
defer outputMutex.Unlock()
|
||||
return utils.PrintAndCapture(func() {
|
||||
utils.PrintCenteredTitle("PING-Test", width)
|
||||
if pingTestStatus && *ptInfo != "" {
|
||||
wg3.Wait()
|
||||
utils.PrintCenteredTitle("PING-Test", width)
|
||||
fmt.Println(*ptInfo)
|
||||
}
|
||||
if tgdcTestStatus {
|
||||
if !pingTestStatus || *ptInfo == "" {
|
||||
utils.PrintCenteredTitle("PING-Test", width)
|
||||
}
|
||||
fmt.Println(pt.TelegramDCTest())
|
||||
}
|
||||
if webTestStatus {
|
||||
if !pingTestStatus && !tgdcTestStatus {
|
||||
utils.PrintCenteredTitle("PING-Test", width)
|
||||
}
|
||||
fmt.Println(pt.WebsiteTest())
|
||||
}
|
||||
}, tempOutput, output)
|
||||
@@ -931,7 +967,7 @@ func main() {
|
||||
case "zh":
|
||||
runChineseTests(preCheck, &wg1, &wg2, &wg3, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, &output, tempOutput, startTime, &outputMutex)
|
||||
case "en":
|
||||
runEnglishTests(preCheck, &wg1, &wg2, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &output, tempOutput, startTime, &outputMutex)
|
||||
runEnglishTests(preCheck, &wg1, &wg2, &wg3, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, &output, tempOutput, startTime, &outputMutex)
|
||||
default:
|
||||
fmt.Println("Unsupported language")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user