Compare commits

...

2 Commits

Author SHA1 Message Date
spiritlhl
73b0f30ddc fix: 删除无效文件,去除无效重定向 2025-08-11 13:31:18 +00:00
spiritlhl
825da78bd5 fix: 外部重定向已捕捉无需重复捕捉 2025-08-11 13:16:46 +00:00
5 changed files with 9 additions and 74 deletions

View File

@@ -1,9 +0,0 @@
package backtrace
import (
"github.com/oneclickvirt/backtrace/bk"
)
func BackTrace(enableIpv6 bool) {
backtrace.BackTrace(enableIpv6)
}

View File

@@ -1,21 +0,0 @@
package backtrace
import (
"testing"
)
//func TestGeneratePrefixMap(t *testing.T) {
// prefix := "223.119.8.0/21"
// prefixList := GeneratePrefixList(prefix)
// if prefixList != nil {
// // 打印生成的IP地址前缀列表
// for _, ip := range prefixList {
// fmt.Println(ip)
// }
// }
//}
// 本包仅测试,无实际使用
func TestBackTrace(t *testing.T) {
BackTrace(false)
}

View File

@@ -1,9 +0,0 @@
package ntrace
import (
"github.com/oneclickvirt/nt3/nt"
)
func TraceRoute3(language, location, checkType string) {
nt.TraceRoute(language, location, checkType)
}

View File

@@ -1,9 +0,0 @@
package ntrace
import "testing"
// https://github.com/nxtrace/NTrace-core/blob/main/fast_trace/fast_trace.go
// 本包仅测试无实际使用
func TestTraceRoute(t *testing.T) {
TraceRoute3("en", "GZ", "ipv4")
}

View File

@@ -40,7 +40,7 @@ import (
)
var (
ecsVersion = "v0.1.81"
ecsVersion = "v0.1.83"
menuMode bool
onlyChinaTest bool
input, choice string
@@ -546,7 +546,7 @@ func handleSignalInterrupt(sig chan os.Signal, startTime *time.Time, output *str
}
}
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) {
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 = runCPUTest(*output, tempOutput, outputMutex)
*output = runMemoryTest(*output, tempOutput, outputMutex)
@@ -554,7 +554,6 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3, wg4 *sync.Wai
if onlyIpInfoCheckStatus && !basicStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
*output = runIpInfoCheck(*output, tempOutput, outputMutex)
}
var backtraceInfo string
if utTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" && !onlyChinaTest {
wg1.Add(1)
go func() {
@@ -576,24 +575,13 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3, wg4 *sync.Wai
*ptInfo = pt.PingTest()
}()
}
if runtime.GOOS != "windows" && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
if backtraceStatus && !onlyChinaTest {
wg4.Add(1)
go func() {
defer wg4.Done()
backtraceInfo = utils.PrintAndCapture(func() {
upstreams.UpstreamsCheck()
}, "", "")
}()
}
}
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
*output = runStreamingTests(wg1, mediaInfo, *output, tempOutput, outputMutex)
*output = runSecurityTests(*securityInfo, *output, tempOutput, outputMutex)
*output = runEmailTests(wg2, emailInfo, *output, tempOutput, outputMutex)
}
if runtime.GOOS != "windows" && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
*output = runNetworkTests(wg3, wg4, ptInfo, &backtraceInfo, *output, tempOutput, outputMutex)
*output = runNetworkTests(wg3, ptInfo, *output, tempOutput, outputMutex)
}
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
*output = runSpeedTests(*output, tempOutput, outputMutex)
@@ -805,22 +793,17 @@ func runEmailTests(wg2 *sync.WaitGroup, emailInfo *string, output, tempOutput st
}, tempOutput, output)
}
func runNetworkTests(wg3, wg4 *sync.WaitGroup, ptInfo, backtraceInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
func runNetworkTests(wg3 *sync.WaitGroup, ptInfo *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 backtraceStatus && !onlyChinaTest {
utils.PrintCenteredTitle("上游及回程线路检测", width)
fmt.Print(*backtraceInfo)
upstreams.UpstreamsCheck() // 不能在重定向的同时外部并发,此处仅可以顺序执行
}
if nt3Status && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程路由检测", width)
utils.PrintAndCapture(func() {
nexttrace.NextTrace3Check(language, nt3Location, nt3CheckType) // 不能在重定向的同时外部并发,此处仅可以顺序执行
}, "", "")
}
if (onlyChinaTest || pingTestStatus) && *ptInfo != "" {
wg3.Wait()
@@ -919,7 +902,7 @@ func main() {
enabelUpload = false
}
var (
wg1, wg2, wg3, wg4 sync.WaitGroup
wg1, wg2, wg3 sync.WaitGroup
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
output, tempOutput string
outputMutex sync.Mutex
@@ -931,7 +914,7 @@ func main() {
go handleSignalInterrupt(sig, &startTime, &output, tempOutput, uploadDone, &outputMutex)
switch language {
case "zh":
runChineseTests(preCheck, &wg1, &wg2, &wg3, &wg4, &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":
runEnglishTests(preCheck, &wg1, &wg2, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &output, tempOutput, startTime, &outputMutex)
default: