mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-29 12:42:12 +08:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
df735880fe | ||
![]() |
f0b89d4168 |
4
go.mod
4
go.mod
@@ -4,7 +4,7 @@ go 1.22.4
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/imroc/req/v3 v3.43.7
|
github.com/imroc/req/v3 v3.43.7
|
||||||
github.com/oneclickvirt/CommonMediaTests v0.0.3-20240702073302
|
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502
|
||||||
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930
|
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930
|
||||||
github.com/oneclickvirt/backtrace v0.0.4-20240702140722
|
github.com/oneclickvirt/backtrace v0.0.4-20240702140722
|
||||||
github.com/oneclickvirt/basics v0.0.5-20240702055351
|
github.com/oneclickvirt/basics v0.0.5-20240702055351
|
||||||
@@ -17,7 +17,7 @@ require (
|
|||||||
github.com/oneclickvirt/pingtest v0.0.4-20240703142340
|
github.com/oneclickvirt/pingtest v0.0.4-20240703142340
|
||||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429
|
github.com/oneclickvirt/portchecker v0.0.1-20240624155429
|
||||||
github.com/oneclickvirt/security v0.0.4-20240702055848
|
github.com/oneclickvirt/security v0.0.4-20240702055848
|
||||||
github.com/oneclickvirt/speedtest v0.0.6-20240702134926
|
github.com/oneclickvirt/speedtest v0.0.7-20240704023701
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
8
go.sum
8
go.sum
@@ -75,8 +75,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
|
|||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/nxtrace/NTrace-core v1.3.1 h1:f4z5UaZEuhUP/g6xElpZ2bo+guWITJVrMKrJTqd27oc=
|
github.com/nxtrace/NTrace-core v1.3.1 h1:f4z5UaZEuhUP/g6xElpZ2bo+guWITJVrMKrJTqd27oc=
|
||||||
github.com/nxtrace/NTrace-core v1.3.1/go.mod h1:0Px/Zc60qk6cssmP+yv4kstFxvX9sXqDduoVqBO+qf8=
|
github.com/nxtrace/NTrace-core v1.3.1/go.mod h1:0Px/Zc60qk6cssmP+yv4kstFxvX9sXqDduoVqBO+qf8=
|
||||||
github.com/oneclickvirt/CommonMediaTests v0.0.3-20240702073302 h1:JbgWWVL6WR44H/dqpBLdet0M7lM/YrnwGEG40FmawRo=
|
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502 h1:hRIYJ2uEp2N3AH5bP5X6bwfdwWfZQO/2WoqpUJ8+WsY=
|
||||||
github.com/oneclickvirt/CommonMediaTests v0.0.3-20240702073302/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
|
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
|
||||||
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930 h1:/Sc4Eas1Pso18ak93wlazkuMKRRElCntITja/0opOpM=
|
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930 h1:/Sc4Eas1Pso18ak93wlazkuMKRRElCntITja/0opOpM=
|
||||||
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930/go.mod h1:HP3CvAS+AJWxxY+BVbxIOlvaQ87YOSge89vAMG52b5o=
|
github.com/oneclickvirt/UnlockTests v0.0.10-20240630044930/go.mod h1:HP3CvAS+AJWxxY+BVbxIOlvaQ87YOSge89vAMG52b5o=
|
||||||
github.com/oneclickvirt/backtrace v0.0.4-20240702140722 h1:UJ/VWf+ZbhGarc9HcHMIyenpmX+b2LxkXu0hlLk3Gxs=
|
github.com/oneclickvirt/backtrace v0.0.4-20240702140722 h1:UJ/VWf+ZbhGarc9HcHMIyenpmX+b2LxkXu0hlLk3Gxs=
|
||||||
@@ -101,8 +101,8 @@ github.com/oneclickvirt/portchecker v0.0.1-20240624155429 h1:+wapaOcFrg1iWJDhBKT
|
|||||||
github.com/oneclickvirt/portchecker v0.0.1-20240624155429/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
|
github.com/oneclickvirt/portchecker v0.0.1-20240624155429/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
|
||||||
github.com/oneclickvirt/security v0.0.4-20240702055848 h1:UCfjfoslcfKhCvJm37jQmhJ+O8d4lL+uvBJVcLAXc2s=
|
github.com/oneclickvirt/security v0.0.4-20240702055848 h1:UCfjfoslcfKhCvJm37jQmhJ+O8d4lL+uvBJVcLAXc2s=
|
||||||
github.com/oneclickvirt/security v0.0.4-20240702055848/go.mod h1:YKmO3FRWjhHYJ5rKqz+1H3hB6sCA4gioik7r8GMfyqo=
|
github.com/oneclickvirt/security v0.0.4-20240702055848/go.mod h1:YKmO3FRWjhHYJ5rKqz+1H3hB6sCA4gioik7r8GMfyqo=
|
||||||
github.com/oneclickvirt/speedtest v0.0.6-20240702134926 h1:1aF6O9iFZGD7iabb9BB3O8MDL9/guuXJlRdsfJMs+dI=
|
github.com/oneclickvirt/speedtest v0.0.7-20240704023701 h1:F8ChZXf3U1/bUk+dCFt0Gc01LSPLhbBhCeHjkEJ6K88=
|
||||||
github.com/oneclickvirt/speedtest v0.0.6-20240702134926/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
github.com/oneclickvirt/speedtest v0.0.7-20240704023701/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
||||||
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
|
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
|
||||||
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
|
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
|
||||||
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
|
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
|
||||||
|
23
goecs.go
23
goecs.go
@@ -36,7 +36,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ecsVersion = "v0.0.33"
|
ecsVersion = "v0.0.35"
|
||||||
menuMode bool
|
menuMode bool
|
||||||
onlyChinaTest bool
|
onlyChinaTest bool
|
||||||
input, choice string
|
input, choice string
|
||||||
@@ -357,12 +357,12 @@ func main() {
|
|||||||
speedtest.ShowHead(language)
|
speedtest.ShowHead(language)
|
||||||
if (menuMode && choice == "1") || !menuMode {
|
if (menuMode && choice == "1") || !menuMode {
|
||||||
speedtest.NearbySP()
|
speedtest.NearbySP()
|
||||||
speedtest.CustomSP("net", "global", 2)
|
speedtest.CustomSP("net", "global", 2, language)
|
||||||
speedtest.CustomSP("net", "cu", spNum)
|
speedtest.CustomSP("net", "cu", spNum, language)
|
||||||
speedtest.CustomSP("net", "ct", spNum)
|
speedtest.CustomSP("net", "ct", spNum, language)
|
||||||
speedtest.CustomSP("net", "cmcc", spNum)
|
speedtest.CustomSP("net", "cmcc", spNum, language)
|
||||||
} else if menuMode && choice == "2" || choice == "3" || choice == "4" || choice == "5" {
|
} else if menuMode && choice == "2" || choice == "3" || choice == "4" || choice == "5" {
|
||||||
speedtest.CustomSP("net", "global", 4)
|
speedtest.CustomSP("net", "global", 4, language)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, tempOutput, output)
|
}, tempOutput, output)
|
||||||
@@ -415,12 +415,6 @@ func main() {
|
|||||||
emailInfo = email.EmailCheck()
|
emailInfo = email.EmailCheck()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
output = utils.PrintAndCapture(func() {
|
|
||||||
if commTestStatus {
|
|
||||||
utils.PrintCenteredTitle("The Three Main Streaming Media Unlock", width)
|
|
||||||
commediatest.ComMediaTest(language)
|
|
||||||
}
|
|
||||||
}, tempOutput, output)
|
|
||||||
output = utils.PrintAndCapture(func() {
|
output = utils.PrintAndCapture(func() {
|
||||||
if utTestStatus {
|
if utTestStatus {
|
||||||
utils.PrintCenteredTitle("Cross-Border Streaming Media Unlock", width)
|
utils.PrintCenteredTitle("Cross-Border Streaming Media Unlock", width)
|
||||||
@@ -445,10 +439,9 @@ func main() {
|
|||||||
utils.PrintCenteredTitle("Nearby Node Speed Test", width)
|
utils.PrintCenteredTitle("Nearby Node Speed Test", width)
|
||||||
speedtest.ShowHead(language)
|
speedtest.ShowHead(language)
|
||||||
speedtest.NearbySP()
|
speedtest.NearbySP()
|
||||||
speedtest.CustomSP("net", "global", -1)
|
speedtest.CustomSP("net", "global", -1, language)
|
||||||
}
|
}
|
||||||
}, tempOutput, output)
|
}, tempOutput, output)
|
||||||
|
|
||||||
endTime := time.Now()
|
endTime := time.Now()
|
||||||
duration := endTime.Sub(startTime)
|
duration := endTime.Sub(startTime)
|
||||||
minutes := int(duration.Minutes())
|
minutes := int(duration.Minutes())
|
||||||
@@ -456,7 +449,7 @@ func main() {
|
|||||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||||
output = utils.PrintAndCapture(func() {
|
output = utils.PrintAndCapture(func() {
|
||||||
utils.PrintCenteredTitle("", width)
|
utils.PrintCenteredTitle("", width)
|
||||||
fmt.Printf("Cost Time : %d 分 %d 秒\n", minutes, seconds)
|
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
|
||||||
fmt.Printf("Current Time : %s\n", currentTime)
|
fmt.Printf("Current Time : %s\n", currentTime)
|
||||||
utils.PrintCenteredTitle("", width)
|
utils.PrintCenteredTitle("", width)
|
||||||
}, tempOutput, output)
|
}, tempOutput, output)
|
||||||
|
21
goecs.sh
21
goecs.sh
@@ -61,7 +61,7 @@ goecs_check() {
|
|||||||
# 检测原始goecs命令是否存在,若存在则升级,不存在则安装
|
# 检测原始goecs命令是否存在,若存在则升级,不存在则安装
|
||||||
version_output=$(goecs -v command 2>/dev/null || ./goecs -v command 2>/dev/null)
|
version_output=$(goecs -v command 2>/dev/null || ./goecs -v command 2>/dev/null)
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
extracted_version=$(echo "${version_output//v/}")
|
extracted_version=${version_output//v/}
|
||||||
if [ -n "$extracted_version" ]; then
|
if [ -n "$extracted_version" ]; then
|
||||||
ecs_version=$ECS_VERSION
|
ecs_version=$ECS_VERSION
|
||||||
if [[ "$(echo -e "$extracted_version\n$ecs_version" | sort -V | tail -n 1)" == "$extracted_version" ]]; then
|
if [[ "$(echo -e "$extracted_version\n$ecs_version" | sort -V | tail -n 1)" == "$extracted_version" ]]; then
|
||||||
@@ -233,8 +233,23 @@ env_check() {
|
|||||||
PACKAGE_INSTALL=("apt-get -y install" "apt-get -y install" "yum -y install" "yum -y install" "yum -y install" "pacman -Sy --noconfirm --needed" "pkg install -y" "apk add")
|
PACKAGE_INSTALL=("apt-get -y install" "apt-get -y install" "yum -y install" "yum -y install" "yum -y install" "pacman -Sy --noconfirm --needed" "pkg install -y" "apk add")
|
||||||
PACKAGE_REMOVE=("apt-get -y remove" "apt-get -y remove" "yum -y remove" "yum -y remove" "yum -y remove" "pacman -Rsc --noconfirm" "pkg delete" "apk del")
|
PACKAGE_REMOVE=("apt-get -y remove" "apt-get -y remove" "yum -y remove" "yum -y remove" "yum -y remove" "pacman -Rsc --noconfirm" "pkg delete" "apk del")
|
||||||
PACKAGE_UNINSTALL=("apt-get -y autoremove" "apt-get -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove" "" "pkg autoremove" "apk autoremove")
|
PACKAGE_UNINSTALL=("apt-get -y autoremove" "apt-get -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove" "" "pkg autoremove" "apk autoremove")
|
||||||
CMD=("$(grep -i pretty_name /etc/os-release 2>/dev/null | cut -d \" -f2)" "$(hostnamectl 2>/dev/null | grep -i system | cut -d : -f2)" "$(lsb_release -sd 2>/dev/null)" "$(grep -i description /etc/lsb-release 2>/dev/null | cut -d \" -f2)" "$(grep . /etc/redhat-release 2>/dev/null)" "$(grep . /etc/issue 2>/dev/null | cut -d \\ -f1 | sed '/^[ ]*$/d')" "$(grep -i pretty_name /etc/os-release 2>/dev/null | cut -d \" -f2)" "$(uname -s)" "$(uname -s)")
|
if [ -s /etc/os-release ]; then
|
||||||
SYS="${CMD[0]}"
|
SYS="$(grep -i pretty_name /etc/os-release | cut -d \" -f2)"
|
||||||
|
elif [ -x "$(type -p hostnamectl)" ]; then
|
||||||
|
SYS="$(hostnamectl | grep -i system | cut -d : -f2)"
|
||||||
|
elif [ -x "$(type -p lsb_release)" ]; then
|
||||||
|
SYS="$(lsb_release -sd)"
|
||||||
|
elif [ -s /etc/lsb-release ]; then
|
||||||
|
SYS="$(grep -i description /etc/lsb-release | cut -d \" -f2)"
|
||||||
|
elif [ -s /etc/redhat-release ]; then
|
||||||
|
SYS="$(grep . /etc/redhat-release)"
|
||||||
|
elif [ -s /etc/issue ]; then
|
||||||
|
SYS="$(grep . /etc/issue | cut -d '\' -f1 | sed '/^[ ]*$/d')"
|
||||||
|
elif [ -f /etc/alpine-release ]; then
|
||||||
|
SYS="alpine"
|
||||||
|
else
|
||||||
|
SYS="$(uname -s)}"
|
||||||
|
fi
|
||||||
[[ -n $SYS ]] || exit 1
|
[[ -n $SYS ]] || exit 1
|
||||||
for ((int = 0; int < ${#REGEX[@]}; int++)); do
|
for ((int = 0; int < ${#REGEX[@]}; int++)); do
|
||||||
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
|
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
|
||||||
|
@@ -19,7 +19,7 @@ func NearbySP() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CustomSP(platform, operator string, num int) {
|
func CustomSP(platform, operator string, num int, language string) {
|
||||||
var url, parseType string
|
var url, parseType string
|
||||||
if strings.ToLower(platform) == "cn" {
|
if strings.ToLower(platform) == "cn" {
|
||||||
if strings.ToLower(operator) == "cmcc" {
|
if strings.ToLower(operator) == "cmcc" {
|
||||||
@@ -59,8 +59,8 @@ func CustomSP(platform, operator string, num int) {
|
|||||||
parseType = "id"
|
parseType = "id"
|
||||||
}
|
}
|
||||||
if runtime.GOOS == "windows" || sp.OfficialAvailableTest() != nil {
|
if runtime.GOOS == "windows" || sp.OfficialAvailableTest() != nil {
|
||||||
sp.CustomSpeedTest(url, parseType, num)
|
sp.CustomSpeedTest(url, parseType, num, language)
|
||||||
} else {
|
} else {
|
||||||
sp.OfficialCustomSpeedTest(url, parseType, num)
|
sp.OfficialCustomSpeedTest(url, parseType, num, language)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user