mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-27 19:52:08 +08:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9565248f95 | ||
![]() |
1d6cd5984b | ||
![]() |
63b857c915 | ||
![]() |
6811f19db4 | ||
![]() |
847e1c0d6e | ||
![]() |
99a8448d53 | ||
![]() |
4fe9cd21ef |
43
README.md
43
README.md
@@ -35,6 +35,8 @@ Shell版本: https://github.com/spiritLHLS/ecs
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
或
|
||||
|
||||
```
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
@@ -63,9 +65,43 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
|
||||
./goecs.sh delete
|
||||
```
|
||||
|
||||
shell脚本的说明
|
||||
|
||||
```
|
||||
Usage of goecs:
|
||||
-backtrace windows
|
||||
Available commands:
|
||||
|
||||
./goecs.sh env Check and Install package:
|
||||
tar (Almost all unix-like systems have it.)
|
||||
unzip (Almost all unix-like systems have it.)
|
||||
dd (Almost all unix-like systems have it.)
|
||||
fio (Almost all unix-like systems can be installed through the system's package manager.)
|
||||
sysbench (Almost all unix-like systems can be installed through the system's package manager.)
|
||||
geekbench (geekbench5)(Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.)
|
||||
speedtest (Use the officially provided binaries for more accurate test results.)
|
||||
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested.
|
||||
./goecs.sh install Install goecs command
|
||||
./goecs.sh upgrade Upgrade goecs command
|
||||
./goecs.sh delete Uninstall goecs command
|
||||
./goecs.sh help Show this message
|
||||
```
|
||||
|
||||
goecs唤起菜单
|
||||
|
||||
```
|
||||
goecs
|
||||
```
|
||||
|
||||
或
|
||||
|
||||
```
|
||||
./goecs
|
||||
```
|
||||
|
||||
goecs命令参数化
|
||||
|
||||
```
|
||||
Usage: goecs [options]
|
||||
-backtrace
|
||||
Enable/Disable backtrace test (in 'en' language or on windows it always false) (default true)
|
||||
-basic
|
||||
Enable/Disable basic test (default true)
|
||||
@@ -87,6 +123,7 @@ Usage of goecs:
|
||||
Set disk test path, e.g., -diskp /root
|
||||
-email
|
||||
Enable/Disable email port test (default true)
|
||||
-h Show help information
|
||||
-l string
|
||||
Set language (supported: en, zh) (default "zh")
|
||||
-log
|
||||
@@ -97,7 +134,7 @@ Usage of goecs:
|
||||
Set memory test method (supported: sysbench, dd, winsat) (default "dd")
|
||||
-menu
|
||||
Enable/Disable menu mode, disable example: -menu=false (default true)
|
||||
-nt3 windows
|
||||
-nt3
|
||||
Enable/Disable NT3 test (in 'en' language or on windows it always false) (default true)
|
||||
-nt3loc string
|
||||
Specify NT3 test location (supported: GZ, SH, BJ, CD for Guangzhou, Shanghai, Beijing, Chengdu) (default "GZ")
|
||||
|
8
go.mod
8
go.mod
@@ -7,15 +7,15 @@ require (
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.2-20240630023003
|
||||
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240624090335
|
||||
github.com/oneclickvirt/basics v0.0.3-20240701085439
|
||||
github.com/oneclickvirt/cputest v0.0.7-20240701020012
|
||||
github.com/oneclickvirt/basics v0.0.5-20240702021800
|
||||
github.com/oneclickvirt/cputest v0.0.8-20240701113350
|
||||
github.com/oneclickvirt/defaultset v0.0.2-20240624082446
|
||||
github.com/oneclickvirt/disktest v0.0.3-20240629152513
|
||||
github.com/oneclickvirt/gostun v0.0.2-20240625025941
|
||||
github.com/oneclickvirt/memorytest v0.0.1-20240624151629
|
||||
github.com/oneclickvirt/memorytest v0.0.2-20240702031042
|
||||
github.com/oneclickvirt/nt3 v0.0.2-20240630152642
|
||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429
|
||||
github.com/oneclickvirt/security v0.0.3-20240701065755
|
||||
github.com/oneclickvirt/security v0.0.4-20240702031253
|
||||
github.com/oneclickvirt/speedtest v0.0.6-20240630114816
|
||||
)
|
||||
|
||||
|
16
go.sum
16
go.sum
@@ -81,24 +81,24 @@ github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930 h1:/Sc4Eas1Pso18ak93w
|
||||
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930/go.mod h1:HP3CvAS+AJWxxY+BVbxIOlvaQ87YOSge89vAMG52b5o=
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240624090335 h1:0LP5KyA6GLlqQAtOF0uyBSAykHJrzOA96Eb87qUhGQw=
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240624090335/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8=
|
||||
github.com/oneclickvirt/basics v0.0.3-20240701085439 h1:1PE7Womqy4AW2c9PlyFdHsBocZXSo02V5uJDSzQLzgs=
|
||||
github.com/oneclickvirt/basics v0.0.3-20240701085439/go.mod h1:dTB+/oyFQYfTYX55rFJVWatum5F9g62zjfmHCM6Vj1s=
|
||||
github.com/oneclickvirt/cputest v0.0.7-20240701020012 h1:U5cCI+6ZU3pudoAlmb1b3yB9IQNm5AnDXi1TQAZJCIA=
|
||||
github.com/oneclickvirt/cputest v0.0.7-20240701020012/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
|
||||
github.com/oneclickvirt/basics v0.0.5-20240702021800 h1:+iiT/5pF/xsn1iah1q7tdfm1hnAUgYXutRaJUUbNNWo=
|
||||
github.com/oneclickvirt/basics v0.0.5-20240702021800/go.mod h1:ZuBHalTH6J8fO2cL+ZH4SeFLAt32WRW74H9htwNTGhc=
|
||||
github.com/oneclickvirt/cputest v0.0.8-20240701113350 h1:OMIKQSvcqCmDuVCL2y8V1GI0/YSFmUs9Ikw6WalWsS0=
|
||||
github.com/oneclickvirt/cputest v0.0.8-20240701113350/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
|
||||
github.com/oneclickvirt/defaultset v0.0.2-20240624082446 h1:5Pg3mK/u/vQvSz7anu0nxzrNdELi/AcDAU1mMsmPzyc=
|
||||
github.com/oneclickvirt/defaultset v0.0.2-20240624082446/go.mod h1:e9Jt4tf2sbemCtc84/XgKcHy9EZ2jkc5x2sW1NiJS+E=
|
||||
github.com/oneclickvirt/disktest v0.0.3-20240629152513 h1:ZW7MBMd2HxQi1ktg/ztVI2A10JzF4ZI6I7ATZvcK9w8=
|
||||
github.com/oneclickvirt/disktest v0.0.3-20240629152513/go.mod h1:x7VAJF0Ks05FyE4BI5xedXNKmwbeXfp8GCRALAIlueI=
|
||||
github.com/oneclickvirt/gostun v0.0.2-20240625025941 h1:h+ZL8jkjXR6QE0qEX34FjWTv89+lNj2fEkWx5Agpgzc=
|
||||
github.com/oneclickvirt/gostun v0.0.2-20240625025941/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
|
||||
github.com/oneclickvirt/memorytest v0.0.1-20240624151629 h1:2rJAB3gFGlFPocIb/WRVWYqs4nr2jGYokfDOgqFicD4=
|
||||
github.com/oneclickvirt/memorytest v0.0.1-20240624151629/go.mod h1:+YNzy+NeVg61d0kNwSyVDqHyVtKzjuRe1NvMzsDLg0I=
|
||||
github.com/oneclickvirt/memorytest v0.0.2-20240702031042 h1:j+LsjOh5glYiidqtSqjZJRw694LYW1PHLMh6AovluTQ=
|
||||
github.com/oneclickvirt/memorytest v0.0.2-20240702031042/go.mod h1:+YNzy+NeVg61d0kNwSyVDqHyVtKzjuRe1NvMzsDLg0I=
|
||||
github.com/oneclickvirt/nt3 v0.0.2-20240630152642 h1:BkpR1j9JaDxMzx7iIwtsnFDxSldjYr2TUYpZE7m8z/Y=
|
||||
github.com/oneclickvirt/nt3 v0.0.2-20240630152642/go.mod h1:UojPmtangn17TiQaDccVrZbn6sZwJOtzBgg3idp68cA=
|
||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429 h1:+wapaOcFrg1iWJDhBKThDzppyIMY7hWxK7F5RBkZg4o=
|
||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
|
||||
github.com/oneclickvirt/security v0.0.3-20240701065755 h1:eHZDuyvzufOu2yDUIMggK2iRtMWJaFlCzG4+leQn5+0=
|
||||
github.com/oneclickvirt/security v0.0.3-20240701065755/go.mod h1:cUNNOldoVQuovyc0EtAVAZlAT4y2xA1e0uA80aj1ly8=
|
||||
github.com/oneclickvirt/security v0.0.4-20240702031253 h1:jUr+lfXTg+Gqrt+SQNeVIObMDZYVjUo1kH+O1q6DSEU=
|
||||
github.com/oneclickvirt/security v0.0.4-20240702031253/go.mod h1:lONKUorS4lMjXI+5sqD9aq0eNOO6z1QhZylQ7M3wx2s=
|
||||
github.com/oneclickvirt/speedtest v0.0.6-20240630114816 h1:gI2hqV0IwcvGqYzLhlt4w2oZvYhCL+73jftUuJYBsuI=
|
||||
github.com/oneclickvirt/speedtest v0.0.6-20240630114816/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
||||
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
|
||||
|
26
goecs.go
26
goecs.go
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/oneclickvirt/CommonMediaTests/commediatests"
|
||||
backtraceori "github.com/oneclickvirt/backtrace/bk"
|
||||
basicmodel "github.com/oneclickvirt/basics/model"
|
||||
cputestmodel "github.com/oneclickvirt/cputest/model"
|
||||
"github.com/oneclickvirt/ecs/backtrace"
|
||||
"github.com/oneclickvirt/ecs/commediatest"
|
||||
"github.com/oneclickvirt/ecs/cputest"
|
||||
@@ -29,7 +30,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ecsVersion = "v0.0.26"
|
||||
ecsVersion = "v0.0.29"
|
||||
menuMode bool
|
||||
input, choice string
|
||||
showVersion bool
|
||||
@@ -41,7 +42,7 @@ var (
|
||||
diskMultiCheck bool
|
||||
nt3CheckType, nt3Location string
|
||||
spNum int
|
||||
width = 84
|
||||
width = 82
|
||||
basicStatus, cpuTestStatus, memoryTestStatus, diskTestStatus bool
|
||||
commTestStatus, utTestStatus, securityTestStatus, emailTestStatus bool
|
||||
backtraceStatus, nt3Status, speedTestStatus bool
|
||||
@@ -64,8 +65,8 @@ func main() {
|
||||
goecsFlag.BoolVar(&utTestStatus, "ut", true, "Enable/Disable unlock media test")
|
||||
goecsFlag.BoolVar(&securityTestStatus, "security", true, "Enable/Disable security test")
|
||||
goecsFlag.BoolVar(&emailTestStatus, "email", true, "Enable/Disable email port test")
|
||||
goecsFlag.BoolVar(&backtraceStatus, "backtrace", true, "Enable/Disable backtrace test (in 'en' language or on `windows` it always false)")
|
||||
goecsFlag.BoolVar(&nt3Status, "nt3", true, "Enable/Disable NT3 test (in 'en' language or on `windows` it always false)")
|
||||
goecsFlag.BoolVar(&backtraceStatus, "backtrace", true, "Enable/Disable backtrace test (in 'en' language or on windows it always false)")
|
||||
goecsFlag.BoolVar(&nt3Status, "nt3", true, "Enable/Disable NT3 test (in 'en' language or on windows it always false)")
|
||||
goecsFlag.BoolVar(&speedTestStatus, "speed", true, "Enable/Disable speed test")
|
||||
goecsFlag.StringVar(&cpuTestMethod, "cpum", "sysbench", "Set CPU test method (supported: sysbench, geekbench, winsat)")
|
||||
goecsFlag.StringVar(&cpuTestThreadMode, "cput", "multi", "Set CPU test thread mode (supported: single, multi)")
|
||||
@@ -80,7 +81,7 @@ func main() {
|
||||
goecsFlag.Parse(os.Args[1:])
|
||||
if help {
|
||||
fmt.Printf("Usage: %s [options]\n", os.Args[0])
|
||||
flag.PrintDefaults()
|
||||
goecsFlag.PrintDefaults()
|
||||
return
|
||||
}
|
||||
sig := make(chan os.Signal, 1)
|
||||
@@ -91,6 +92,7 @@ func main() {
|
||||
}
|
||||
if enableLogger {
|
||||
basicmodel.EnableLoger = true
|
||||
cputestmodel.EnableLoger = true
|
||||
speedtestmodel.EnableLoger = true
|
||||
gostunmodel.EnableLoger = true
|
||||
commediatests.EnableLoger = true
|
||||
@@ -246,7 +248,7 @@ func main() {
|
||||
utils.PrintHead(language, width, ecsVersion)
|
||||
if basicStatus || securityTestStatus {
|
||||
if basicStatus {
|
||||
utils.PrintCenteredTitle("基础信息", width)
|
||||
utils.PrintCenteredTitle("系统基础信息", width)
|
||||
}
|
||||
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
|
||||
if basicStatus {
|
||||
@@ -315,14 +317,14 @@ func main() {
|
||||
if runtime.GOOS != "windows" {
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if backtraceStatus {
|
||||
utils.PrintCenteredTitle("三网回程", width)
|
||||
utils.PrintCenteredTitle("三网回程线路检测", width)
|
||||
backtrace.BackTrace()
|
||||
}
|
||||
}, tempOutput, output)
|
||||
// nexttrace 在win上不支持检测,报错 bind: An invalid argument was supplied.
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if nt3Status {
|
||||
utils.PrintCenteredTitle("路由检测", width)
|
||||
utils.PrintCenteredTitle("三网回程路由检测", width)
|
||||
ntrace.TraceRoute3(language, nt3Location, nt3CheckType)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
@@ -358,7 +360,7 @@ func main() {
|
||||
utils.PrintHead(language, width, ecsVersion)
|
||||
if basicStatus || securityTestStatus {
|
||||
if basicStatus {
|
||||
utils.PrintCenteredTitle("Basic Information", width)
|
||||
utils.PrintCenteredTitle("System Basic Information", width)
|
||||
}
|
||||
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
|
||||
if basicStatus {
|
||||
@@ -393,7 +395,7 @@ func main() {
|
||||
}
|
||||
output = utils.PrintAndCapture(func() {
|
||||
if commTestStatus {
|
||||
utils.PrintCenteredTitle("The Three Families Streaming Media Unlock", width)
|
||||
utils.PrintCenteredTitle("The Three Main Streaming Media Unlock", width)
|
||||
commediatest.ComMediaTest(language)
|
||||
}
|
||||
}, tempOutput, output)
|
||||
@@ -440,4 +442,8 @@ func main() {
|
||||
fmt.Println("Unsupported language")
|
||||
}
|
||||
utils.ProcessAndUpload(output, filePath, enabelUpload)
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
|
||||
fmt.Println("Press Enter to exit...")
|
||||
fmt.Scanln()
|
||||
}
|
||||
}
|
||||
|
5
goecs.sh
5
goecs.sh
@@ -300,6 +300,11 @@ env_check() {
|
||||
echo "rm -rf /usr/bin/speedtest-go"
|
||||
_blue "to uninstall speedtest and speedtest-go"
|
||||
fi
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "Detected MacOS. Installing sysbench and fio..."
|
||||
# 使用Homebrew安装sysbench和fio(免交互)
|
||||
brew install --force sysbench fio
|
||||
fi
|
||||
_green "The environment is ready."
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user