Compare commits

...

3 Commits

11 changed files with 53 additions and 38 deletions

View File

@@ -6,7 +6,7 @@
融合怪测评项目 - GO版本 融合怪测评项目 - GO版本
(除非必须的环境安装使用shell外无额外shell文件依赖环境安装只是为了测的更准极端情况下无环境依赖也可全测项目) (环境安装[非必须]使用shell外无额外shell文件依赖环境安装只是为了测的更准极端情况下无环境依赖安装也可全测项目)
如有问题请 [issues](https://github.com/oneclickvirt/ecs/issues) 反馈。 如有问题请 [issues](https://github.com/oneclickvirt/ecs/issues) 反馈。

View File

@@ -4,6 +4,6 @@ import (
"github.com/oneclickvirt/backtrace/bk" "github.com/oneclickvirt/backtrace/bk"
) )
func BackTrace() { func BackTrace(enableIpv6 bool) {
backtrace.BackTrace() backtrace.BackTrace(enableIpv6)
} }

View File

@@ -15,6 +15,7 @@ import (
// } // }
//} //}
// 本包仅测试,无实际使用
func TestBackTrace(t *testing.T) { func TestBackTrace(t *testing.T) {
BackTrace() BackTrace(false)
} }

View File

@@ -4,6 +4,7 @@ import (
"testing" "testing"
) )
// 本包仅测试无实际使用
func TestMedia(t *testing.T) { func TestMedia(t *testing.T) {
ComMediaTest("zh") ComMediaTest("zh")
} }

View File

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

4
go.mod
View File

