mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-28 20:22:09 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4f08a33de8 | ||
![]() |
ff8712a743 | ||
![]() |
abd38554b6 | ||
![]() |
918a9b3a46 |
@@ -369,7 +369,7 @@ GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
|
||||
|
||||
## 致谢
|
||||
|
||||
感谢 [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [maxmind.com](https://www.maxmind.com/en/home) [cloudflare.com](https://www.cloudflare.com/) [ip.sb](https://ip.sb) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [cheervision.co](https://cheervision.co) [virustotal.com](https://www.virustotal.com/) 等网站提供的API进行检测,感谢互联网各网站提供的查询资源
|
||||
感谢 [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [maxmind.com](https://www.maxmind.com/en/home) [cloudflare.com](https://www.cloudflare.com/) [ip.sb](https://ip.sb) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) 等网站提供的API进行检测,感谢互联网各网站提供的查询资源
|
||||
|
||||
感谢
|
||||
|
||||
|
@@ -363,7 +363,7 @@ Note that `goecs` allows you to specify CPU test method via parameters. The defa
|
||||
|
||||
## Thanks
|
||||
|
||||
Thank [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [maxmind.com](https://www.maxmind.com/en/home) [cloudflare.com](https://www.cloudflare.com/) [ip.sb](https://ip.sb) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [cheervision.co](https://cheervision.co) [virustotal.com](https://www.virustotal.com/) and others for providing APIs for testing, and thanks to various websites on the Internet for providing query resources.
|
||||
Thank [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [maxmind.com](https://www.maxmind.com/en/home) [cloudflare.com](https://www.cloudflare.com/) [ip.sb](https://ip.sb) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) and others for providing APIs for testing, and thanks to various websites on the Internet for providing query resources.
|
||||
|
||||
Thank
|
||||
|
||||
|
4
go.mod
4
go.mod
@@ -9,7 +9,7 @@ require (
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841
|
||||
github.com/oneclickvirt/UnlockTests v0.0.27-20250628125053
|
||||
github.com/oneclickvirt/backtrace v0.0.5-20250629024536
|
||||
github.com/oneclickvirt/basics v0.0.14-20250710074251
|
||||
github.com/oneclickvirt/basics v0.0.15-20250714163009
|
||||
github.com/oneclickvirt/cputest v0.0.10-20250404151448
|
||||
github.com/oneclickvirt/defaultset v0.0.2-20240624082446
|
||||
github.com/oneclickvirt/disktest v0.0.8-20250701092629
|
||||
@@ -18,7 +18,7 @@ require (
|
||||
github.com/oneclickvirt/nt3 v0.0.5-20250416131047
|
||||
github.com/oneclickvirt/pingtest v0.0.8-20250701125637
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250329125750
|
||||
github.com/oneclickvirt/security v0.0.5-20250710075323
|
||||
github.com/oneclickvirt/security v0.0.6-20250715102027
|
||||
github.com/oneclickvirt/speedtest v0.0.10-20250701123931
|
||||
)
|
||||
|
||||
|
8
go.sum
8
go.sum
@@ -103,8 +103,8 @@ github.com/oneclickvirt/UnlockTests v0.0.27-20250628125053 h1:Ug8kySZR1weRUcsnGO
|
||||
github.com/oneclickvirt/UnlockTests v0.0.27-20250628125053/go.mod h1:yXWIZB6iLS88pEd9m4QJi1GENn+7I91zA72y5ONz2Oc=
|
||||
github.com/oneclickvirt/backtrace v0.0.5-20250629024536 h1:caHCa0DHmbYWBFN1bqKxpvPnN0wOxDEqJv1VDvDdLWs=
|
||||
github.com/oneclickvirt/backtrace v0.0.5-20250629024536/go.mod h1:5AH00bo41hH3d2/JVuCTlBkZUs3AXX4nlKVXb6piZcI=
|
||||
github.com/oneclickvirt/basics v0.0.14-20250710074251 h1:1qFSjCAy28utNv9d3RF6Hav9HKa1Q3aqxYY5ABpcli0=
|
||||
github.com/oneclickvirt/basics v0.0.14-20250710074251/go.mod h1:yN1IEOXN6v/GJqJSA70Pooo6nXBI/6rq72vTY72wJMQ=
|
||||
github.com/oneclickvirt/basics v0.0.15-20250714163009 h1:7I1lU7N91kClw6Cb6o+vGfScc/HngrjhsaaW10AbBFs=
|
||||
github.com/oneclickvirt/basics v0.0.15-20250714163009/go.mod h1:yN1IEOXN6v/GJqJSA70Pooo6nXBI/6rq72vTY72wJMQ=
|
||||
github.com/oneclickvirt/cputest v0.0.10-20250404151448 h1:ovGtCwFXG0qmpyNDRqcNDIiAmhrtemCjIUXTJ1fPH0o=
|
||||
github.com/oneclickvirt/cputest v0.0.10-20250404151448/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
|
||||
github.com/oneclickvirt/dd v0.0.2-20250701085922 h1:WiWZwcnCPhRc8hLZdvkjD2kOEpnqn1S31z1j0x3V4l0=
|
||||
@@ -127,8 +127,8 @@ github.com/oneclickvirt/pingtest v0.0.8-20250701125637 h1:J28Ai5miTq1J0I4gdT8rew
|
||||
github.com/oneclickvirt/pingtest v0.0.8-20250701125637/go.mod h1:d3Ntx5m9lMll3a/k3+2B+5emj//vgDh4/NHTxs2qQE8=
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250329125750 h1:TTNL0pnQlRsn046kW59I/9UWRpihttFHWnU7Ixycggk=
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250329125750/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
|
||||
github.com/oneclickvirt/security v0.0.5-20250710075323 h1:HRy2Q/BGHRB/NWKeF7ydfTpP4jm5hM7HyaZd7OH31uk=
|
||||
github.com/oneclickvirt/security v0.0.5-20250710075323/go.mod h1:KGfv/BvsPliKZhWXn3Ckp6cSl1RogcXysNFQbe+0E5M=
|
||||
github.com/oneclickvirt/security v0.0.6-20250715102027 h1:lOaFxORBT/9nBlof7EU36YP+ZIbqkhCLGyOpYQTY1qs=
|
||||
github.com/oneclickvirt/security v0.0.6-20250715102027/go.mod h1:SDFBXV0sDo8pSIcGaaJ2gfCCW+NKy4pO1q9i4SIX2jc=
|
||||
github.com/oneclickvirt/speedtest v0.0.10-20250701123931 h1:IMUM0F3trrlCdl9JTO+FBIJ9zc8mbi+oyd66IkO/8mI=
|
||||
github.com/oneclickvirt/speedtest v0.0.10-20250701123931/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
||||
github.com/onsi/ginkgo/v2 v2.22.1 h1:QW7tbJAUDyVDVOM5dFa7qaybo+CRfR7bemlQUN6Z8aM=
|
||||
|
99
goecs.go
99
goecs.go
@@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ecsVersion = "v0.1.51"
|
||||
ecsVersion = "v0.1.52"
|
||||
menuMode bool
|
||||
onlyChinaTest bool
|
||||
input, choice string
|
||||
@@ -347,6 +347,7 @@ func setUnlockOnlyTestStatus() {
|
||||
}
|
||||
|
||||
func setHardwareOnlyTestStatus(preCheck utils.NetCheckResult) {
|
||||
_ = preCheck
|
||||
basicStatus = true
|
||||
cpuTestStatus = true
|
||||
memoryTestStatus = true
|
||||
@@ -395,54 +396,66 @@ func handleSignalInterrupt(sig chan os.Signal, startTime *time.Time, output *str
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||
outputMutex.Lock()
|
||||
finalOutput := *output
|
||||
*output = utils.PrintAndCapture(func() {
|
||||
utils.PrintCenteredTitle("", width)
|
||||
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
|
||||
fmt.Printf("Current Time : %s\n", currentTime)
|
||||
if language == "zh" {
|
||||
fmt.Printf("花费 : %d 分 %d 秒\n", minutes, seconds)
|
||||
fmt.Printf("时间 : %s\n", currentTime)
|
||||
} else {
|
||||
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
|
||||
fmt.Printf("Current Time : %s\n", currentTime)
|
||||
}
|
||||
utils.PrintCenteredTitle("", width)
|
||||
}, tempOutput, *output)
|
||||
}, tempOutput, finalOutput)
|
||||
finalOutput = *output
|
||||
outputMutex.Unlock()
|
||||
resultChan := make(chan struct {
|
||||
httpURL string
|
||||
httpsURL string
|
||||
}, 1)
|
||||
go func() {
|
||||
outputMutex.Lock()
|
||||
finalOutput := *output
|
||||
outputMutex.Unlock()
|
||||
httpURL, httpsURL := utils.ProcessAndUpload(finalOutput, filePath, enabelUpload)
|
||||
resultChan <- struct {
|
||||
httpURL string
|
||||
httpsURL string
|
||||
}{httpURL, httpsURL}
|
||||
uploadDone <- true
|
||||
}()
|
||||
select {
|
||||
case result := <-resultChan:
|
||||
if result.httpURL != "" || result.httpsURL != "" {
|
||||
if language == "en" {
|
||||
fmt.Printf("Upload successfully!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL)
|
||||
} else {
|
||||
fmt.Printf("上传成功!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL)
|
||||
if enabelUpload {
|
||||
go func() {
|
||||
httpURL, httpsURL := utils.ProcessAndUpload(finalOutput, filePath, enabelUpload)
|
||||
resultChan <- struct {
|
||||
httpURL string
|
||||
httpsURL string
|
||||
}{httpURL, httpsURL}
|
||||
uploadDone <- true
|
||||
}()
|
||||
select {
|
||||
case result := <-resultChan:
|
||||
if result.httpURL != "" || result.httpsURL != "" {
|
||||
if language == "en" {
|
||||
fmt.Printf("Upload successfully!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL)
|
||||
} else {
|
||||
fmt.Printf("上传成功!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL)
|
||||
}
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
|
||||
fmt.Println("Press Enter to exit...")
|
||||
fmt.Scanln()
|
||||
}
|
||||
os.Exit(0)
|
||||
case <-time.After(30 * time.Second):
|
||||
if language == "en" {
|
||||
fmt.Println("Upload timeout, program exit")
|
||||
} else {
|
||||
fmt.Println("上传超时,程序退出")
|
||||
}
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
|
||||
fmt.Println("Press Enter to exit...")
|
||||
fmt.Scanln()
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
} else {
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
|
||||
fmt.Println("Press Enter to exit...")
|
||||
fmt.Scanln()
|
||||
}
|
||||
os.Exit(0)
|
||||
case <-time.After(30 * time.Second):
|
||||
if language == "en" {
|
||||
fmt.Println("Upload timeout, program exit")
|
||||
} else {
|
||||
fmt.Println("上传超时,程序退出")
|
||||
}
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
|
||||
fmt.Println("Press Enter to exit...")
|
||||
fmt.Scanln()
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
os.Exit(0)
|
||||
@@ -518,6 +531,7 @@ func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, ba
|
||||
}
|
||||
|
||||
func runBasicTests(preCheck utils.NetCheckResult, basicInfo, securityInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
return utils.PrintAndCapture(func() {
|
||||
utils.PrintHead(language, width, ecsVersion)
|
||||
if basicStatus || securityTestStatus {
|
||||
@@ -554,6 +568,7 @@ func runBasicTests(preCheck utils.NetCheckResult, basicInfo, securityInfo *strin
|
||||
}
|
||||
|
||||
func runCPUTest(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
return utils.PrintAndCapture(func() {
|
||||
if cpuTestStatus {
|
||||
if language == "zh" {
|
||||
@@ -567,6 +582,7 @@ func runCPUTest(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
}
|
||||
|
||||
func runMemoryTest(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
return utils.PrintAndCapture(func() {
|
||||
if memoryTestStatus {
|
||||
if language == "zh" {
|
||||
@@ -580,6 +596,7 @@ func runMemoryTest(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
}
|
||||
|
||||
func runDiskTest(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
return utils.PrintAndCapture(func() {
|
||||
if diskTestStatus && autoChangeDiskTestMethod {
|
||||
if language == "zh" {
|
||||
@@ -605,6 +622,7 @@ func runDiskTest(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
}
|
||||
|
||||
func runStreamingTests(wg1 *sync.WaitGroup, mediaInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
return utils.PrintAndCapture(func() {
|
||||
if language == "zh" {
|
||||
if commTestStatus && !onlyChinaTest {
|
||||
@@ -625,6 +643,7 @@ func runStreamingTests(wg1 *sync.WaitGroup, mediaInfo *string, output, tempOutpu
|
||||
}
|
||||
|
||||
func runSecurityTests(securityInfo, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
return utils.PrintAndCapture(func() {
|
||||
if securityTestStatus {
|
||||
if language == "zh" {
|
||||
@@ -638,6 +657,7 @@ func runSecurityTests(securityInfo, output, tempOutput string, outputMutex *sync
|
||||
}
|
||||
|
||||
func runEmailTests(wg2 *sync.WaitGroup, emailInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
return utils.PrintAndCapture(func() {
|
||||
if emailTestStatus {
|
||||
wg2.Wait()
|
||||
@@ -652,6 +672,7 @@ func runEmailTests(wg2 *sync.WaitGroup, emailInfo *string, output, tempOutput st
|
||||
}
|
||||
|
||||
func runNetworkTests(wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if backtraceStatus && !onlyChinaTest {
|
||||
utils.PrintCenteredTitle("三网回程线路检测", width)
|
||||
@@ -678,6 +699,7 @@ func runNetworkTests(wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput str
|
||||
}
|
||||
|
||||
func runSpeedTests(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
return utils.PrintAndCapture(func() {
|
||||
if speedTestStatus {
|
||||
utils.PrintCenteredTitle("就近节点测速", width)
|
||||
@@ -698,6 +720,7 @@ func runSpeedTests(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
}
|
||||
|
||||
func runEnglishSpeedTests(output, tempOutput string, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
return utils.PrintAndCapture(func() {
|
||||
if speedTestStatus {
|
||||
utils.PrintCenteredTitle("Speed-Test", width)
|
||||
@@ -709,6 +732,7 @@ func runEnglishSpeedTests(output, tempOutput string, outputMutex *sync.Mutex) st
|
||||
}
|
||||
|
||||
func appendTimeInfo(output, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) string {
|
||||
_ = outputMutex
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
minutes := int(duration.Minutes())
|
||||
@@ -752,6 +776,9 @@ func main() {
|
||||
handleMenuMode(preCheck)
|
||||
}
|
||||
handleLanguageSpecificSettings()
|
||||
if !preCheck.Connected {
|
||||
enabelUpload = false
|
||||
}
|
||||
var (
|
||||
wg1, wg2, wg3 sync.WaitGroup
|
||||
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
|
||||
@@ -771,7 +798,9 @@ func main() {
|
||||
default:
|
||||
fmt.Println("Unsupported language")
|
||||
}
|
||||
handleUploadResults(output)
|
||||
if preCheck.Connected {
|
||||
handleUploadResults(output)
|
||||
}
|
||||
finish = true
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
|
||||
fmt.Println("Press Enter to exit...")
|
||||
|
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.50"
|
||||
ECS_VERSION="0.1.51"
|
||||
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.50"
|
||||
ECS_VERSION="0.1.50"
|
||||
_yellow "Unable to get version info, using default version 0.1.51"
|
||||
ECS_VERSION="0.1.51"
|
||||
fi
|
||||
version_output=""
|
||||
for cmd_path in "goecs" "./goecs" "/usr/bin/goecs" "/usr/local/bin/goecs"; do
|
||||
|
Reference in New Issue
Block a user