@@ -10,14 +10,8 @@ import (
1010 "time"
1111
1212 "github.com/oneclickvirt/CommonMediaTests/commediatests"
13- "github.com/oneclickvirt/ecs/cputest"
14- "github.com/oneclickvirt/ecs/disktest"
1513 "github.com/oneclickvirt/ecs/internal/params"
16- "github.com/oneclickvirt/ecs/memorytest"
17- "github.com/oneclickvirt/ecs/nexttrace"
18- "github.com/oneclickvirt/ecs/speedtest"
19- "github.com/oneclickvirt/ecs/unlocktest"
20- "github.com/oneclickvirt/ecs/upstreams"
14+ "github.com/oneclickvirt/ecs/internal/tests"
2115 "github.com/oneclickvirt/ecs/utils"
2216 "github.com/oneclickvirt/pingtest/pt"
2317 "github.com/oneclickvirt/portchecker/email"
@@ -36,7 +30,7 @@ func RunChineseTests(preCheck utils.NetCheckResult, config *params.Config, wg1,
3630 wg1 .Add (1 )
3731 go func () {
3832 defer wg1 .Done ()
39- * mediaInfo = unlocktest .MediaTest (config .Language )
33+ * mediaInfo = tests .MediaTest (config .Language )
4034 }()
4135 }
4236 if config .EmailTestStatus && preCheck .Connected && preCheck .StackType != "" && preCheck .StackType != "None" {
@@ -81,7 +75,7 @@ func RunEnglishTests(preCheck utils.NetCheckResult, config *params.Config, wg1,
8175 wg1 .Add (1 )
8276 go func () {
8377 defer wg1 .Done ()
84- * mediaInfo = unlocktest .MediaTest (config .Language )
78+ * mediaInfo = tests .MediaTest (config .Language )
8579 }()
8680 }
8781 if config .EmailTestStatus {
@@ -106,7 +100,7 @@ func RunIpInfoCheck(config *params.Config, output, tempOutput string, outputMute
106100 defer outputMutex .Unlock ()
107101 return utils .PrintAndCapture (func () {
108102 var ipinfo string
109- upstreams .IPV4 , upstreams .IPV6 , ipinfo = utils .OnlyBasicsIpInfo (config .Language )
103+ tests .IPV4 , tests .IPV6 , ipinfo = utils .OnlyBasicsIpInfo (config .Language )
110104 if ipinfo != "" {
111105 if config .Language == "zh" {
112106 utils .PrintCenteredTitle ("IP信息" , config .Width )
@@ -133,13 +127,13 @@ func RunBasicTests(preCheck utils.NetCheckResult, config *params.Config, basicIn
133127 }
134128 }
135129 if preCheck .Connected && preCheck .StackType == "DualStack" {
136- upstreams .IPV4 , upstreams .IPV6 , * basicInfo , * securityInfo , config .Nt3CheckType = utils .BasicsAndSecurityCheck (config .Language , config .Nt3CheckType , config .SecurityTestStatus )
130+ tests .IPV4 , tests .IPV6 , * basicInfo , * securityInfo , config .Nt3CheckType = utils .BasicsAndSecurityCheck (config .Language , config .Nt3CheckType , config .SecurityTestStatus )
137131 } else if preCheck .Connected && preCheck .StackType == "IPv4" {
138- upstreams .IPV4 , upstreams .IPV6 , * basicInfo , * securityInfo , config .Nt3CheckType = utils .BasicsAndSecurityCheck (config .Language , "ipv4" , config .SecurityTestStatus )
132+ tests .IPV4 , tests .IPV6 , * basicInfo , * securityInfo , config .Nt3CheckType = utils .BasicsAndSecurityCheck (config .Language , "ipv4" , config .SecurityTestStatus )
139133 } else if preCheck .Connected && preCheck .StackType == "IPv6" {
140- upstreams .IPV4 , upstreams .IPV6 , * basicInfo , * securityInfo , config .Nt3CheckType = utils .BasicsAndSecurityCheck (config .Language , "ipv6" , config .SecurityTestStatus )
134+ tests .IPV4 , tests .IPV6 , * basicInfo , * securityInfo , config .Nt3CheckType = utils .BasicsAndSecurityCheck (config .Language , "ipv6" , config .SecurityTestStatus )
141135 } else {
142- upstreams .IPV4 , upstreams .IPV6 , * basicInfo , * securityInfo , config .Nt3CheckType = utils .BasicsAndSecurityCheck (config .Language , "" , false )
136+ tests .IPV4 , tests .IPV6 , * basicInfo , * securityInfo , config .Nt3CheckType = utils .BasicsAndSecurityCheck (config .Language , "" , false )
143137 config .SecurityTestStatus = false
144138 }
145139 if config .BasicStatus {
@@ -163,7 +157,7 @@ func RunCPUTest(config *params.Config, output, tempOutput string, outputMutex *s
163157 defer outputMutex .Unlock ()
164158 return utils .PrintAndCapture (func () {
165159 if config .CpuTestStatus {
166- realTestMethod , res := cputest .CpuTest (config .Language , config .CpuTestMethod , config .CpuTestThreadMode )
160+ realTestMethod , res := tests .CpuTest (config .Language , config .CpuTestMethod , config .CpuTestThreadMode )
167161 if config .Language == "zh" {
168162 utils .PrintCenteredTitle (fmt .Sprintf ("CPU测试-通过%s测试" , realTestMethod ), config .Width )
169163 } else {
@@ -180,7 +174,7 @@ func RunMemoryTest(config *params.Config, output, tempOutput string, outputMutex
180174 defer outputMutex .Unlock ()
181175 return utils .PrintAndCapture (func () {
182176 if config .MemoryTestStatus {
183- realTestMethod , res := memorytest .MemoryTest (config .Language , config .MemoryTestMethod )
177+ realTestMethod , res := tests .MemoryTest (config .Language , config .MemoryTestMethod )
184178 if config .Language == "zh" {
185179 utils .PrintCenteredTitle (fmt .Sprintf ("内存测试-通过%s测试" , realTestMethod ), config .Width )
186180 } else {
@@ -197,7 +191,7 @@ func RunDiskTest(config *params.Config, output, tempOutput string, outputMutex *
197191 defer outputMutex .Unlock ()
198192 return utils .PrintAndCapture (func () {
199193 if config .DiskTestStatus && config .AutoChangeDiskMethod {
200- realTestMethod , res := disktest .DiskTest (config .Language , config .DiskTestMethod , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
194+ realTestMethod , res := tests .DiskTest (config .Language , config .DiskTestMethod , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
201195 if config .Language == "zh" {
202196 utils .PrintCenteredTitle (fmt .Sprintf ("硬盘测试-通过%s测试" , realTestMethod ), config .Width )
203197 } else {
@@ -207,17 +201,17 @@ func RunDiskTest(config *params.Config, output, tempOutput string, outputMutex *
207201 } else if config .DiskTestStatus && ! config .AutoChangeDiskMethod {
208202 if config .Language == "zh" {
209203 utils .PrintCenteredTitle (fmt .Sprintf ("硬盘测试-通过%s测试" , "dd" ), config .Width )
210- _ , res := disktest .DiskTest (config .Language , "dd" , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
204+ _ , res := tests .DiskTest (config .Language , "dd" , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
211205 fmt .Print (res )
212206 utils .PrintCenteredTitle (fmt .Sprintf ("硬盘测试-通过%s测试" , "fio" ), config .Width )
213- _ , res = disktest .DiskTest (config .Language , "fio" , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
207+ _ , res = tests .DiskTest (config .Language , "fio" , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
214208 fmt .Print (res )
215209 } else {
216210 utils .PrintCenteredTitle (fmt .Sprintf ("Disk-Test--%s-Method" , "dd" ), config .Width )
217- _ , res := disktest .DiskTest (config .Language , "dd" , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
211+ _ , res := tests .DiskTest (config .Language , "dd" , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
218212 fmt .Print (res )
219213 utils .PrintCenteredTitle (fmt .Sprintf ("Disk-Test--%s-Method" , "fio" ), config .Width )
220- _ , res = disktest .DiskTest (config .Language , "fio" , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
214+ _ , res = tests .DiskTest (config .Language , "fio" , config .DiskTestPath , config .DiskMultiCheck , config .AutoChangeDiskMethod )
221215 fmt .Print (res )
222216 }
223217 }
@@ -287,11 +281,11 @@ func RunNetworkTests(config *params.Config, wg3 *sync.WaitGroup, ptInfo *string,
287281 return utils .PrintAndCapture (func () {
288282 if config .BacktraceStatus && ! config .OnlyChinaTest {
289283 utils .PrintCenteredTitle ("上游及回程线路检测" , config .Width )
290- upstreams .UpstreamsCheck ()
284+ tests .UpstreamsCheck ()
291285 }
292286 if config .Nt3Status && ! config .OnlyChinaTest {
293287 utils .PrintCenteredTitle ("三网回程路由检测" , config .Width )
294- nexttrace .NextTrace3Check (config .Language , config .Nt3Location , config .Nt3CheckType )
288+ tests .NextTrace3Check (config .Language , config .Nt3Location , config .Nt3CheckType )
295289 }
296290 if config .OnlyChinaTest && * ptInfo != "" {
297291 wg3 .Wait ()
@@ -328,17 +322,17 @@ func RunSpeedTests(config *params.Config, output, tempOutput string, outputMutex
328322 return utils .PrintAndCapture (func () {
329323 if config .SpeedTestStatus {
330324 utils .PrintCenteredTitle ("就近节点测速" , config .Width )
331- speedtest .ShowHead (config .Language )
325+ tests .ShowHead (config .Language )
332326 if config .Choice == "1" || ! config .MenuMode {
333- speedtest .NearbySP ()
334- speedtest .CustomSP ("net" , "global" , 2 , config .Language )
335- speedtest .CustomSP ("net" , "cu" , config .SpNum , config .Language )
336- speedtest .CustomSP ("net" , "ct" , config .SpNum , config .Language )
337- speedtest .CustomSP ("net" , "cmcc" , config .SpNum , config .Language )
327+ tests .NearbySP ()
328+ tests .CustomSP ("net" , "global" , 2 , config .Language )
329+ tests .CustomSP ("net" , "cu" , config .SpNum , config .Language )
330+ tests .CustomSP ("net" , "ct" , config .SpNum , config .Language )
331+ tests .CustomSP ("net" , "cmcc" , config .SpNum , config .Language )
338332 } else if config .Choice == "2" || config .Choice == "3" || config .Choice == "4" || config .Choice == "5" {
339- speedtest .CustomSP ("net" , "global" , 4 , config .Language )
333+ tests .CustomSP ("net" , "global" , 4 , config .Language )
340334 } else if config .Choice == "6" {
341- speedtest .CustomSP ("net" , "global" , 11 , config .Language )
335+ tests .CustomSP ("net" , "global" , 11 , config .Language )
342336 }
343337 }
344338 }, tempOutput , output )
@@ -368,9 +362,9 @@ func RunEnglishSpeedTests(config *params.Config, output, tempOutput string, outp
368362 return utils .PrintAndCapture (func () {
369363 if config .SpeedTestStatus {
370364 utils .PrintCenteredTitle ("Speed-Test" , config .Width )
371- speedtest .ShowHead (config .Language )
372- speedtest .NearbySP ()
373- speedtest .CustomSP ("net" , "global" , - 1 , config .Language )
365+ tests .ShowHead (config .Language )
366+ tests .NearbySP ()
367+ tests .CustomSP ("net" , "global" , - 1 , config .Language )
374368 }
375369 }, tempOutput , output )
376370}
0 commit comments