feat: 详细三网路由测试支持并发测试,大幅缩短测试所需时间

This commit is contained in:
spiritlhl
2025-08-11 10:53:48 +00:00
parent 53296b745a
commit 4132b1daff
3 changed files with 36 additions and 4 deletions

2
go.mod
View File

@@ -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.7-20250805133514
github.com/oneclickvirt/nt3 v0.0.8-20250810151538
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
View File

@@ -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.7-20250805133514 h1:PeDFYMaqO3nH8dVNHek1HtjxBYVli1R5Rtd/5uFOSN0=
github.com/oneclickvirt/nt3 v0.0.7-20250805133514/go.mod h1:O7YkaOMFihB8hwQiD74WTbDlyoTieDwTDBR6jbkZaP0=
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/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=

View File

@@ -783,7 +783,39 @@ func runNetworkTests(wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput str
output = utils.PrintAndCapture(func() {
if nt3Status && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程路由检测", width)
nt.TraceRoute(language, nt3Location, nt3CheckType)
resultChan := make(chan nt.TraceResult, 100)
go nt.TraceRoute(language, nt3Location, nt3CheckType, resultChan)
for result := range resultChan {
if result.Index == -1 {
for index, res := range result.Output {
res = strings.TrimSpace(res)
if res != "" && index == 0 {
fmt.Println(res)
}
}
continue
}
if result.ISPName == "Error" {
for _, res := range result.Output {
res = strings.TrimSpace(res)
if res != "" {
fmt.Println(res)
}
}
return
}
for _, res := range result.Output {
res = strings.TrimSpace(res)
if res == "" {
continue
}
if strings.Contains(res, "ICMP") {
fmt.Print(res)
} else {
fmt.Println(res)
}
}
}
}
}, tempOutput, output)
return utils.PrintAndCapture(func() {