@@ -3,10 +3,10 @@ module github.com/oneclickvirt/ecs
go 1.23.4 go 1.23.4
require ( require (
github.com/imroc/req/v3 v3.49.0 github.com/imroc/req/v3 v3.50.0
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841 github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841
github.com/oneclickvirt/UnlockTests v0.0.26-20250329125926 github.com/oneclickvirt/UnlockTests v0.0.26-20250329125926
github.com/oneclickvirt/backtrace v0.0.4-20250329130043 github.com/oneclickvirt/backtrace v0.0.5-20250411152044
github.com/oneclickvirt/basics v0.0.11-20250404123515 github.com/oneclickvirt/basics v0.0.11-20250404123515
github.com/oneclickvirt/cputest v0.0.10-20250404151448 github.com/oneclickvirt/cputest v0.0.10-20250404151448
github.com/oneclickvirt/defaultset v0.0.2-20240624082446 github.com/oneclickvirt/defaultset v0.0.2-20240624082446

8
go.sum
View File

@@ -50,8 +50,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY=
github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
github.com/imroc/req/v3 v3.49.0 h1:5Rac2qvz7Dq0E3PeBo/c2szV3hagPQIGLoHtfBmYhu4= github.com/imroc/req/v3 v3.50.0 h1:n3BVnZiTRpvkN5T1IB79LC/THhFU9iXksNRMH4ZNVaY=
github.com/imroc/req/v3 v3.49.0/go.mod h1:XZf4t94DNJzcA0UOBlA68hmSrWsAyvN407ADdH4mzCA= github.com/imroc/req/v3 v3.50.0/go.mod h1:tsOk8K7zI6cU4xu/VWCZVtq9Djw9IWm4MslKzme5woU=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jaypipes/ghw v0.12.0 h1:xU2/MDJfWmBhJnujHY9qwXQLs3DBsf0/Xa9vECY0Tho= github.com/jaypipes/ghw v0.12.0 h1:xU2/MDJfWmBhJnujHY9qwXQLs3DBsf0/Xa9vECY0Tho=
@@ -105,8 +105,8 @@ github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841 h1:Zef93z9UiZQwRA
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4= github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
github.com/oneclickvirt/UnlockTests v0.0.26-20250329125926 h1:H5//xwVjDR02bQ1hLa3G7LnwccsudPMjBVt7WCx2y/U= github.com/oneclickvirt/UnlockTests v0.0.26-20250329125926 h1:H5//xwVjDR02bQ1hLa3G7LnwccsudPMjBVt7WCx2y/U=
github.com/oneclickvirt/UnlockTests v0.0.26-20250329125926/go.mod h1:yXWIZB6iLS88pEd9m4QJi1GENn+7I91zA72y5ONz2Oc= github.com/oneclickvirt/UnlockTests v0.0.26-20250329125926/go.mod h1:yXWIZB6iLS88pEd9m4QJi1GENn+7I91zA72y5ONz2Oc=
github.com/oneclickvirt/backtrace v0.0.4-20250329130043 h1:d3ubN7FTY2xDKN8mmLc1RbvccpTkvfMADtMBvFCRdt0= github.com/oneclickvirt/backtrace v0.0.5-20250411152044 h1:DaS97rh58IPDRElOk3CkZhYxhh1FRxp+veh0Y8hHtwo=
github.com/oneclickvirt/backtrace v0.0.4-20250329130043/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8= github.com/oneclickvirt/backtrace v0.0.5-20250411152044/go.mod h1:5AH00bo41hH3d2/JVuCTlBkZUs3AXX4nlKVXb6piZcI=
github.com/oneclickvirt/basics v0.0.11-20250404123515 h1:2kisK9tBG/Km/HLQFA82lm/B+AWFJp3drjrtGvz8lhw= github.com/oneclickvirt/basics v0.0.11-20250404123515 h1:2kisK9tBG/Km/HLQFA82lm/B+AWFJp3drjrtGvz8lhw=
github.com/oneclickvirt/basics v0.0.11-20250404123515/go.mod h1:yN1IEOXN6v/GJqJSA70Pooo6nXBI/6rq72vTY72wJMQ= github.com/oneclickvirt/basics v0.0.11-20250404123515/go.mod h1:yN1IEOXN6v/GJqJSA70Pooo6nXBI/6rq72vTY72wJMQ=
github.com/oneclickvirt/cputest v0.0.10-20250404151448 h1:ovGtCwFXG0qmpyNDRqcNDIiAmhrtemCjIUXTJ1fPH0o= github.com/oneclickvirt/cputest v0.0.10-20250404151448 h1:ovGtCwFXG0qmpyNDRqcNDIiAmhrtemCjIUXTJ1fPH0o=

View File

@@ -7,22 +7,21 @@ import (
"fmt" "fmt"
"github.com/oneclickvirt/CommonMediaTests/commediatests" "github.com/oneclickvirt/CommonMediaTests/commediatests"
unlocktestmodel "github.com/oneclickvirt/UnlockTests/model" unlocktestmodel "github.com/oneclickvirt/UnlockTests/model"
backtraceori "github.com/oneclickvirt/backtrace/bk" "github.com/oneclickvirt/backtrace/bk"
backtracemodel "github.com/oneclickvirt/backtrace/model"
basicmodel "github.com/oneclickvirt/basics/model" basicmodel "github.com/oneclickvirt/basics/model"
cputestmodel "github.com/oneclickvirt/cputest/model" cputestmodel "github.com/oneclickvirt/cputest/model"
disktestmodel "github.com/oneclickvirt/disktest/disk" disktestmodel "github.com/oneclickvirt/disktest/disk"
"github.com/oneclickvirt/ecs/backtrace"
"github.com/oneclickvirt/ecs/commediatest"
"github.com/oneclickvirt/ecs/cputest" "github.com/oneclickvirt/ecs/cputest"
"github.com/oneclickvirt/ecs/disktest" "github.com/oneclickvirt/ecs/disktest"
"github.com/oneclickvirt/ecs/memorytest" "github.com/oneclickvirt/ecs/memorytest"
"github.com/oneclickvirt/ecs/ntrace"
"github.com/oneclickvirt/ecs/speedtest" "github.com/oneclickvirt/ecs/speedtest"
"github.com/oneclickvirt/ecs/unlocktest" "github.com/oneclickvirt/ecs/unlocktest"
"github.com/oneclickvirt/ecs/utils" "github.com/oneclickvirt/ecs/utils"
gostunmodel "github.com/oneclickvirt/gostun/model" gostunmodel "github.com/oneclickvirt/gostun/model"
memorytestmodel "github.com/oneclickvirt/memorytest/memory" memorytestmodel "github.com/oneclickvirt/memorytest/memory"
nt3model "github.com/oneclickvirt/nt3/model" nt3model "github.com/oneclickvirt/nt3/model"
"github.com/oneclickvirt/nt3/nt"
ptmodel "github.com/oneclickvirt/pingtest/model" ptmodel "github.com/oneclickvirt/pingtest/model"
"github.com/oneclickvirt/pingtest/pt" "github.com/oneclickvirt/pingtest/pt"
"github.com/oneclickvirt/portchecker/email" "github.com/oneclickvirt/portchecker/email"
@@ -39,7 +38,7 @@ import (
) )
var ( var (
ecsVersion = "v0.1.28" ecsVersion = "v0.1.30"
menuMode bool menuMode bool
onlyChinaTest bool onlyChinaTest bool
input, choice string input, choice string
@@ -168,7 +167,7 @@ func main() {
commediatests.EnableLoger = true commediatests.EnableLoger = true
unlocktestmodel.EnableLoger = true unlocktestmodel.EnableLoger = true
ptmodel.EnableLoger = true ptmodel.EnableLoger = true
backtraceori.EnableLoger = true backtracemodel.EnableLoger = true
nt3model.EnableLoger = true nt3model.EnableLoger = true
speedtestmodel.EnableLoger = true speedtestmodel.EnableLoger = true
} }
@@ -444,7 +443,7 @@ func main() {
output = utils.PrintAndCapture(func() { output = utils.PrintAndCapture(func() {
if commTestStatus && !onlyChinaTest { if commTestStatus && !onlyChinaTest {
utils.PrintCenteredTitle("御三家流媒体解锁", width) utils.PrintCenteredTitle("御三家流媒体解锁", width)
commediatest.ComMediaTest(language) fmt.Printf(commediatests.MediaTests(language))
} }
}, tempOutput, output) }, tempOutput, output)
output = utils.PrintAndCapture(func() { output = utils.PrintAndCapture(func() {
@@ -471,14 +470,18 @@ func main() {
output = utils.PrintAndCapture(func() { output = utils.PrintAndCapture(func() {
if backtraceStatus && !onlyChinaTest { if backtraceStatus && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程线路检测", width) utils.PrintCenteredTitle("三网回程线路检测", width)
backtrace.BackTrace() if strings.Contains(output, "IPV6") {
backtrace.BackTrace(true)
} else {
backtrace.BackTrace(false)
}
} }
}, tempOutput, output) }, tempOutput, output)
// nexttrace 在win上不支持检测报错 bind: An invalid argument was supplied. // nexttrace 在win上不支持检测报错 bind: An invalid argument was supplied.
output = utils.PrintAndCapture(func() { output = utils.PrintAndCapture(func() {
if nt3Status && !onlyChinaTest { if nt3Status && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程路由检测", width) utils.PrintCenteredTitle("三网回程路由检测", width)
ntrace.TraceRoute3(language, nt3Location, nt3CheckType) nt.TraceRoute(language, nt3Location, nt3CheckType)
} }
}, tempOutput, output) }, tempOutput, output)
output = utils.PrintAndCapture(func() { output = utils.PrintAndCapture(func() {

View File

@@ -1,23 +1,21 @@
#!/bin/bash #!/bin/bash
# From https://github.com/oneclickvirt/ecs # From https://github.com/oneclickvirt/ecs
# 2025.04.02 # 2025.04.07
# curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh # curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
# 或 # 或
# curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh # curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh
cat <<"EOF" cat <<"EOF"
GGGGGGGG OOOOOOO EEEEEEEE CCCCCCCCC SSSSSSSSSS ,ad8888ba, ,ad8888ba, 88888888888 ,ad8888ba, ad88888ba
GG GG OO OO EE CC SS d8"' `"8b d8"' `"8b 88 d8"' `"8b d8" "8b
GG OO OO EE CC SS d8' d8' `8b 88 d8' Y8a
GG OO OO EE CC SS 88 88 88 88aaaaa 88 `"Y8aaaaa,
GG OO OO EEEEEEEE CC SSSSSSSSSS 88 88888 88 88 88""""" 88 `"""""8b,
GG GGGGGG OO OO EE CC SS Y8, 88 Y8, ,8P 88 Y8, `8b
GG GG OO OO EE CC SS Y8a. .a88 Y8a. .a8P 88 Y8a. .a8P Y8a a8P
GG GG OO OO EE CC SS `"Y88888P" `"Y8888Y"' 88888888888 `"Y8888Y"' "Y88888P"
GGGGGGGG OOOOOOO EEEEEEEE CCCCCCCCC SSSSSSSSSS
EOF EOF
cd /root >/dev/null 2>&1 cd /root >/dev/null 2>&1
if [ ! -d "/usr/bin/" ]; then if [ ! -d "/usr/bin/" ]; then
mkdir -p "/usr/bin/" mkdir -p "/usr/bin/"
@@ -139,8 +137,8 @@ goecs_check() {
sleep 1 sleep 1
done done
if [ -z "$ECS_VERSION" ]; then if [ -z "$ECS_VERSION" ]; then
_yellow "Unable to get version info, using default version 0.1.28" _yellow "Unable to get version info, using default version 0.1.30"
ECS_VERSION="0.1.28" ECS_VERSION="0.1.30"
fi fi
# Check if original goecs command exists # Check if original goecs command exists
version_output="" version_output=""
@@ -232,7 +230,23 @@ goecs_check() {
_red "Download failed, please check your network connection or download manually" _red "Download failed, please check your network connection or download manually"
return 1 return 1
fi fi
# Extract and install with error handling if ! command -v unzip >/dev/null 2>&1; then
_green "Installing $cmd"
if command -v apt-get >/dev/null 2>&1; then
INSTALL_CMD="apt-get -y install"
elif command -v yum >/dev/null 2>&1; then
INSTALL_CMD="yum -y install"
elif command -v dnf >/dev/null 2>&1; then
INSTALL_CMD="dnf -y install"
elif command -v pacman >/dev/null 2>&1; then
INSTALL_CMD="pacman -S --noconfirm"
elif command -v apk >/dev/null 2>&1; then
INSTALL_CMD="apk add"
elif command -v zypper >/dev/null 2>&1; then
INSTALL_CMD="zypper install -y"
fi
${INSTALL_CMD} "$cmd"
fi
if ! unzip -o goecs.zip >/dev/null 2>&1; then if ! unzip -o goecs.zip >/dev/null 2>&1; then
_red "Extraction failed" _red "Extraction failed"
return 1 return 1
@@ -461,35 +475,30 @@ env_check() {
# If system is unrecognized, try common package managers # If system is unrecognized, try common package managers
if [ -z "$SYSTEM" ]; then if [ -z "$SYSTEM" ]; then
_yellow "Unable to recognize system, trying common package managers..." _yellow "Unable to recognize system, trying common package managers..."
# Try apt
if command -v apt-get >/dev/null 2>&1; then if command -v apt-get >/dev/null 2>&1; then
SYSTEM="Unknown-Debian" SYSTEM="Unknown-Debian"
UPDATE_CMD="apt-get update" UPDATE_CMD="apt-get update"
INSTALL_CMD="apt-get -y install" INSTALL_CMD="apt-get -y install"
REMOVE_CMD="apt-get -y remove" REMOVE_CMD="apt-get -y remove"
UNINSTALL_CMD="apt-get -y autoremove" UNINSTALL_CMD="apt-get -y autoremove"
# Try yum
elif command -v yum >/dev/null 2>&1; then elif command -v yum >/dev/null 2>&1; then
SYSTEM="Unknown-RHEL" SYSTEM="Unknown-RHEL"
UPDATE_CMD="yum -y update" UPDATE_CMD="yum -y update"
INSTALL_CMD="yum -y install" INSTALL_CMD="yum -y install"
REMOVE_CMD="yum -y remove" REMOVE_CMD="yum -y remove"
UNINSTALL_CMD="yum -y autoremove" UNINSTALL_CMD="yum -y autoremove"
# Try dnf
elif command -v dnf >/dev/null 2>&1; then elif command -v dnf >/dev/null 2>&1; then
SYSTEM="Unknown-Fedora" SYSTEM="Unknown-Fedora"
UPDATE_CMD="dnf -y update" UPDATE_CMD="dnf -y update"
INSTALL_CMD="dnf -y install" INSTALL_CMD="dnf -y install"
REMOVE_CMD="dnf -y remove" REMOVE_CMD="dnf -y remove"
UNINSTALL_CMD="dnf -y autoremove" UNINSTALL_CMD="dnf -y autoremove"
# Try pacman
elif command -v pacman >/dev/null 2>&1; then elif command -v pacman >/dev/null 2>&1; then
SYSTEM="Unknown-Arch" SYSTEM="Unknown-Arch"
UPDATE_CMD="pacman -Sy" UPDATE_CMD="pacman -Sy"
INSTALL_CMD="pacman -S --noconfirm" INSTALL_CMD="pacman -S --noconfirm"
REMOVE_CMD="pacman -R --noconfirm" REMOVE_CMD="pacman -R --noconfirm"
UNINSTALL_CMD="pacman -Rns --noconfirm" UNINSTALL_CMD="pacman -Rns --noconfirm"
# Try apk
elif command -v apk >/dev/null 2>&1; then elif command -v apk >/dev/null 2>&1; then
SYSTEM="Unknown-Alpine" SYSTEM="Unknown-Alpine"
UPDATE_CMD="apk update" UPDATE_CMD="apk update"