Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritysdx committed Jul 4, 2024
1 parent 8af46d4 commit f0b89d4
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 26 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.4

require (
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/backtrace v0.0.4-20240702140722
github.com/oneclickvirt/basics v0.0.5-20240702055351
Expand All @@ -17,7 +17,7 @@ require (
github.com/oneclickvirt/pingtest v0.0.4-20240703142340
github.com/oneclickvirt/portchecker v0.0.1-20240624155429
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 (
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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/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/oneclickvirt/CommonMediaTests v0.0.3-20240702073302 h1:JbgWWVL6WR44H/dqpBLdet0M7lM/YrnwGEG40FmawRo=
github.com/oneclickvirt/CommonMediaTests v0.0.3-20240702073302/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502 h1:hRIYJ2uEp2N3AH5bP5X6bwfdwWfZQO/2WoqpUJ8+WsY=
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/go.mod h1:HP3CvAS+AJWxxY+BVbxIOlvaQ87YOSge89vAMG52b5o=
github.com/oneclickvirt/backtrace v0.0.4-20240702140722 h1:UJ/VWf+ZbhGarc9HcHMIyenpmX+b2LxkXu0hlLk3Gxs=
Expand All @@ -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/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/speedtest v0.0.6-20240702134926 h1:1aF6O9iFZGD7iabb9BB3O8MDL9/guuXJlRdsfJMs+dI=
github.com/oneclickvirt/speedtest v0.0.6-20240702134926/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
github.com/oneclickvirt/speedtest v0.0.7-20240704023701 h1:F8ChZXf3U1/bUk+dCFt0Gc01LSPLhbBhCeHjkEJ6K88=
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/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
Expand Down
21 changes: 7 additions & 14 deletions goecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
)

var (
ecsVersion = "v0.0.33"
ecsVersion = "v0.0.34"
menuMode bool
onlyChinaTest bool
input, choice string
Expand Down Expand Up @@ -357,12 +357,12 @@ func main() {
speedtest.ShowHead(language)
if (menuMode && choice == "1") || !menuMode {
speedtest.NearbySP()
speedtest.CustomSP("net", "global", 2)
speedtest.CustomSP("net", "cu", spNum)
speedtest.CustomSP("net", "ct", spNum)
speedtest.CustomSP("net", "cmcc", spNum)
speedtest.CustomSP("net", "global", 2, language)
speedtest.CustomSP("net", "cu", spNum, language)
speedtest.CustomSP("net", "ct", spNum, language)
speedtest.CustomSP("net", "cmcc", spNum, language)
} else if menuMode && choice == "2" || choice == "3" || choice == "4" || choice == "5" {
speedtest.CustomSP("net", "global", 4)
speedtest.CustomSP("net", "global", 4, language)
}
}
}, tempOutput, output)
Expand Down Expand Up @@ -415,12 +415,6 @@ func main() {
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() {
if utTestStatus {
utils.PrintCenteredTitle("Cross-Border Streaming Media Unlock", width)
Expand All @@ -445,10 +439,9 @@ func main() {
utils.PrintCenteredTitle("Nearby Node Speed Test", width)
speedtest.ShowHead(language)
speedtest.NearbySP()
speedtest.CustomSP("net", "global", -1)
speedtest.CustomSP("net", "global", -1, language)
}
}, tempOutput, output)

endTime := time.Now()
duration := endTime.Sub(startTime)
minutes := int(duration.Minutes())
Expand Down
21 changes: 18 additions & 3 deletions goecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ goecs_check() {
# 检测原始goecs命令是否存在,若存在则升级,不存在则安装
version_output=$(goecs -v command 2>/dev/null || ./goecs -v command 2>/dev/null)
if [ $? -eq 0 ]; then
extracted_version=$(echo "${version_output//v/}")
extracted_version=${version_output//v/}
if [ -n "$extracted_version" ]; then
ecs_version=$ECS_VERSION
if [[ "$(echo -e "$extracted_version\n$ecs_version" | sort -V | tail -n 1)" == "$extracted_version" ]]; then
Expand Down Expand Up @@ -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_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")
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)")
SYS="${CMD[0]}"
if [ -s /etc/os-release ]; then
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
for ((int = 0; int < ${#REGEX[@]}; int++)); do
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
Expand Down
6 changes: 3 additions & 3 deletions speedtest/sp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
if strings.ToLower(platform) == "cn" {
if strings.ToLower(operator) == "cmcc" {
Expand Down Expand Up @@ -59,8 +59,8 @@ func CustomSP(platform, operator string, num int) {
parseType = "id"
}
if runtime.GOOS == "windows" || sp.OfficialAvailableTest() != nil {
sp.CustomSpeedTest(url, parseType, num)
sp.CustomSpeedTest(url, parseType, num, language)
} else {
sp.OfficialCustomSpeedTest(url, parseType, num)
sp.OfficialCustomSpeedTest(url, parseType, num, language)
}
}

0 comments on commit f0b89d4

Please sign in to comment.