mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-27 19:52:08 +08:00
Compare commits
73 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d6302be4ae | ||
![]() |
a8366005dc | ||
![]() |
4e3249b590 | ||
![]() |
8a52f6df76 | ||
![]() |
ebe85216bb | ||
![]() |
7909d4ba78 | ||
![]() |
4939d155d8 | ||
![]() |
d69f85d0db | ||
![]() |
f4dea6ce6e | ||
![]() |
bc596e8e48 | ||
![]() |
116ae33505 | ||
![]() |
a32846638b | ||
![]() |
d84fb21f82 | ||
![]() |
f199336cf0 | ||
![]() |
a1196ab8d2 | ||
![]() |
9431fe3944 | ||
![]() |
5dcef9f4c3 | ||
![]() |
865ca62f06 | ||
![]() |
eea78a7c30 | ||
![]() |
2f5feace7b | ||
![]() |
615ffca90f | ||
![]() |
685fe735f6 | ||
![]() |
5545990854 | ||
![]() |
91d1aa4461 | ||
![]() |
94f9576383 | ||
![]() |
ef91a61d22 | ||
![]() |
bafd77e2f5 | ||
![]() |
eb03d50cd2 | ||
![]() |
dbd921d8ca | ||
![]() |
8b9df2c385 | ||
![]() |
ce57c141a0 | ||
![]() |
da3dc7e11e | ||
![]() |
d4cbd0772a | ||
![]() |
2ff558ae7b | ||
![]() |
f5d9752e89 | ||
![]() |
1f563c823a | ||
![]() |
807141751a | ||
![]() |
e55a18b3de | ||
![]() |
920054c844 | ||
![]() |
3c5405dd07 | ||
![]() |
a33702f164 | ||
![]() |
daf07945dc | ||
![]() |
88b39c0ae3 | ||
![]() |
65ddb32d74 | ||
![]() |
acf2f0e98c | ||
![]() |
e63dc4d3f4 | ||
![]() |
7fb4e358e8 | ||
![]() |
15ba7fb00f | ||
![]() |
916f21a72f | ||
![]() |
f00d5db69c | ||
![]() |
6dbb171d3b | ||
![]() |
0921aef041 | ||
![]() |
dd4a4e317b | ||
![]() |
d80f3451ff | ||
![]() |
ebce9e493d | ||
![]() |
176899d3e9 | ||
![]() |
e58da9e921 | ||
![]() |
651bbb94d0 | ||
![]() |
91ffbfa417 | ||
![]() |
84b0303468 | ||
![]() |
f3e10a999b | ||
![]() |
76a6e09d97 | ||
![]() |
9c9dbc6200 | ||
![]() |
20c8063e5e | ||
![]() |
fbe5eb8e58 | ||
![]() |
290f0d8d8c | ||
![]() |
140347c2a6 | ||
![]() |
aeda7a6e88 | ||
![]() |
a205ca38be | ||
![]() |
43bf9c81ed | ||
![]() |
d47f8987a7 | ||
![]() |
ffbe5a539a | ||
![]() |
4b8ae06df8 |
13
.github/workflows/build_docker.yaml
vendored
13
.github/workflows/build_docker.yaml
vendored
@@ -24,7 +24,14 @@ jobs:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
- name: Login to CNB Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ secrets.CNB_DOCKER_REGISTRY }}
|
||||
username: ${{ secrets.CNB_USERNAME }}
|
||||
password: ${{ secrets.CNB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker images
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
@@ -32,4 +39,6 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/riscv64
|
||||
# linux/mips,linux/mipsle 暂不支持 alpine, linux/s390x 编译卡死
|
||||
push: true
|
||||
tags: ${{ secrets.DOCKER_USERNAME }}/goecs:latest
|
||||
tags: |
|
||||
${{ secrets.DOCKER_USERNAME }}/goecs:latest
|
||||
${{ secrets.CNB_DOCKER_REGISTRY }}/oneclickvirt/ecs:latest
|
||||
|
66
.github/workflows/ci.yaml_back
vendored
66
.github/workflows/ci.yaml_back
vendored
@@ -1,66 +0,0 @@
|
||||
name: go-ci
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: set up
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.22.4
|
||||
id: go
|
||||
- name: check out
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache
|
||||
uses: actions/cache@v2.1.0
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Configure Git for Private Modules
|
||||
run: |
|
||||
git config --global url."https://${{ secrets.GHT }}@github.com/".insteadOf "https://github.com/"
|
||||
git config --global url."git@github.com:".insteadOf "https://github.com/"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
env:
|
||||
GOPRIVATE: github.com/oneclickvirt/security
|
||||
GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
|
||||
build:
|
||||
needs: setup
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure Git for Private Modules
|
||||
run: |
|
||||
git config --global url."https://${{ secrets.GHT }}@github.com/".insteadOf "https://github.com/"
|
||||
git config --global url."git@github.com:".insteadOf "https://github.com/"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
- name: build
|
||||
run: go build ./...
|
||||
env:
|
||||
GOPRIVATE: github.com/oneclickvirt/security
|
||||
GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
|
||||
# test:
|
||||
# needs: setup
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v3
|
||||
# - name: Configure Git for Private Modules
|
||||
# run: |
|
||||
# git config --global url."https://${{ secrets.GHT }}@github.com/".insteadOf "https://github.com/"
|
||||
# git config --global url."git@github.com:".insteadOf "https://github.com/"
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
# - name: test
|
||||
# run: go test ./goecs_test.go
|
||||
# env:
|
||||
# GOPRIVATE: github.com/oneclickvirt/security
|
||||
# GITHUB_TOKEN: ${{ secrets.GHT }}
|
2
.github/workflows/main.yaml
vendored
2
.github/workflows/main.yaml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.22.4
|
||||
go-version: 1.23.4
|
||||
|
||||
- name: Configure Git for Private Modules
|
||||
run: |
|
||||
|
80
.github/workflows/public-build.yml
vendored
Normal file
80
.github/workflows/public-build.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
name: Public Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23.4'
|
||||
|
||||
- name: Create public branch
|
||||
run: |
|
||||
git config --global user.name 'GitHub Actions'
|
||||
git config --global user.email 'actions@github.com'
|
||||
git checkout -b public || git checkout public
|
||||
git merge ${{ github.ref_name }} --no-edit || true
|
||||
|
||||
- name: Remove security package references
|
||||
run: |
|
||||
# 移除 network 包中对 security 的引用
|
||||
find . -type f -name "*.go" -exec sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' {} +
|
||||
|
||||
# 修改 network/network.go
|
||||
cat > network/network.go << 'EOF'
|
||||
package network1
|
||||
|
||||
import "github.com/oneclickvirt/basics/network"
|
||||
|
||||
func NetworkCheck(checkType string, enableSecurityCheck bool, language string) (string, string, error) {
|
||||
ipInfo, _, err := network.NetworkCheck(checkType, false, language)
|
||||
return ipInfo, "", err
|
||||
}
|
||||
EOF
|
||||
|
||||
# 修改 utils/utils.go 中的 BasicsAndSecurityCheck 函数
|
||||
sed -i '/SecurityUploadToken/d' utils/utils.go
|
||||
sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' utils/utils.go
|
||||
|
||||
# 在 utils/utils.go 中添加 token 常量(在 import 语句之后)
|
||||
sed -i '/^import/,/^)/{/^)/a\'$'\n''const token = "OvwKx5qgJtf7PZgCKbtyojSU.MTcwMTUxNzY1MTgwMw"'$'\n''}' utils/utils.go
|
||||
|
||||
# 修改 go.mod,移除私有仓库依赖
|
||||
sed -i '/github.com\/oneclickvirt\/security/d' go.mod
|
||||
|
||||
# 修改 goecs.go,禁用 security 检测
|
||||
sed -i 's|var securityFlag = flag.Bool("security", true,|var securityFlag = flag.Bool("security", false,|g' goecs.go
|
||||
|
||||
# 更新依赖
|
||||
go mod tidy
|
||||
|
||||
# 修改 README.md 和 README_EN.md 中的敏感信息
|
||||
sed -i 's|但二进制文件编译至 \[securityCheck\].*)|但已开源|g' README.md
|
||||
sed -i 's|but binary files compiled in \[securityCheck\].*)|but open sourced|g' README_EN.md
|
||||
|
||||
# 修改命令行帮助信息
|
||||
sed -i 's|security.*Enable/Disable security test (default true)|security Enable/Disable security test (default false)|g' README.md
|
||||
sed -i 's|security.*Enable/Disable security test (default true)|security Enable/Disable security test (default false)|g' README_EN.md
|
||||
|
||||
- name: Build and Test
|
||||
run: |
|
||||
# 构建二进制文件
|
||||
go build -o main
|
||||
|
||||
# 测试无菜单模式是否正常运行(禁用 security 检测)
|
||||
./main -menu=false -l en -security=false -upload=false || exit 1
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git add .
|
||||
git commit -m "Auto update public version (no security package)" || echo "No changes to commit"
|
||||
git push -f origin public
|
56
.github/workflows/sync.yaml
vendored
Normal file
56
.github/workflows/sync.yaml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Sync Latest Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sync-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout source repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get latest release
|
||||
id: get_release
|
||||
run: |
|
||||
echo "RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
|
||||
|
||||
- name: Create temporary directory
|
||||
run: |
|
||||
mkdir -p temp_repo
|
||||
cd temp_repo
|
||||
git init
|
||||
git config --local user.name "GitHub Action"
|
||||
git config --local user.email "action@github.com"
|
||||
|
||||
- name: Copy repository files
|
||||
run: |
|
||||
cp goecs.sh temp_repo/
|
||||
cp README_EN.md temp_repo/
|
||||
cp README.md temp_repo/
|
||||
cp LICENSE temp_repo/
|
||||
|
||||
- name: Download release assets
|
||||
run: |
|
||||
cd temp_repo
|
||||
gh release download ${{ env.RELEASE_TAG }} --repo ${{ github.repository }} --dir .
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Push to target repository
|
||||
run: |
|
||||
cd temp_repo
|
||||
git add .
|
||||
git commit -m "Sync release ${{ env.RELEASE_TAG }} from ${{ github.repository }}"
|
||||
git branch -M main
|
||||
git remote add target https://cnb.cool/oneclickvirt/ecs.git
|
||||
echo "machine cnb.cool login ${{ secrets.CNB_USERNAME }} password ${{ secrets.CNB_TOKEN }}" > ~/.netrc
|
||||
chmod 600 ~/.netrc
|
||||
git push -f target main
|
||||
env:
|
||||
CNB_USERNAME: ${{ secrets.CNB_USERNAME }}
|
||||
CNB_TOKEN: ${{ secrets.CNB_TOKEN }}
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
vendor/
|
||||
vendor/
|
||||
.idea/
|
@@ -6,7 +6,7 @@ builds:
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
|
||||
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
@@ -33,7 +33,7 @@ builds:
|
||||
- CC=o64-clang
|
||||
- CXX=o64-clang++
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
|
||||
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
|
||||
goos:
|
||||
- darwin
|
||||
goarch:
|
||||
@@ -46,7 +46,7 @@ builds:
|
||||
- CC=oa64-clang
|
||||
- CXX=oa64-clang++
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
|
||||
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
|
||||
goos:
|
||||
- darwin
|
||||
goarch:
|
||||
@@ -75,4 +75,4 @@ changelog:
|
||||
- Merge pull request
|
||||
- Merge branch
|
||||
- go mod tidy
|
||||
- New translations
|
||||
- New translations
|
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
9
.idea/ecs.iml
generated
9
.idea/ecs.iml
generated
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/ecs.iml" filepath="$PROJECT_DIR$/.idea/ecs.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
8
.idea/sshConfigs.xml
generated
8
.idea/sshConfigs.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SshConfigs">
|
||||
<configs>
|
||||
<sshConfig authType="PASSWORD" host="49.234.158.14" id="950b8219-3ab3-47e7-ad76-6b6a5d0857b0" port="22" nameFormat="DESCRIPTIVE" username="root" useOpenSSHConfig="true" />
|
||||
</configs>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@@ -1,17 +1,14 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
# 安装必要的工具
|
||||
RUN apk add --no-cache wget curl bash
|
||||
RUN apk add --no-cache bind-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
|
||||
RUN apk add --no-cache bind-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
|
||||
RUN apk add --no-cache grep openssl ca-certificates uuidgen
|
||||
|
||||
RUN export noninteractive=true
|
||||
# 下载并执行 goecs.sh 脚本
|
||||
RUN curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && \
|
||||
chmod +x goecs.sh && \
|
||||
bash goecs.sh env && \
|
||||
bash goecs.sh install
|
||||
|
||||
# 设置 goecs 为入口点
|
||||
ENTRYPOINT ["goecs"]
|
327
README.md
327
README.md
@@ -1,137 +1,180 @@
|
||||
# ecs
|
||||
# ECS
|
||||
|
||||
[](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml) [](https://www.spiritlhl.net/)
|
||||
[](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml)
|
||||
|
||||
融合怪测评脚本 - GO重构版本 - 由于未正式发版,如有问题请issues反馈
|
||||
[](https://www.spiritlhl.net/)
|
||||
|
||||
Shell版本: https://github.com/spiritLHLS/ecs
|
||||
[<img src="https://api.gitsponsors.com/api/badge/img?id=819808844" height="20">](https://api.gitsponsors.com/api/badge/link?p=3sgKiCtfJJbBT6XMAb1xeTadeXZcXeRXLsRG9HW+cFAZcmACmclN+HNM72KLMvwZdHrl7sjG6in68CwoQ7CNh4hoIz2s4ksTxcCIWoH9M3OsR/kHv31sS+0ZqR3O04BD3SqFX8B7ayuM9JCC4zKblg==)
|
||||
|
||||
## 语言
|
||||
融合怪测评项目 - GO 重构版本
|
||||
|
||||
如有问题请 [issues](https://github.com/oneclickvirt/ecs/issues) 反馈。
|
||||
|
||||
Go 版本:[https://github.com/oneclickvirt/ecs](https://github.com/oneclickvirt/ecs)
|
||||
|
||||
Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS/ecs)
|
||||
|
||||
---
|
||||
|
||||
## **语言**
|
||||
|
||||
[中文文档](README.md) | [English Docs](README_EN.md)
|
||||
|
||||
## 适配系统和架构
|
||||
---
|
||||
|
||||
编译支持的架构: amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
|
||||
## **适配系统和架构**
|
||||
|
||||
测试支持的架构: amd64、arm64
|
||||
### **编译支持的架构**
|
||||
|
||||
更多架构请自行测试
|
||||
- amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
|
||||
|
||||
编译支持的系统: Linux、Windows、MacOS、FreeBSD、OpenBSD
|
||||
### **测试支持的架构**
|
||||
|
||||
测试支持的系统: Linux、Windows
|
||||
- amd64、arm64
|
||||
|
||||
更多系统请自行测试
|
||||
> 更多架构请自行测试。
|
||||
|
||||
待支持的系统(存在硬件测试BUG未修复): MacOS、FreeBSD、OpenBSD
|
||||
### **编译支持的系统**
|
||||
|
||||
## 功能
|
||||
- Linux、Windows、MacOS、FreeBSD、OpenBSD
|
||||
|
||||
- [x] 系统基础信息查询[自研[basics](https://github.com/oneclickvirt/basics)、[gostun](https://github.com/oneclickvirt/gostun)]
|
||||
- [x] IP基础信息并发查询[自研[basics](https://github.com/oneclickvirt/basics)]
|
||||
- [x] CPU测试[自研[cputest](https://github.com/oneclickvirt/cputest)支持sysbench、geekbench、winsat]
|
||||
- [x] 内存测试[自研[memorytest](https://github.com/oneclickvirt/memorytest)支持sysbench、dd]
|
||||
- [x] 硬盘测试[自研[disktest](https://github.com/oneclickvirt/disktest)支持dd、fio、winsat]
|
||||
- [x] 御三家流媒体解锁信息并发查询[借鉴[netflix-verify](https://github.com/sjlleo/netflix-verify)、[VerifyDisneyPlus](https://github.com/sjlleo/VerifyDisneyPlus)、[TubeCheck](https://github.com/sjlleo/TubeCheck)逻辑开发至于[CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)]
|
||||
- [x] 常见流媒体测试并发查询[自研至于[UnlockTests](https://github.com/oneclickvirt/UnlockTests),逻辑借鉴[RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck)、[MediaUnlockTest](https://github.com/HsukqiLee/MediaUnlockTest)]
|
||||
- [x] IP质量/安全信息并发查询[自研,由于测试含密钥信息,故而私有化开发,但二进制文件编译至于[securityCheck](https://github.com/oneclickvirt/securityCheck)]
|
||||
- [x] 邮件端口测试[自研[portchecker](https://github.com/oneclickvirt/portchecker)]
|
||||
- [x] 三网回程测试[借鉴[zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace)二次开发至于[oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)]
|
||||
- [x] 三网路由测试[借鉴[NTrace-core](https://github.com/nxtrace/NTrace-core)二次开发至于[nt3](https://github.com/oneclickvirt/nt3)]
|
||||
- [x] 测试网速[基于[speedtest.net-爬虫](https://github.com/spiritLHLS/speedtest.net-CN-ID)、[speedtest.cn-爬虫](https://github.com/spiritLHLS/speedtest.cn-CN-ID)的数据,使用[speedtest-go](https://github.com/showwin/speedtest-go)开发至于[oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)]
|
||||
- [x] 测试三网Ping值[借鉴[ecsspeed](https://github.com/spiritLHLS/ecsspeed)的逻辑二次开发至于[pingtest](https://github.com/oneclickvirt/pingtest)]
|
||||
### **测试支持的系统**
|
||||
|
||||
## Linux/FreeBSD/MacOS上使用的说明
|
||||
- Linux、Windows
|
||||
|
||||
### 一键命令
|
||||
> 更多系统请自行测试。
|
||||
|
||||
```
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
|
||||
```
|
||||
### **待支持的系统**
|
||||
|
||||
或
|
||||
- MacOS、FreeBSD、OpenBSD(存在硬件测试 BUG 未修复)
|
||||
|
||||
```
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
|
||||
```
|
||||
---
|
||||
|
||||
### 详细说明
|
||||
## **功能**
|
||||
|
||||
下载脚本
|
||||
- 系统基础信息查询,IP基础信息并发查询:
|
||||
自研 [basics](https://github.com/oneclickvirt/basics)、[gostun](https://github.com/oneclickvirt/gostun)
|
||||
- CPU 测试:
|
||||
自研 [cputest](https://github.com/oneclickvirt/cputest),支持 sysbench(lua/golang版本)、geekbench、winsat
|
||||
- 内存测试:
|
||||
自研 [memorytest](https://github.com/oneclickvirt/memorytest),支持 sysbench、dd
|
||||
- 硬盘测试:
|
||||
自研 [disktest](https://github.com/oneclickvirt/disktest),支持 dd、fio、winsat
|
||||
- 流媒体解锁信息并发查询:
|
||||
借鉴 [netflix-verify](https://github.com/sjlleo/netflix-verify) 等逻辑,开发至 [CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)
|
||||
- 常见流媒体测试并发查询:
|
||||
自研至 [UnlockTests](https://github.com/oneclickvirt/UnlockTests),逻辑借鉴 [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck) 等
|
||||
- IP 质量/安全信息并发查询:
|
||||
自研,二进制文件编译至 [securityCheck](https://github.com/oneclickvirt/securityCheck)
|
||||
- 邮件端口测试:
|
||||
自研 [portchecker](https://github.com/oneclickvirt/portchecker)
|
||||
- 三网回程测试:
|
||||
借鉴 [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace),二次开发至 [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)
|
||||
- 三网路由测试:
|
||||
基于 [NTrace-core](https://github.com/nxtrace/NTrace-core),二次开发至 [nt3](https://github.com/oneclickvirt/nt3)
|
||||
- 网速测试:
|
||||
基于 [speedtest.net](https://github.com/spiritLHLS/speedtest.net-CN-ID) 和 [speedtest.cn](https://github.com/spiritLHLS/speedtest.cn-CN-ID) 数据,开发至 [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
|
||||
- 三网 Ping 值测试:
|
||||
借鉴 [ecsspeed](https://github.com/spiritLHLS/ecsspeed),二次开发至 [pingtest](https://github.com/oneclickvirt/pingtest)
|
||||
|
||||
```
|
||||
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
|
||||
```
|
||||
### **Linux/FreeBSD/MacOS**
|
||||
|
||||
安装环境
|
||||
#### **一键命令**
|
||||
|
||||
```
|
||||
./goecs.sh env
|
||||
```
|
||||
将默认安装依赖,默认更新包管理器,默认非互动模式,下面的非一键命令版本可控制是否安装依赖/是否更新包管理器/默认互动模式
|
||||
|
||||
安装goecs
|
||||
- **国际用户无加速:**
|
||||
|
||||
```
|
||||
./goecs.sh install
|
||||
```
|
||||
```bash
|
||||
export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
|
||||
```
|
||||
|
||||
升级goecs
|
||||
- **国际/国内使用 CDN 加速:**
|
||||
|
||||
```
|
||||
./goecs.sh upgrade
|
||||
```
|
||||
```bash
|
||||
export noninteractive=true && curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
|
||||
```
|
||||
|
||||
卸载goecs
|
||||
- **国内用户使用 CNB 加速:**
|
||||
|
||||
```
|
||||
./goecs.sh uninstall
|
||||
```
|
||||
```bash
|
||||
export noninteractive=true && curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
|
||||
```
|
||||
|
||||
shell脚本的说明
|
||||
#### **详细说明**
|
||||
|
||||
```
|
||||
可用命令:
|
||||
1. **下载脚本**
|
||||
|
||||
./goecs.sh env 检查并安装的包:
|
||||
sudo (几乎所有类 Unix 系统都有。)
|
||||
tar (几乎所有类 Unix 系统都有。)
|
||||
unzip (几乎所有类 Unix 系统都有。)
|
||||
dd (几乎所有类 Unix 系统都有。)
|
||||
fio (几乎所有类 Unix 系统可以通过系统的包管理器安装。)
|
||||
sysbench (几乎所有类 Unix 系统可以通过系统的包管理器安装。)
|
||||
geekbench (geekbench5) (仅支持 IPV4 环境,且内存大于 1GB 并需要持续联网,仅支持 amd64 和 arm64 架构。)
|
||||
speedtest (使用官方提供的二进制文件以获得更准确的测试结果。)
|
||||
ping (使用官方提供的二进制文件以获得更准确的测试结果。)
|
||||
systemd-detect-virt 或 dmidecode (几乎所有类 Unix 系统都有,安装以获得更准确的测试结果。)
|
||||
事实上,sysbench/geekbench 是上述依赖项中唯一必须安装的,没有它们无法测试 CPU 分数。
|
||||
./goecs.sh install 安装 goecs 命令
|
||||
./goecs.sh upgrade 升级 goecs 命令
|
||||
./goecs.sh uninstall 卸载 goecs 命令
|
||||
./goecs.sh help 显示此消息
|
||||
```
|
||||
**国际用户无加速:**
|
||||
|
||||
goecs唤起菜单
|
||||
```bash
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
```
|
||||
goecs
|
||||
```
|
||||
**国际/国内使用 CDN 加速:**
|
||||
|
||||
或
|
||||
```bash
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
```
|
||||
./goecs
|
||||
```
|
||||
**国内用户使用 CNB 加速:**
|
||||
|
||||
goecs命令参数化
|
||||
```bash
|
||||
curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
```
|
||||
2. **更新包管理器(可选择)并安装环境**
|
||||
|
||||
```bash
|
||||
./goecs.sh env
|
||||
```
|
||||
|
||||
**非互动模式:**
|
||||
|
||||
```bash
|
||||
export noninteractive=true && ./goecs.sh env
|
||||
```
|
||||
|
||||
3. **安装 `goecs`**
|
||||
|
||||
```bash
|
||||
./goecs.sh install
|
||||
```
|
||||
|
||||
4. **升级 `goecs`**
|
||||
|
||||
```bash
|
||||
./goecs.sh upgrade
|
||||
```
|
||||
|
||||
5. **卸载 `goecs`**
|
||||
|
||||
```bash
|
||||
./goecs.sh uninstall
|
||||
```
|
||||
|
||||
6. **帮助命令**
|
||||
|
||||
```bash
|
||||
./goecs.sh -h
|
||||
```
|
||||
|
||||
7. **唤起菜单**
|
||||
|
||||
```bash
|
||||
goecs
|
||||
```
|
||||
|
||||
#### **命令参数化**
|
||||
|
||||
<details>
|
||||
<summary>展开查看各参数说明</summary>
|
||||
|
||||
```bash
|
||||
Usage: goecs [options]
|
||||
-backtrace
|
||||
Enable/Disable backtrace test (in 'en' language or on windows it always false) (default true)
|
||||
@@ -184,22 +227,20 @@ Usage: goecs [options]
|
||||
Enable/Disable unlock media test (default true)
|
||||
-v Display version information
|
||||
```
|
||||
</details>
|
||||
|
||||
## Windows上使用的说明
|
||||
---
|
||||
|
||||
下载带exe文件的压缩文件
|
||||
### **Windows**
|
||||
|
||||
https://github.com/oneclickvirt/ecs/releases
|
||||
1. 下载带 exe 文件的压缩包:[Releases](https://github.com/oneclickvirt/ecs/releases)
|
||||
2. 解压后,右键以管理员模式运行。
|
||||
|
||||
找其中最新的版本,按照对应架构下载对应的 .zip 文件,解压后文件夹内有一个exe文件
|
||||
---
|
||||
|
||||
选择该exe文件,右键点击选择管理员模式运行(非管理员模式运行无法进行硬件测试),唤起菜单自选
|
||||
### **Docker**
|
||||
|
||||
windows测试无需进行环境安装
|
||||
|
||||
## 在Docker中使用的说明
|
||||
|
||||
地址:https://hub.docker.com/r/spiritlhl/goecs
|
||||
国际镜像地址:https://hub.docker.com/r/spiritlhl/goecs
|
||||
|
||||
请确保执行下述命令前本机已安装Docker
|
||||
|
||||
@@ -217,21 +258,80 @@ docker run --rm spiritlhl/goecs:latest -menu=false -l zh
|
||||
|
||||
使用Docker执行测试,硬件测试会有一些偏差和虚拟化架构判断失效,还是推荐直接测试而不使用Docker测试。
|
||||
|
||||
国内镜像地址:https://cnb.cool/oneclickvirt/ecs/-/packages/docker/ecs
|
||||
|
||||
请确保执行下述命令前本机已安装Docker
|
||||
|
||||
特权模式+host网络
|
||||
|
||||
```shell
|
||||
docker run --rm --privileged --network host docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l zh
|
||||
```
|
||||
|
||||
非特权模式+非host网络
|
||||
|
||||
```shell
|
||||
docker run --rm docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l zh
|
||||
```
|
||||
|
||||
我来帮你修复排版,以下是格式调整后的完整内容:
|
||||
|
||||
### 从源码中进行编译
|
||||
|
||||
<details>
|
||||
<summary>展开查看编译说明</summary>
|
||||
|
||||
1. 克隆仓库的 public 分支(不含私有依赖)
|
||||
```bash
|
||||
git clone -b public https://github.com/oneclickvirt/ecs.git
|
||||
cd ecs
|
||||
```
|
||||
|
||||
2. 安装 Go 环境(如已安装可跳过)
|
||||
```bash
|
||||
# 下载并安装 Go
|
||||
wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
|
||||
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
```
|
||||
|
||||
3. 编译
|
||||
```bash
|
||||
go build -o goecs
|
||||
```
|
||||
|
||||
4. 运行测试
|
||||
```bash
|
||||
./goecs -menu=false -l zh
|
||||
```
|
||||
|
||||
支持的编译参数:
|
||||
- GOOS:支持 linux、windows、darwin、freebsd、openbsd
|
||||
- GOARCH:支持 amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
|
||||
|
||||
跨平台编译示例:
|
||||
```bash
|
||||
# 编译 Windows 版本
|
||||
GOOS=windows GOARCH=amd64 go build -o goecs.exe
|
||||
# 编译 MacOS 版本
|
||||
GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
|
||||
```
|
||||
</details>
|
||||
|
||||
## QA
|
||||
|
||||
#### Q: 为什么默认使用sysbench而不是geekbench
|
||||
|
||||
#### A: 比较二者特点
|
||||
|
||||
```
|
||||
sysbench geekbench
|
||||
轻量几乎所有服务器都能跑 重型小机器跑不动
|
||||
测试无联网需求,无硬件需求 测试必须联网,且必须IPV4环境,且有内存大小1G的最低需求
|
||||
LUA编写且开源,各架构系统可自行编译 仅官方二进制文件且不开源,无对应架构时无法自行编译
|
||||
核心测试组件十多年不变 每次大版本更新对标的CPU,不同版本间得分互相之间难转化,你只能以对标的CPU为准
|
||||
测试仅测试计算性能 测试涵盖多种性能测试,得分以权重计算,但实际很多测试项目实际是用不到的
|
||||
适合快速测试 适合全面测试
|
||||
```
|
||||
| 比较项 | sysbench | geekbench |
|
||||
|------------------|----------|-----------|
|
||||
| 适用范围 | 轻量级,几乎可在任何服务器上运行 | 重量级,小型机器无法运行 |
|
||||
| 测试要求 | 无需网络,无特殊硬件需求 | 需联网,IPV4环境,至少1G内存 |
|
||||
| 开源情况 | 基于LUA,开源,可自行编译各架构版本 | 官方二进制闭源代码,不支持自行编译 |
|
||||
| 测试稳定性 | 核心测试组件10年以上未变 | 每个大版本更新测试项,分数不同版本间难以对比(每个版本对标当前最好的CPU) |
|
||||
| 测试内容 | 仅测试计算性能 | 覆盖多种性能测试,分数加权计算,但部分测试实际不常用 |
|
||||
| 适用场景 | 适合快速测试,仅测试计算性能 | 适合综合全面的测试 |
|
||||
|
||||
且```goecs```测试使用何种CPU测试方式可使用参数指定,默认只是为了更多用户快速测试的需求
|
||||
|
||||
@@ -247,3 +347,10 @@ LUA编写且开源,各架构系统可自行编译 仅官方二进制文件且
|
||||
|
||||
#### A: 每个测试项目有对应的维护仓库,自行点击查看仓库说明
|
||||
|
||||
#### Q: 测试进行到一半如何手动终止?
|
||||
|
||||
#### A: 按ctrl键和c键终止程序,终止后依然会在当前目录下生成goecs.txt文件和分享链接,里面是已经测试到的信息。
|
||||
|
||||
#### Q: 非Root环境如何进行测试?
|
||||
|
||||
#### A: 手动执行安装命令,实在装不上也没问题,直接在release中下载对应架构的压缩包解压后执行即可,只要你能执行的了文件。或者你能使用docker的话用docker执行。
|
339
README_EN.md
339
README_EN.md
@@ -1,125 +1,179 @@
|
||||
# ecs
|
||||
|
||||
[](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml) [](https://www.spiritlhl.net/)
|
||||
[](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml)
|
||||
|
||||
Fusion Monster Evaluation Script - GO Refactored Version - Since it has not been officially released, please report any issues via issues.
|
||||
[](https://www.spiritlhl.net/)
|
||||
|
||||
Shell version: https://github.com/spiritLHLS/ecs/blob/main/README_EN.md
|
||||
[<img src="https://api.gitsponsors.com/api/badge/img?id=819808844" height="20">](https://api.gitsponsors.com/api/badge/link?p=3sgKiCtfJJbBT6XMAb1xeTadeXZcXeRXLsRG9HW+cFAZcmACmclN+HNM72KLMvwZdHrl7sjG6in68CwoQ7CNh4hoIz2s4ksTxcCIWoH9M3OsR/kHv31sS+0ZqR3O04BD3SqFX8B7ayuM9JCC4zKblg==)
|
||||
|
||||
## Language
|
||||
Fusion Monster Evaluation Project - GO Refactored Version
|
||||
|
||||
Please report any issues via [issues](https://github.com/oneclickvirt/ecs/issues).
|
||||
|
||||
Go version: [https://github.com/oneclickvirt/ecs](https://github.com/oneclickvirt/ecs)
|
||||
|
||||
Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https://github.com/spiritLHLS/ecs/blob/main/README_EN.md)
|
||||
|
||||
---
|
||||
|
||||
## **Language**
|
||||
|
||||
[中文文档](README.md) | [English Docs](README_EN.md)
|
||||
|
||||
## Supported Systems and Architectures
|
||||
---
|
||||
|
||||
Architectures supported for compilation: amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
|
||||
## **Supported Systems and Architectures**
|
||||
|
||||
Tested architectures: amd64, arm64
|
||||
### **Architectures supported for compilation**
|
||||
|
||||
More architectures please test by yourself
|
||||
- amd64, arm, arm64, 386, mips, mipsle, s390x, riscv64
|
||||
|
||||
Compilation support: Linux, Windows、MacOS、FreeBSD、OpenBSD
|
||||
### **Tested architectures**
|
||||
|
||||
Tested on: Linux, Windows
|
||||
- amd64, arm64
|
||||
|
||||
More systems to be tested
|
||||
> More architectures can be tested by yourself.
|
||||
|
||||
Systems to be supported (hardware testing bugs not yet fixed): MacOS、FreeBSD、OpenBSD
|
||||
### **Compilation supported systems**
|
||||
|
||||
## Features
|
||||
- Linux, Windows, MacOS, FreeBSD, OpenBSD
|
||||
|
||||
- [x] System basic information query [Self-developed [basics](https://github.com/oneclickvirt/basics), [gostun](https://github.com/oneclickvirt/gostun)]
|
||||
- [x] Concurrent IP basic information query [Self-developed [basics](https://github.com/oneclickvirt/basics)]
|
||||
- [x] CPU test [Self-developed [cputest](https://github.com/oneclickvirt/cputest) supporting sysbench, geekbench, winsat]
|
||||
- [x] Memory test [Self-developed [memorytest](https://github.com/oneclickvirt/memorytest) supporting sysbench, dd]
|
||||
- [x] Disk test [Self-developed [disktest](https://github.com/oneclickvirt/disktest) supporting dd, fio, winsat]
|
||||
- [x] Concurrent streaming media unlock information query for three major platforms [Modified from [netflix-verify](https://github.com/sjlleo/netflix-verify), [VerifyDisneyPlus](https://github.com/sjlleo/VerifyDisneyPlus), [TubeCheck](https://github.com/sjlleo/TubeCheck) to [CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)]
|
||||
- [x] Concurrent common streaming media tests [Self-developed code, logic modified from [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck), [MediaUnlockTest](https://github.com/HsukqiLee/MediaUnlockTest) to [UnlockTests](https://github.com/oneclickvirt/UnlockTests)]
|
||||
- [x] Concurrent IP quality/security information query [Self-developed, due to testing with key information, privately developed, but binary files compiled in [securityCheck](https://github.com/oneclickvirt/securityCheck)]
|
||||
- [x] Email port test [Self-developed [portchecker](https://github.com/oneclickvirt/portchecker)]
|
||||
- [x] Three-network return path test [Modified from [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace) to [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)]
|
||||
- [x] Three-network route test [Modified from [NTrace-core](https://github.com/nxtrace/NTrace-core) to [nt3](https://github.com/oneclickvirt/nt3)]
|
||||
- [x] Speed test [Based on data from [speedtest.net-crawler](https://github.com/spiritLHLS/speedtest.net-CN-ID), [speedtest.cn-crawler](https://github.com/spiritLHLS/speedtest.cn-CN-ID), modified from [speedtest-go](https://github.com/showwin/speedtest-go) to [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)]
|
||||
- [x] Three-network Ping test [Modified from [ecsspeed](https://github.com/spiritLHLS/ecsspeed) logic to [pingtest](https://github.com/oneclickvirt/pingtest)]
|
||||
### **Tested systems**
|
||||
|
||||
## Instructions for Use on Linux/FreeBSD/MacOS
|
||||
- Linux, Windows
|
||||
|
||||
### one-click command
|
||||
> More systems can be tested by yourself.
|
||||
|
||||
```
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
|
||||
```
|
||||
### **Systems to be supported**
|
||||
|
||||
### explain in detail
|
||||
- MacOS, FreeBSD, OpenBSD (hardware testing bugs not yet fixed)
|
||||
|
||||
Download the script
|
||||
---
|
||||
|
||||
```
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
## **Features**
|
||||
|
||||
Install environment
|
||||
- System basic information query and concurrent IP basic information query:
|
||||
Self-developed [basics](https://github.com/oneclickvirt/basics), [gostun](https://github.com/oneclickvirt/gostun)
|
||||
- CPU test:
|
||||
Self-developed [cputest](https://github.com/oneclickvirt/cputest) supporting sysbench(lua/golang version), geekbench, winsat
|
||||
- Memory test:
|
||||
Self-developed [memorytest](https://github.com/oneclickvirt/memorytest) supporting sysbench, dd
|
||||
- Disk test:
|
||||
Self-developed [disktest](https://github.com/oneclickvirt/disktest) supporting dd, fio, winsat
|
||||
- Streaming media unlock information concurrent query:
|
||||
Modified from [netflix-verify](https://github.com/sjlleo/netflix-verify) and more to [CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)
|
||||
- Common streaming media tests concurrent query:
|
||||
Self-developed to [UnlockTests](https://github.com/oneclickvirt/UnlockTests), logic modified from [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck) and others
|
||||
- IP quality/security information concurrent query:
|
||||
Self-developed, binary files compiled in [securityCheck](https://github.com/oneclickvirt/securityCheck)
|
||||
- Email port test:
|
||||
Self-developed [portchecker](https://github.com/oneclickvirt/portchecker)
|
||||
- Three-network return path test:
|
||||
Modified from [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace) to [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)
|
||||
- Three-network route test:
|
||||
Modified from [NTrace-core](https://github.com/nxtrace/NTrace-core) to [nt3](https://github.com/oneclickvirt/nt3)
|
||||
- Speed test:
|
||||
Based on data from [speedtest.net](https://github.com/spiritLHLS/speedtest.net-CN-ID) and [speedtest.cn](https://github.com/spiritLHLS/speedtest.cn-CN-ID), developed to [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
|
||||
- Three-network Ping test:
|
||||
Modified from [ecsspeed](https://github.com/spiritLHLS/ecsspeed) to [pingtest](https://github.com/oneclickvirt/pingtest)
|
||||
|
||||
```
|
||||
./goecs.sh env
|
||||
```
|
||||
---
|
||||
|
||||
Install goecs
|
||||
## **Instructions for Use**
|
||||
|
||||
```
|
||||
./goecs.sh install
|
||||
```
|
||||
### **Linux/FreeBSD/MacOS**
|
||||
|
||||
Upgrade goecs
|
||||
#### **One-click command**
|
||||
|
||||
```
|
||||
./goecs.sh upgrade
|
||||
```
|
||||
Will install dependencies by default, update package manager by default, non-interactive mode by default. The non-one-click version below allows control of dependency installation/package manager updates/interactive mode by default.
|
||||
|
||||
Uninstall goecs
|
||||
- **International users without acceleration:**
|
||||
|
||||
```
|
||||
./goecs.sh uninstall
|
||||
```
|
||||
```bash
|
||||
export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
|
||||
```
|
||||
|
||||
Explanation of the shell script
|
||||
- **International/domestic users with CDN acceleration:**
|
||||
|
||||
```
|
||||
Available commands:
|
||||
```bash
|
||||
export noninteractive=true && curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
|
||||
```
|
||||
|
||||
./goecs.sh env Check and Install package:
|
||||
sudo (Almost all unix-like systems have it.)
|
||||
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.)
|
||||
ping (Use the officially provided binaries for more accurate test results.)
|
||||
systemd-detect-virt OR dmidecode (Almost all unix-like systems have it, 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 uninstall Uninstall goecs command
|
||||
./goecs.sh help Show this message
|
||||
```
|
||||
- **Domestic users with CNB acceleration:**
|
||||
|
||||
Invoke the goecs menu
|
||||
```bash
|
||||
export noninteractive=true && curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
|
||||
```
|
||||
|
||||
```
|
||||
goecs -l en
|
||||
```
|
||||
#### **Detailed instructions**
|
||||
|
||||
or
|
||||
1. **Download the script**
|
||||
|
||||
```
|
||||
./goecs -l en
|
||||
```
|
||||
**International users without acceleration:**
|
||||
|
||||
Parameterized goecs command
|
||||
```bash
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
```
|
||||
**International/domestic users with CDN acceleration:**
|
||||
|
||||
```bash
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
**Domestic users with CNB acceleration:**
|
||||
|
||||
```bash
|
||||
curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
2. **Update package manager (optional) and install environment**
|
||||
|
||||
```bash
|
||||
./goecs.sh env
|
||||
```
|
||||
|
||||
**Non-interactive mode:**
|
||||
|
||||
```bash
|
||||
export noninteractive=true && ./goecs.sh env
|
||||
```
|
||||
|
||||
3. **Install `goecs`**
|
||||
|
||||
```bash
|
||||
./goecs.sh install
|
||||
```
|
||||
|
||||
4. **Upgrade `goecs`**
|
||||
|
||||
```bash
|
||||
./goecs.sh upgrade
|
||||
```
|
||||
|
||||
5. **Uninstall `goecs`**
|
||||
|
||||
```bash
|
||||
./goecs.sh uninstall
|
||||
|
||||
6. **help command**
|
||||
|
||||
```bash
|
||||
./goecs.sh -h
|
||||
```
|
||||
|
||||
7. **Invoke the menu**
|
||||
|
||||
```bash
|
||||
goecs -l en
|
||||
```
|
||||
|
||||
#### **Command parameterization**
|
||||
|
||||
<details>
|
||||
<summary>Expand to view parameter descriptions</summary>
|
||||
|
||||
```bash
|
||||
Usage: goecs [options]
|
||||
-backtrace
|
||||
Enable/Disable backtrace test (in 'en' language or on windows it always false) (default true)
|
||||
@@ -172,26 +226,24 @@ Usage: goecs [options]
|
||||
Enable/Disable unlock media test (default true)
|
||||
-v Display version information
|
||||
```
|
||||
</details>
|
||||
|
||||
## Instructions for Use on Windows
|
||||
---
|
||||
|
||||
Download the compressed file with the exe file
|
||||
### **Windows**
|
||||
|
||||
https://github.com/oneclickvirt/ecs/releases
|
||||
1. Download the compressed file with the .exe file: [Releases](https://github.com/oneclickvirt/ecs/releases)
|
||||
2. After unzipping, right-click and run as administrator.
|
||||
|
||||
Find the latest version, download the .zip file corresponding to your architecture, and unzip it to get an exe file.
|
||||
---
|
||||
|
||||
Right-click the exe file and select Run as administrator (running without administrator mode will not allow hardware testing), and invoke the menu to choose.
|
||||
### **Docker**
|
||||
|
||||
No environment installation is required for Windows testing.
|
||||
International image: https://hub.docker.com/r/spiritlhl/goecs
|
||||
|
||||
## Instructions for Use in Docker
|
||||
Please ensure Docker is installed on your machine before executing the following commands
|
||||
|
||||
Link: https://hub.docker.com/r/spiritlhl/goecs
|
||||
|
||||
Please make sure that Docker is installed on your machine before executing the following commands
|
||||
|
||||
Privileged Mode + host network
|
||||
Privileged mode + host network
|
||||
|
||||
```shell
|
||||
docker run --rm --privileged --network host spiritlhl/goecs:latest -menu=false -l en
|
||||
@@ -200,9 +252,102 @@ docker run --rm --privileged --network host spiritlhl/goecs:latest -menu=false -
|
||||
Unprivileged mode + non-host network
|
||||
|
||||
```shell
|
||||
docker run --rm spiritlhl/goecs:latest
|
||||
docker run --rm spiritlhl/goecs:latest -menu=false -l en
|
||||
```
|
||||
|
||||
Using Docker to execute tests, hardware testing will have some bias and virtualization architecture to determine the failure.
|
||||
Using Docker to execute tests will result in some hardware testing bias and virtualization architecture detection failure. Direct testing is recommended over Docker testing.
|
||||
|
||||
Recommended direct testing without using Docker testing.
|
||||
Domestic image: https://cnb.cool/oneclickvirt/ecs/-/packages/docker/ecs
|
||||
|
||||
Please ensure Docker is installed on your machine before executing the following commands
|
||||
|
||||
Privileged mode + host network
|
||||
|
||||
```shell
|
||||
docker run --rm --privileged --network host docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l en
|
||||
```
|
||||
|
||||
Unprivileged mode + non-host network
|
||||
|
||||
```shell
|
||||
docker run --rm docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l en
|
||||
```
|
||||
|
||||
### Compiling from source code
|
||||
|
||||
<details>
|
||||
<summary>Expand to view compilation instructions</summary>
|
||||
|
||||
1. Clone the public branch of the repository (without private dependencies)
|
||||
```bash
|
||||
git clone -b public https://github.com/oneclickvirt/ecs.git
|
||||
cd ecs
|
||||
```
|
||||
|
||||
2. Install Go environment (skip if already installed)
|
||||
```bash
|
||||
# Download and install Go
|
||||
wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
|
||||
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
```
|
||||
|
||||
3. Compile
|
||||
```bash
|
||||
go build -o goecs
|
||||
```
|
||||
|
||||
4. Run test
|
||||
```bash
|
||||
./goecs -menu=false -l en
|
||||
```
|
||||
|
||||
Supported compilation parameters:
|
||||
- GOOS: supports linux, windows, darwin, freebsd, openbsd
|
||||
- GOARCH: supports amd64, arm, arm64, 386, mips, mipsle, s390x, riscv64
|
||||
|
||||
Cross-platform compilation examples:
|
||||
```bash
|
||||
# Compile Windows version
|
||||
GOOS=windows GOARCH=amd64 go build -o goecs.exe
|
||||
# Compile MacOS version
|
||||
GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
|
||||
```
|
||||
</details>
|
||||
|
||||
## QA
|
||||
|
||||
#### Q: Why is sysbench used by default instead of geekbench?
|
||||
|
||||
#### A: Comparing the characteristics of both:
|
||||
|
||||
| Comparison | sysbench | geekbench |
|
||||
|------------|----------|-----------|
|
||||
| Application scope | Lightweight, runs on almost any server | Heavyweight, won't run on small machines |
|
||||
| Test requirements | No network needed, no special hardware requirements | Requires internet, IPv4 environment, minimum 1GB memory |
|
||||
| Open source status | Based on LUA, open source, can compile for various architectures | Official binaries are closed source, cannot compile your own version |
|
||||
| Test stability | Core test components unchanged for 10+ years | Each major version updates test items, making scores hard to compare between versions (each version benchmarks against current best CPUs) |
|
||||
| Test content | Only tests computing performance | Covers multiple performance aspects with weighted scores, though some tests aren't commonly used |
|
||||
| Suitable scenarios | Good for quick tests, focuses on computing performance | Good for comprehensive testing |
|
||||
|
||||
Note that `goecs` allows you to specify CPU test method via parameters. The default is chosen for faster testing across more systems.
|
||||
|
||||
#### Q: Why use Golang instead of Rust for refactoring?
|
||||
|
||||
#### A: Because network-related projects currently trend toward Golang, with many components maintained by open source communities. Many Rust components would require building from scratch, ~~I'm too lazy~~ I don't have that technical capability.
|
||||
|
||||
#### Q: Why not continue developing the Shell version instead of refactoring?
|
||||
|
||||
#### A: Because there were too many varied environment issues. Pre-compiled binary files are easier for solving environment problems (better generalization).
|
||||
|
||||
#### Q: Are there explanations for each test item?
|
||||
|
||||
#### A: Each test project has its own maintenance repository. Click through to view the repository description.
|
||||
|
||||
#### Q: How do I manually terminate a test halfway through?
|
||||
|
||||
#### A: Press Ctrl+C to terminate the program. After termination, a goecs.txt file and share link will still be generated in the current directory containing information tested so far.
|
||||
|
||||
#### Q: How do I test in a non-Root environment?
|
||||
|
||||
#### A: Execute the installation command manually. If you can't install it, simply download the appropriate architecture package from releases, extract it, and run the file if you have execution permissions. Alternatively, use Docker if you can.
|
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 本包不在main中使用,仅做测试使用
|
||||
// 本包不在main中使用,仅做测试使用,真正调用的在 utils 中的 BasicsAndSecurityCheck
|
||||
func Basic(language string) {
|
||||
ipInfo, _, _ := network.NetworkCheck("both", false, language)
|
||||
systemInfo := system.CheckSystemInfo(language)
|
||||
|
80
go.mod
80
go.mod
@@ -1,41 +1,41 @@
|
||||
module github.com/oneclickvirt/ecs
|
||||
|
||||
go 1.22.4
|
||||
go 1.23.4
|
||||
|
||||
require (
|
||||
github.com/imroc/req/v3 v3.43.7
|
||||
github.com/imroc/req/v3 v3.49.0
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502
|
||||
github.com/oneclickvirt/UnlockTests v0.0.16-20240823051211
|
||||
github.com/oneclickvirt/UnlockTests v0.0.26-20250223034957
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240702140722
|
||||
github.com/oneclickvirt/basics v0.0.7-20240821160408
|
||||
github.com/oneclickvirt/cputest v0.0.8-20240702070215
|
||||
github.com/oneclickvirt/basics v0.0.9-20250205131258
|
||||
github.com/oneclickvirt/cputest v0.0.9-20250103063414
|
||||
github.com/oneclickvirt/defaultset v0.0.2-20240624082446
|
||||
github.com/oneclickvirt/disktest v0.0.4-20240809053456
|
||||
github.com/oneclickvirt/gostun v0.0.3-20240702054621
|
||||
github.com/oneclickvirt/memorytest v0.0.4-20240820095126
|
||||
github.com/oneclickvirt/nt3 v0.0.3-20240809100110
|
||||
github.com/oneclickvirt/pingtest v0.0.5-20240804134050
|
||||
github.com/oneclickvirt/portchecker v0.0.2-20240803151204
|
||||
github.com/oneclickvirt/nt3 v0.0.4-20250118032755
|
||||
github.com/oneclickvirt/pingtest v0.0.5-20241006123443
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250118031146
|
||||
github.com/oneclickvirt/security v0.0.4-20240729065854
|
||||
github.com/oneclickvirt/speedtest v0.0.8-20241005160129
|
||||
github.com/oneclickvirt/speedtest v0.0.8-20250217133052
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/goquery v1.9.2 // indirect
|
||||
github.com/StackExchange/wmi v1.2.1 // indirect
|
||||
github.com/andybalholm/brotli v1.1.0 // indirect
|
||||
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.2 // indirect
|
||||
github.com/cloudflare/circl v1.3.9 // indirect
|
||||
github.com/fatih/color v1.17.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/cloudflare/circl v1.5.0 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.8.0 // indirect
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||
github.com/gofrs/uuid/v5 v5.2.0 // indirect
|
||||
github.com/google/gopacket v1.1.19 // indirect
|
||||
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 // indirect
|
||||
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.2 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
@@ -44,26 +44,26 @@ require (
|
||||
github.com/jaypipes/ghw v0.12.0 // indirect
|
||||
github.com/jaypipes/pcidb v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.17.9 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/koron/go-ssdp v0.0.4 // indirect
|
||||
github.com/libp2p/go-nat v0.2.0 // indirect
|
||||
github.com/libp2p/go-netroute v0.2.1 // indirect
|
||||
github.com/lionsoul2014/ip2region v2.11.2+incompatible // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/magiconair/properties v1.8.9 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/miekg/dns v1.1.61 // indirect
|
||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/nxtrace/NTrace-core v1.3.2 // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.19.0 // indirect
|
||||
github.com/nxtrace/NTrace-core v1.3.7 // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.22.1 // indirect
|
||||
github.com/oschwald/maxminddb-golang v1.13.1 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||
github.com/pion/dtls/v2 v2.2.7 // indirect
|
||||
github.com/pion/logging v0.2.2 // indirect
|
||||
github.com/pion/stun/v2 v2.0.0 // indirect
|
||||
@@ -72,12 +72,12 @@ require (
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/prometheus-community/pro-bing v0.4.1 // indirect
|
||||
github.com/quic-go/qpack v0.4.0 // indirect
|
||||
github.com/quic-go/quic-go v0.45.1 // indirect
|
||||
github.com/refraction-networking/utls v1.6.6 // indirect
|
||||
github.com/quic-go/qpack v0.5.1 // indirect
|
||||
github.com/quic-go/quic-go v0.48.2 // indirect
|
||||
github.com/refraction-networking/utls v1.6.7 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rodaine/table v1.2.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.6.0 // indirect
|
||||
github.com/rodaine/table v1.3.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.7.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/schollz/progressbar/v3 v3.14.4 // indirect
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
|
||||
@@ -85,30 +85,30 @@ require (
|
||||
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
||||
github.com/showwin/speedtest-go v1.7.7 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.11.0 // indirect
|
||||
github.com/spf13/cast v1.6.0 // indirect
|
||||
github.com/spf13/afero v1.12.0 // indirect
|
||||
github.com/spf13/cast v1.7.1 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.19.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/tidwall/gjson v1.17.1 // indirect
|
||||
github.com/tidwall/gjson v1.18.0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.14 // indirect
|
||||
github.com/tklauser/numcpus v0.8.0 // indirect
|
||||
github.com/tsosunchia/powclient v0.1.5 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||
go.uber.org/mock v0.4.0 // indirect
|
||||
go.uber.org/mock v0.5.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/crypto v0.25.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
|
||||
golang.org/x/mod v0.18.0 // indirect
|
||||
golang.org/x/net v0.27.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/sys v0.22.0 // indirect
|
||||
golang.org/x/term v0.22.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
golang.org/x/tools v0.22.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
|
||||
golang.org/x/mod v0.22.0 // indirect
|
||||
golang.org/x/net v0.34.0 // indirect
|
||||
golang.org/x/sync v0.10.0 // indirect
|
||||
golang.org/x/sys v0.29.0 // indirect
|
||||
golang.org/x/term v0.28.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
golang.org/x/tools v0.29.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
179
go.sum
179
go.sum
@@ -2,26 +2,26 @@ github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4
|
||||
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
|
||||
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
|
||||
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
|
||||
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
||||
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
||||
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
|
||||
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
|
||||
github.com/cloudflare/circl v1.3.9 h1:QFrlgFYf2Qpi8bSpVPK1HBvWpx16v/1TZivyo7pGuBE=
|
||||
github.com/cloudflare/circl v1.3.9/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
|
||||
github.com/cloudflare/circl v1.5.0 h1:hxIWksrX6XN5a1L2TI/h53AGPhNHoUBo+TD1ms9+pys=
|
||||
github.com/cloudflare/circl v1.5.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
|
||||
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
|
||||
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
|
||||
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
@@ -35,12 +35,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
|
||||
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
|
||||
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 h1:e+8XbKB6IMn8A4OAyZccO4pYfB3s7bt6azNIPE7AnPg=
|
||||
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
|
||||
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
|
||||
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/websocket v1.5.2 h1:qoW6V1GT3aZxybsbC6oLnailWnB+qTMVwMreOso9XUw=
|
||||
github.com/gorilla/websocket v1.5.2/go.mod h1:0n9H61RBAcf5/38py2MCYbxzPIY9rOkpvvMT24Rqs30=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
@@ -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/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY=
|
||||
github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
|
||||
github.com/imroc/req/v3 v3.43.7 h1:dOcNb9n0X83N5/5/AOkiU+cLhzx8QFXjv5MhikazzQA=
|
||||
github.com/imroc/req/v3 v3.43.7/go.mod h1:SQIz5iYop16MJxbo8ib+4LnostGCok8NQf8ToyQc2xA=
|
||||
github.com/imroc/req/v3 v3.49.0 h1:5Rac2qvz7Dq0E3PeBo/c2szV3hagPQIGLoHtfBmYhu4=
|
||||
github.com/imroc/req/v3 v3.49.0/go.mod h1:XZf4t94DNJzcA0UOBlA68hmSrWsAyvN407ADdH4mzCA=
|
||||
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/jaypipes/ghw v0.12.0 h1:xU2/MDJfWmBhJnujHY9qwXQLs3DBsf0/Xa9vECY0Tho=
|
||||
@@ -62,8 +62,8 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
|
||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||
github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0=
|
||||
github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
@@ -78,15 +78,14 @@ github.com/lionsoul2014/ip2region v2.11.2+incompatible h1:+VRsGcrHz8ewXI/2UzTptJ
|
||||
github.com/lionsoul2014/ip2region v2.11.2+incompatible/go.mod h1:+ZBN7PBoh5gG6/y0ZQ85vJDBe21WnfbRrQQwTfliJJI=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
|
||||
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
|
||||
github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
|
||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
|
||||
@@ -100,18 +99,18 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/nxtrace/NTrace-core v1.3.2 h1:8aU/IQFmPnwbaWGVBIJHwwVIWk+roo+9+lG+U0OFZ+o=
|
||||
github.com/nxtrace/NTrace-core v1.3.2/go.mod h1:qCVsgSs982jw02BVjTtN8mjSg5OIXW9TaUdISQrMnTw=
|
||||
github.com/nxtrace/NTrace-core v1.3.7 h1:ZnTbPrPqpyeraCvUyNbQTNyl4Gz3NRQDh06WdIIHh90=
|
||||
github.com/nxtrace/NTrace-core v1.3.7/go.mod h1:aW2owz9I+W5i+gJEDmnWli75mB+fuO4UTwdOPMcQHpE=
|
||||
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.16-20240823051211 h1:oDYlAXbUSt6JYTC+wcFDVWTacGuyBtWNfJhpKkrqNkU=
|
||||
github.com/oneclickvirt/UnlockTests v0.0.16-20240823051211/go.mod h1:UELwZDDiddSxe38boYOPl1FlrL0ptEZYSQwdE3MYvUM=
|
||||
github.com/oneclickvirt/UnlockTests v0.0.26-20250223034957 h1:ztRSF46/SaidNSuSRxaCGDLtA10CLYuoxwR3kMSCDIs=
|
||||
github.com/oneclickvirt/UnlockTests v0.0.26-20250223034957/go.mod h1:yXWIZB6iLS88pEd9m4QJi1GENn+7I91zA72y5ONz2Oc=
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240702140722 h1:UJ/VWf+ZbhGarc9HcHMIyenpmX+b2LxkXu0hlLk3Gxs=
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240702140722/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8=
|
||||
github.com/oneclickvirt/basics v0.0.7-20240821160408 h1:IOqa7bBAkjhfru6arDsOTKB7qZ36ojfOP73kE+cDaqc=
|
||||
github.com/oneclickvirt/basics v0.0.7-20240821160408/go.mod h1:fUdVpU8gdjaZsTCyqnQBAbHc9BbbN8Fxr3sGPKooUpU=
|
||||
github.com/oneclickvirt/cputest v0.0.8-20240702070215 h1:CcFpyVPlQkJ6vjFP17BRuJhh/afiJhOhZ0BW+TtfVDg=
|
||||
github.com/oneclickvirt/cputest v0.0.8-20240702070215/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
|
||||
github.com/oneclickvirt/basics v0.0.9-20250205131258 h1:LytqWIVlzT1ZS/thB8ZXk7tEpoaj+i6pBQBtACziBjc=
|
||||
github.com/oneclickvirt/basics v0.0.9-20250205131258/go.mod h1:fUdVpU8gdjaZsTCyqnQBAbHc9BbbN8Fxr3sGPKooUpU=
|
||||
github.com/oneclickvirt/cputest v0.0.9-20250103063414 h1:G69wbgHs3oDL1PraQ+8k0Gtefpj5eMTfCQGhz2dcfA8=
|
||||
github.com/oneclickvirt/cputest v0.0.9-20250103063414/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.4-20240809053456 h1:g6fKzvImIV8YQZKKEJ2FdvooL+EUf9NndAU8c4aGCX4=
|
||||
@@ -120,24 +119,24 @@ github.com/oneclickvirt/gostun v0.0.3-20240702054621 h1:IE89eEYV9TJbF94SakQDAxTL
|
||||
github.com/oneclickvirt/gostun v0.0.3-20240702054621/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
|
||||
github.com/oneclickvirt/memorytest v0.0.4-20240820095126 h1:Il3rvWkrZy/6B2iO3HRe9039/qRllA4CzcZ/dI8aG2A=
|
||||
github.com/oneclickvirt/memorytest v0.0.4-20240820095126/go.mod h1:+YNzy+NeVg61d0kNwSyVDqHyVtKzjuRe1NvMzsDLg0I=
|
||||
github.com/oneclickvirt/nt3 v0.0.3-20240809100110 h1:UyF0jBDP0xpxSV9L/GYG83SKUMPSjHPru+3iPZHYG7U=
|
||||
github.com/oneclickvirt/nt3 v0.0.3-20240809100110/go.mod h1:4SDl5o83wbixk9YJqvG0eNo2w8aWt/QgntfPBi9wEpY=
|
||||
github.com/oneclickvirt/pingtest v0.0.5-20240804134050 h1:ASiYr+IgWIPDhTiXEN1dbm1AEcxRkPnKi3NNn4mCkDE=
|
||||
github.com/oneclickvirt/pingtest v0.0.5-20240804134050/go.mod h1:d3Ntx5m9lMll3a/k3+2B+5emj//vgDh4/NHTxs2qQE8=
|
||||
github.com/oneclickvirt/portchecker v0.0.2-20240803151204 h1:ZruxRgyIv3d6Y8n0Ney5FHhQtcQLxCvs+xJmGsh9/7E=
|
||||
github.com/oneclickvirt/portchecker v0.0.2-20240803151204/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
|
||||
github.com/oneclickvirt/nt3 v0.0.4-20250118032755 h1:phF5kngqoPnS6onIbKII9ndw/N5l3ciIgR7fK5mfSBk=
|
||||
github.com/oneclickvirt/nt3 v0.0.4-20250118032755/go.mod h1:lDpHmjWwLZd6pO8cZCwzrc5rwd8dK+TIYk+DGmRpSGg=
|
||||
github.com/oneclickvirt/pingtest v0.0.5-20241006123443 h1:Ywrh0Yd/PYXOKGE8VaNiKGWlIqdgLLgsthAzxy0t7s8=
|
||||
github.com/oneclickvirt/pingtest v0.0.5-20241006123443/go.mod h1:d3Ntx5m9lMll3a/k3+2B+5emj//vgDh4/NHTxs2qQE8=
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250118031146 h1:tXTcpq8P3KgQupEZhPcAwdiyXYy//jXGb28bp4bSt4g=
|
||||
github.com/oneclickvirt/portchecker v0.0.3-20250118031146/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
|
||||
github.com/oneclickvirt/security v0.0.4-20240729065854 h1:I27XtMUEHmXw1RN0jNDQmFqNdu6vL4v1g8UZtXiCuBY=
|
||||
github.com/oneclickvirt/security v0.0.4-20240729065854/go.mod h1:384ZpNE3H6T6rtl0QhA4eQn8xGw7tc0rLD8ZH47qNGc=
|
||||
github.com/oneclickvirt/speedtest v0.0.8-20241005160129 h1:eCpt6y/ElPpV2yAvuyEO4mSMpI2BSjN0yeTBW60O870=
|
||||
github.com/oneclickvirt/speedtest v0.0.8-20241005160129/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=
|
||||
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
|
||||
github.com/oneclickvirt/speedtest v0.0.8-20250217133052 h1:Gzgc01DFR8kSbdf2iJdGvJMS3RPDYWnS9ZANi3iiqx4=
|
||||
github.com/oneclickvirt/speedtest v0.0.8-20250217133052/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
||||
github.com/onsi/ginkgo/v2 v2.22.1 h1:QW7tbJAUDyVDVOM5dFa7qaybo+CRfR7bemlQUN6Z8aM=
|
||||
github.com/onsi/ginkgo/v2 v2.22.1/go.mod h1:S6aTpoRsSq2cZOd+pssHAlKW/Q/jZt6cPrPlnj4a1xM=
|
||||
github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw=
|
||||
github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
|
||||
github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE=
|
||||
github.com/oschwald/maxminddb-golang v1.13.1/go.mod h1:K4pgV9N/GcK694KSTmVSDTODk4IsCNThNdTmnaBZ/F8=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||
github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8=
|
||||
github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
|
||||
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
|
||||
@@ -157,21 +156,21 @@ github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/prometheus-community/pro-bing v0.4.1 h1:aMaJwyifHZO0y+h8+icUz0xbToHbia0wdmzdVZ+Kl3w=
|
||||
github.com/prometheus-community/pro-bing v0.4.1/go.mod h1:aLsw+zqCaDoa2RLVVSX3+UiCkBBXTMtZC3c7EkfWnAE=
|
||||
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
|
||||
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
|
||||
github.com/quic-go/quic-go v0.45.1 h1:tPfeYCk+uZHjmDRwHHQmvHRYL2t44ROTujLeFVBmjCA=
|
||||
github.com/quic-go/quic-go v0.45.1/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI=
|
||||
github.com/refraction-networking/utls v1.6.6 h1:igFsYBUJPYM8Rno9xUuDoM5GQrVEqY4llzEXOkL43Ig=
|
||||
github.com/refraction-networking/utls v1.6.6/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
|
||||
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
||||
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
||||
github.com/quic-go/quic-go v0.48.2 h1:wsKXZPeGWpMpCGSWqOcqpW2wZYic/8T3aqiOID0/KWE=
|
||||
github.com/quic-go/quic-go v0.48.2/go.mod h1:yBgs3rWBOADpga7F+jJsb6Ybg1LSYiQvwWlLX+/6HMs=
|
||||
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
|
||||
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rodaine/table v1.2.0 h1:38HEnwK4mKSHQJIkavVj+bst1TEY7j9zhLMWu4QJrMA=
|
||||
github.com/rodaine/table v1.2.0/go.mod h1:wejb/q/Yd4T/SVmBSRMr7GCq3KlcZp3gyNYdLSBhkaE=
|
||||
github.com/rodaine/table v1.3.0 h1:4/3S3SVkHnVZX91EHFvAMV7K42AnJ0XuymRR2C5HlGE=
|
||||
github.com/rodaine/table v1.3.0/go.mod h1:47zRsHar4zw0jgxGxL9YtFfs7EGN6B/TaS+/Dmk4WxU=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk=
|
||||
github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0=
|
||||
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
|
||||
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||
github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74=
|
||||
@@ -188,10 +187,10 @@ github.com/showwin/speedtest-go v1.7.7 h1:VmK75SZOTKiuWjIVrs+mo7ZoKEw0utiGCvpnur
|
||||
github.com/showwin/speedtest-go v1.7.7/go.mod h1:uLgdWCNarXxlYsL2E5TOZpCIwpgSWnEANZp7gfHXHu0=
|
||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
||||
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
|
||||
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
|
||||
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
|
||||
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||
@@ -205,12 +204,13 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U=
|
||||
github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
||||
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
@@ -222,13 +222,15 @@ github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYg
|
||||
github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE=
|
||||
github.com/tsosunchia/powclient v0.1.5 h1:hpixFWoPbWSEC0zc9osSltyjtr1+SnhCueZVLkEpyyU=
|
||||
github.com/tsosunchia/powclient v0.1.5/go.mod h1:yNlzyq+w9llYZV+0q7nrX83ULy4ghq2mCjpTLJFJ2pg=
|
||||
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
|
||||
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
|
||||
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
|
||||
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
@@ -238,16 +240,16 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
|
||||
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
|
||||
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
|
||||
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
|
||||
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
|
||||
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
|
||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA=
|
||||
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
|
||||
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
|
||||
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
@@ -256,14 +258,14 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
|
||||
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
|
||||
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -272,15 +274,14 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
@@ -288,30 +289,30 @@ golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
|
||||
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
|
||||
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
|
||||
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=
|
||||
golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
|
||||
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
|
||||
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
|
||||
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
|
||||
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
|
108
goecs.go
108
goecs.go
@@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ecsVersion = "v0.0.78"
|
||||
ecsVersion = "v0.1.14"
|
||||
menuMode bool
|
||||
onlyChinaTest bool
|
||||
input, choice string
|
||||
@@ -61,23 +61,21 @@ var (
|
||||
enabelUpload = true
|
||||
help bool
|
||||
goecsFlag = flag.NewFlagSet("goecs", flag.ContinueOnError)
|
||||
finish bool
|
||||
)
|
||||
|
||||
func getMenuChoice(language string) string {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer signal.Stop(sigChan)
|
||||
|
||||
inputChan := make(chan string, 1)
|
||||
|
||||
go func() {
|
||||
select {
|
||||
case <-sigChan:
|
||||
fmt.Println("\n程序在选择过程中被用户中断")
|
||||
os.Exit(1)
|
||||
os.Exit(0)
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
@@ -96,15 +94,14 @@ func getMenuChoice(language string) string {
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
select {
|
||||
case input := <-inputChan:
|
||||
re := regexp.MustCompile(`^\d+$`) // 正则表达式匹配纯数字
|
||||
if re.MatchString(input) {
|
||||
choice := input
|
||||
switch choice {
|
||||
inChoice := input
|
||||
switch inChoice {
|
||||
case "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
|
||||
return choice
|
||||
return inChoice
|
||||
default:
|
||||
if language == "zh" {
|
||||
fmt.Println("无效的选项")
|
||||
@@ -210,7 +207,7 @@ func main() {
|
||||
}
|
||||
Loop:
|
||||
for {
|
||||
choice := getMenuChoice(language)
|
||||
choice = getMenuChoice(language)
|
||||
switch choice {
|
||||
case "1":
|
||||
basicStatus = true
|
||||
@@ -311,27 +308,64 @@ func main() {
|
||||
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
|
||||
output, tempOutput string
|
||||
)
|
||||
// 设置主程序的信号处理
|
||||
// 信号处理部分
|
||||
uploadDone := make(chan bool, 1)
|
||||
sig := make(chan os.Signal, 1)
|
||||
signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
// 启动一个goroutine来等待信号,内置计时器
|
||||
// 启动一个goroutine来等待信号
|
||||
go func() {
|
||||
startTime = time.Now()
|
||||
// 等待信号
|
||||
<-sig
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
minutes := int(duration.Minutes())
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||
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)
|
||||
utils.PrintCenteredTitle("", width)
|
||||
}, tempOutput, output)
|
||||
utils.ProcessAndUpload(output, filePath, enabelUpload)
|
||||
os.Exit(1) // 使用非零状态码退出,表示意外退出
|
||||
select {
|
||||
case <-sig:
|
||||
if !finish {
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
minutes := int(duration.Minutes())
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||
var mu sync.Mutex
|
||||
mu.Lock()
|
||||
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)
|
||||
utils.PrintCenteredTitle("", width)
|
||||
}, tempOutput, output)
|
||||
mu.Unlock()
|
||||
// 创建一个通道来传递上传结果
|
||||
resultChan := make(chan struct {
|
||||
httpURL string
|
||||
httpsURL string
|
||||
}, 1) // 使用带缓冲的通道,避免可能的阻塞
|
||||
// 启动上传
|
||||
go func() {
|
||||
httpURL, httpsURL := utils.ProcessAndUpload(output, 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)
|
||||
os.Exit(0)
|
||||
case <-time.After(30 * time.Second):
|
||||
fmt.Println("上传超时,程序退出")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
}()
|
||||
switch language {
|
||||
case "zh":
|
||||
@@ -341,7 +375,7 @@ func main() {
|
||||
if basicStatus {
|
||||
utils.PrintCenteredTitle("系统基础信息", width)
|
||||
}
|
||||
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
|
||||
basicInfo, securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus)
|
||||
if basicStatus {
|
||||
fmt.Printf(basicInfo)
|
||||
} else if (input == "6" || input == "9") && securityTestStatus {
|
||||
@@ -451,14 +485,16 @@ func main() {
|
||||
if speedTestStatus {
|
||||
utils.PrintCenteredTitle("就近节点测速", width)
|
||||
speedtest.ShowHead(language)
|
||||
if (menuMode && choice == "1") || !menuMode {
|
||||
if choice == "1" || !menuMode {
|
||||
speedtest.NearbySP()
|
||||
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" {
|
||||
} else if choice == "2" || choice == "3" || choice == "4" || choice == "5" {
|
||||
speedtest.CustomSP("net", "global", 4, language)
|
||||
} else if choice == "6" {
|
||||
speedtest.CustomSP("net", "global", 11, language)
|
||||
}
|
||||
}
|
||||
}, tempOutput, output)
|
||||
@@ -480,7 +516,7 @@ func main() {
|
||||
if basicStatus {
|
||||
utils.PrintCenteredTitle("System-Basic-Information", width)
|
||||
}
|
||||
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
|
||||
basicInfo, securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus)
|
||||
if basicStatus {
|
||||
fmt.Printf(basicInfo)
|
||||
} else if (input == "6" || input == "9") && securityTestStatus {
|
||||
@@ -573,7 +609,15 @@ func main() {
|
||||
default:
|
||||
fmt.Println("Unsupported language")
|
||||
}
|
||||
utils.ProcessAndUpload(output, filePath, enabelUpload)
|
||||
httpURL, httpsURL := utils.ProcessAndUpload(output, filePath, enabelUpload)
|
||||
if httpURL != "" || httpsURL != "" {
|
||||
if language == "en" {
|
||||
fmt.Printf("Upload successfully!\nHttp URL: %s\nHttps URL: %s\n", httpURL, httpsURL)
|
||||
} else {
|
||||
fmt.Printf("上传成功!\nHttp URL: %s\nHttps URL: %s\n", httpURL, httpsURL)
|
||||
}
|
||||
}
|
||||
finish = true
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
|
||||
fmt.Println("Press Enter to exit...")
|
||||
fmt.Scanln()
|
||||
|
618
goecs.sh
618
goecs.sh
@@ -1,8 +1,10 @@
|
||||
#!/bin/bash
|
||||
#From https://github.com/oneclickvirt/ecs
|
||||
#2024.07.21
|
||||
# From https://github.com/oneclickvirt/ecs
|
||||
# 2024.12.08
|
||||
|
||||
# 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
|
||||
|
||||
cat <<"EOF"
|
||||
GGGGGGGG OOOOOOO EEEEEEEE CCCCCCCCC SSSSSSSSSS
|
||||
@@ -24,6 +26,7 @@ _red() { echo -e "\033[31m\033[01m$@\033[0m"; }
|
||||
_green() { echo -e "\033[32m\033[01m$@\033[0m"; }
|
||||
_yellow() { echo -e "\033[33m\033[01m$@\033[0m"; }
|
||||
_blue() { echo -e "\033[36m\033[01m$@\033[0m"; }
|
||||
reading() { read -rp "$(_green "$1")" "$2"; }
|
||||
|
||||
check_cdn() {
|
||||
local o_url=$1
|
||||
@@ -59,135 +62,215 @@ download_file() {
|
||||
return 0
|
||||
}
|
||||
|
||||
check_china() {
|
||||
_yellow "正在检测IP所在区域......"
|
||||
if [[ -z "${CN}" ]]; then
|
||||
# 首先尝试通过 ipapi.co 检测
|
||||
if curl -m 6 -s https://ipapi.co/json | grep -q 'China'; then
|
||||
_yellow "根据ipapi.co提供的信息,当前IP可能在中国"
|
||||
if [ "$noninteractive" != "true" ]; then
|
||||
reading "是否使用中国镜像完成安装? ([y]/n) " input
|
||||
case $input in
|
||||
[yY][eE][sS] | [yY] | "")
|
||||
_green "已选择使用中国镜像"
|
||||
CN=true
|
||||
;;
|
||||
[nN][oO] | [nN])
|
||||
_yellow "已选择不使用中国镜像"
|
||||
CN=false
|
||||
;;
|
||||
*)
|
||||
_green "已选择使用中国镜像"
|
||||
CN=true
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# 在非交互模式下默认不使用中国镜像
|
||||
CN=false
|
||||
fi
|
||||
else
|
||||
CN=false
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
get_memory_size() {
|
||||
if [ -f /proc/meminfo ]; then
|
||||
local mem_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
|
||||
echo $((mem_kb / 1024)) # Convert to MB
|
||||
return
|
||||
fi
|
||||
if command -v free >/dev/null 2>&1; then
|
||||
local mem_kb=$(free -m | awk '/^Mem:/ {print $2}')
|
||||
echo "$mem_kb" # Already in MB
|
||||
return
|
||||
fi
|
||||
if command -v sysctl >/dev/null 2>&1; then
|
||||
local mem_bytes=$(sysctl -n hw.memsize 2>/dev/null || sysctl -n hw.physmem 2>/dev/null)
|
||||
if [ -n "$mem_bytes" ]; then
|
||||
echo $((mem_bytes / 1024 / 1024)) # Convert to MB
|
||||
return
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup_epel() {
|
||||
_yellow "Cleaning up EPEL repositories..."
|
||||
rm -f /etc/yum.repos.d/*epel*
|
||||
yum clean all
|
||||
}
|
||||
|
||||
goecs_check() {
|
||||
os=$(uname -s)
|
||||
arch=$(uname -m)
|
||||
ECS_VERSION=$(curl -m 6 -sSL "https://api.github.com/repos/oneclickvirt/ecs/releases/latest" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
|
||||
# 如果 https://api.github.com/ 请求失败,则使用 https://githubapi.spiritlhl.workers.dev/ ,此时可能宿主机无IPV4网络
|
||||
# Get system and architecture info with error handling
|
||||
os=$(uname -s 2>/dev/null || echo "Unknown")
|
||||
arch=$(uname -m 2>/dev/null || echo "Unknown")
|
||||
# First check for China IP
|
||||
check_china
|
||||
# Get latest version number with multiple backup sources
|
||||
ECS_VERSION=""
|
||||
for api in \
|
||||
"https://api.github.com/repos/oneclickvirt/ecs/releases/latest" \
|
||||
"https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" \
|
||||
"https://githubapi.spiritlhl.top/repos/oneclickvirt/ecs/releases/latest"; do
|
||||
ECS_VERSION=$(curl -m 6 -sSL "$api" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
|
||||
if [ -n "$ECS_VERSION" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
if [ -z "$ECS_VERSION" ]; then
|
||||
ECS_VERSION=$(curl -m 6 -sSL "https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
|
||||
_yellow "Unable to get version info, using default version 0.1.8"
|
||||
ECS_VERSION="0.1.8"
|
||||
fi
|
||||
# 如果 https://githubapi.spiritlhl.workers.dev/ 请求失败,则使用 https://githubapi.spiritlhl.top/ ,此时可能宿主机在国内
|
||||
if [ -z "$ECS_VERSION" ]; then
|
||||
ECS_VERSION=$(curl -m 6 -sSL "https://githubapi.spiritlhl.top/repos/oneclickvirt/ecs/releases/latest" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
|
||||
fi
|
||||
# 检测原始goecs命令是否存在,若存在则升级,不存在则安装
|
||||
version_output=$(goecs -v command 2>/dev/null || ./goecs -v command 2>/dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
# Check if original goecs command exists
|
||||
version_output=""
|
||||
for cmd_path in "goecs" "./goecs" "/usr/bin/goecs" "/usr/local/bin/goecs"; do
|
||||
if [ -x "$(command -v $cmd_path 2>/dev/null)" ]; then
|
||||
version_output=$($cmd_path -v command 2>/dev/null)
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -n "$version_output" ]; then
|
||||
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
|
||||
_green "goecs version ($extracted_version) is latest, no need to upgrade."
|
||||
_green "goecs version ($extracted_version) is up to date, no upgrade needed"
|
||||
return
|
||||
else
|
||||
_yellow "goecs version ($extracted_version) < $ecs_version, need to upgrade, 5 seconds later will start to upgrade"
|
||||
rm -rf /usr/bin/goecs
|
||||
rm -rf goecs
|
||||
_yellow "goecs version ($extracted_version) < $ecs_version, upgrade needed, starting in 5 seconds"
|
||||
rm -rf /usr/bin/goecs /usr/local/bin/goecs ./goecs
|
||||
fi
|
||||
fi
|
||||
else
|
||||
_green "Can not find goecs, need to download and install, 5 seconds later will start to install"
|
||||
_green "goecs not found, installation needed, starting in 5 seconds"
|
||||
fi
|
||||
sleep 5
|
||||
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
|
||||
check_cdn_file
|
||||
# Download corresponding version with error handling
|
||||
if [[ "$CN" == true ]]; then
|
||||
_yellow "Using China mirror for download..."
|
||||
base_url="https://cnb.cool/oneclickvirt/ecs/-/git/raw/main"
|
||||
else
|
||||
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
|
||||
check_cdn_file
|
||||
if [ -n "$cdn_success_url" ]; then
|
||||
base_url="${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}"
|
||||
else
|
||||
base_url="https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}"
|
||||
fi
|
||||
fi
|
||||
# Build download URL with architecture support
|
||||
local zip_file=""
|
||||
case $os in
|
||||
Linux)
|
||||
Linux|linux|LINUX)
|
||||
case $arch in
|
||||
"x86_64" | "x86" | "amd64" | "x64")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_amd64.zip" "goecs.zip"
|
||||
;;
|
||||
"i386" | "i686")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_386.zip" "goecs.zip"
|
||||
;;
|
||||
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_arm64.zip" "goecs.zip"
|
||||
;;
|
||||
"mips")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mips.zip" "goecs.zip"
|
||||
;;
|
||||
"mipsle")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mipsle.zip" "goecs.zip"
|
||||
;;
|
||||
"s390x")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_s390x.zip" "goecs.zip"
|
||||
;;
|
||||
"riscv64")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_riscv64.zip" "goecs.zip"
|
||||
;;
|
||||
*)
|
||||
_red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
|
||||
exit 1
|
||||
;;
|
||||
x86_64|amd64|x64) zip_file="goecs_linux_amd64.zip" ;;
|
||||
i386|i686) zip_file="goecs_linux_386.zip" ;;
|
||||
aarch64|arm64|armv8|armv8l) zip_file="goecs_linux_arm64.zip" ;;
|
||||
arm|armv7l) zip_file="goecs_linux_arm.zip" ;;
|
||||
mips) zip_file="goecs_linux_mips.zip" ;;
|
||||
mipsle) zip_file="goecs_linux_mipsle.zip" ;;
|
||||
s390x) zip_file="goecs_linux_s390x.zip" ;;
|
||||
riscv64) zip_file="goecs_linux_riscv64.zip" ;;
|
||||
*) zip_file="goecs_linux_amd64.zip" ;;
|
||||
esac
|
||||
;;
|
||||
FreeBSD)
|
||||
FreeBSD|freebsd)
|
||||
case $arch in
|
||||
"x86_64" | "x86" | "amd64" | "x64")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_amd64.zip" "goecs.zip"
|
||||
;;
|
||||
"i386" | "i686")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_386.zip" "goecs.zip"
|
||||
;;
|
||||
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_arm64.zip" "goecs.zip"
|
||||
;;
|
||||
*)
|
||||
_red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
|
||||
exit 1
|
||||
;;
|
||||
x86_64|amd64) zip_file="goecs_freebsd_amd64.zip" ;;
|
||||
i386|i686) zip_file="goecs_freebsd_386.zip" ;;
|
||||
arm64|aarch64) zip_file="goecs_freebsd_arm64.zip" ;;
|
||||
*) zip_file="goecs_freebsd_amd64.zip" ;;
|
||||
esac
|
||||
;;
|
||||
Darwin)
|
||||
Darwin|darwin)
|
||||
case $arch in
|
||||
"x86_64" | "x86" | "amd64" | "x64")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_amd64.zip" "goecs.zip"
|
||||
;;
|
||||
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
|
||||
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_arm64.zip" "goecs.zip"
|
||||
;;
|
||||
*)
|
||||
_red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
|
||||
exit 1
|
||||
;;
|
||||
x86_64|amd64) zip_file="goecs_darwin_amd64.zip" ;;
|
||||
arm64|aarch64) zip_file="goecs_darwin_arm64.zip" ;;
|
||||
*) zip_file="goecs_darwin_amd64.zip" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
_red "Unsupported operating system: $os , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
|
||||
exit 1
|
||||
_yellow "Unknown system $os, trying amd64 version"
|
||||
zip_file="goecs_linux_amd64.zip"
|
||||
;;
|
||||
esac
|
||||
unzip goecs.zip
|
||||
rm -rf goecs.zip
|
||||
rm -rf README.md
|
||||
rm -rf LICENSE
|
||||
sleep 1
|
||||
chmod 777 goecs
|
||||
rm -rf /usr/bin/goecs
|
||||
sleep 1
|
||||
cp goecs /usr/bin/goecs
|
||||
rm -rf README_EN.md
|
||||
rm -rf README.md
|
||||
PARAM="net.ipv4.ping_group_range"
|
||||
NEW_VALUE="0 2147483647"
|
||||
CURRENT_VALUE=$(sysctl -n "$PARAM" 2>/dev/null)
|
||||
if [ -f /etc/sysctl.conf ] && [ "$CURRENT_VALUE" != "$NEW_VALUE" ]; then
|
||||
if grep -q "^$PARAM" /etc/sysctl.conf; then
|
||||
sudo sed -i "s/^$PARAM.*/$PARAM = $NEW_VALUE/" /etc/sysctl.conf
|
||||
else
|
||||
echo "$PARAM = $NEW_VALUE" | sudo tee -a /etc/sysctl.conf
|
||||
download_url="${base_url}/${zip_file}"
|
||||
_green "Downloading $download_url"
|
||||
# Download file with retry mechanism
|
||||
local max_retries=3
|
||||
local retry_count=0
|
||||
while [ $retry_count -lt $max_retries ]; do
|
||||
if download_file "$download_url" "goecs.zip"; then
|
||||
break
|
||||
fi
|
||||
sudo sysctl -p
|
||||
_yellow "Download failed, retrying (${retry_count}/${max_retries})..."
|
||||
retry_count=$((retry_count + 1))
|
||||
sleep 2
|
||||
done
|
||||
if [ $retry_count -eq $max_retries ]; then
|
||||
_red "Download failed, please check your network connection or download manually"
|
||||
return 1
|
||||
fi
|
||||
setcap cap_net_raw=+ep goecs
|
||||
setcap cap_net_raw=+ep /usr/bin/goecs
|
||||
echo "goecs version:"
|
||||
# Extract and install with error handling
|
||||
if ! unzip -o goecs.zip >/dev/null 2>&1; then
|
||||
_red "Extraction failed"
|
||||
return 1
|
||||
fi
|
||||
rm -f goecs.zip README.md LICENSE README_EN.md
|
||||
# Set execution permissions and install
|
||||
chmod 777 goecs
|
||||
for install_path in "/usr/bin" "/usr/local/bin"; do
|
||||
if [ -d "$install_path" ]; then
|
||||
cp -f goecs "$install_path/"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# Set system parameters
|
||||
if [ "$os" != "Darwin" ]; then
|
||||
PARAM="net.ipv4.ping_group_range"
|
||||
NEW_VALUE="0 2147483647"
|
||||
if [ -f /etc/sysctl.conf ]; then
|
||||
if grep -q "^$PARAM" /etc/sysctl.conf; then
|
||||
sed -i "s/^$PARAM.*/$PARAM = $NEW_VALUE/" /etc/sysctl.conf
|
||||
else
|
||||
echo "$PARAM = $NEW_VALUE" >> /etc/sysctl.conf
|
||||
fi
|
||||
sysctl -p >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
# Set special permissions
|
||||
setcap cap_net_raw=+ep goecs 2>/dev/null
|
||||
setcap cap_net_raw=+ep /usr/bin/goecs 2>/dev/null
|
||||
setcap cap_net_raw=+ep /usr/local/bin/goecs 2>/dev/null
|
||||
_green "goecs installation complete, current version:"
|
||||
goecs -v || ./goecs -v
|
||||
}
|
||||
|
||||
InstallSysbench() {
|
||||
if [ -f "/etc/centos-release" ]; then # CentOS
|
||||
if [ -f "/etc/opencloudos-release" ]; then # OpenCloudOS
|
||||
Var_OSRelease="opencloudos"
|
||||
elif [ -f "/etc/centos-release" ]; then # CentOS
|
||||
Var_OSRelease="centos"
|
||||
elif [ -f "/etc/fedora-release" ]; then # Fedora
|
||||
Var_OSRelease="fedora"
|
||||
@@ -203,7 +286,6 @@ InstallSysbench() {
|
||||
Var_OSRelease="alpinelinux"
|
||||
elif [ -f "/etc/almalinux-release" ]; then # almalinux
|
||||
Var_OSRelease="almalinux"
|
||||
# rockylinux
|
||||
elif [ -f "/etc/arch-release" ]; then # archlinux
|
||||
Var_OSRelease="arch"
|
||||
elif [ -f "/etc/freebsd-update.conf" ]; then # freebsd
|
||||
@@ -211,15 +293,70 @@ InstallSysbench() {
|
||||
else
|
||||
Var_OSRelease="unknown" # 未知系统分支
|
||||
fi
|
||||
case "$Var_OSRelease" in
|
||||
ubuntu | debian | astra) ! apt-get install -y sysbench && apt-get --fix-broken install -y && apt-get install --no-install-recommends -y sysbench ;;
|
||||
centos | rhel | almalinux | redhat) (yum -y install epel-release && yum -y install sysbench) || (dnf install epel-release -y && dnf install sysbench -y) ;;
|
||||
fedora) dnf -y install sysbench ;;
|
||||
arch) pacman -S --needed --noconfirm sysbench && pacman -S --needed --noconfirm libaio && ldconfig ;;
|
||||
freebsd) pkg install -y sysbench ;;
|
||||
alpinelinux) echo -e "${Msg_Warning}Sysbench Module not found, installing ..." && echo -e "${Msg_Warning}SysBench Current not support Alpine Linux, Skipping..." && Var_Skip_SysBench="1" ;;
|
||||
*) _red "Sysbench Install Error: Unknown OS release: $os_release" ;;
|
||||
esac
|
||||
local mem_size=$(get_memory_size)
|
||||
if [ -z "$mem_size" ] || [ "$mem_size" -eq 0 ]; then
|
||||
echo "Error: Unable to determine memory size or memory size is zero."
|
||||
elif [ $mem_size -lt 1024 ]; then
|
||||
_red "Warning: Your system has less than 1GB RAM (${mem_size}MB)"
|
||||
if [ "$noninteractive" != "true" ]; then
|
||||
reading "Do you want to continue with EPEL installation? (y/N): " confirm
|
||||
if [[ ! $confirm =~ ^[Yy]$ ]]; then
|
||||
_yellow "Skipping EPEL installation"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
case "$Var_OSRelease" in
|
||||
ubuntu | debian | astra)
|
||||
! apt-get install -y sysbench && apt-get --fix-broken install -y && apt-get install --no-install-recommends -y sysbench ;;
|
||||
centos | rhel | almalinux | redhat | opencloudos)
|
||||
(yum -y install epel-release && yum -y install sysbench) || (dnf install epel-release -y && dnf install sysbench -y) ;;
|
||||
fedora)
|
||||
dnf -y install sysbench ;;
|
||||
arch)
|
||||
pacman -S --needed --noconfirm sysbench && pacman -S --needed --noconfirm libaio && ldconfig ;;
|
||||
freebsd)
|
||||
pkg install -y sysbench ;;
|
||||
alpinelinux)
|
||||
if [ "$noninteractive" != "true" ]; then
|
||||
reading "Do you want to continue with sysbench installation? (y/N): " confirm
|
||||
if [[ ! $confirm =~ ^[Yy]$ ]]; then
|
||||
_yellow "Skipping sysbench installation"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
ALPINE_VERSION=$(grep -o '^[0-9]\+\.[0-9]\+' /etc/alpine-release)
|
||||
COMMUNITY_REPO="http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community"
|
||||
if grep -q "^${COMMUNITY_REPO}" /etc/apk/repositories; then
|
||||
echo "Community repository is already enabled."
|
||||
else
|
||||
echo "Enabling community repository..."
|
||||
echo "${COMMUNITY_REPO}" >> /etc/apk/repositories
|
||||
echo "Community repository has been added."
|
||||
echo "Updating apk package index..."
|
||||
apk update && echo "Package index updated successfully."
|
||||
fi
|
||||
if apk info sysbench >/dev/null 2>&1; then
|
||||
echo -e "${Msg_Info}Sysbench already installed."
|
||||
else
|
||||
apk add --no-cache sysbench
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${Msg_Warning}Sysbench Module not found, installing ..." && echo -e "${Msg_Warning}SysBench Current not support Alpine Linux, Skipping..." && Var_Skip_SysBench="1"
|
||||
else
|
||||
echo -e "${Msg_Success}Sysbench installed successfully."
|
||||
fi
|
||||
fi ;;
|
||||
*)
|
||||
_red "Sysbench Install Error: Unknown OS release: $Var_OSRelease" ;;
|
||||
esac
|
||||
if [[ $SYSTEM =~ ^(CentOS|RHEL|AlmaLinux)$ ]]; then
|
||||
_yellow "Installing EPEL repository..."
|
||||
if ! yum -y install epel-release; then
|
||||
_red "EPEL installation failed!"
|
||||
cleanup_epel
|
||||
_yellow "Attempting to continue without EPEL..."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Check_SysBench() {
|
||||
@@ -248,6 +385,9 @@ Check_Sysbench_InstantBuild() {
|
||||
if [ "$os_sysbench" = "astra" ]; then
|
||||
os_sysbench="debian"
|
||||
fi
|
||||
if [ "$os_sysbench" = "opencloudos" ]; then
|
||||
os_sysbench="centos"
|
||||
fi
|
||||
echo -e "${Msg_Info}Release Detected: ${os_sysbench}"
|
||||
echo -e "${Msg_Info}Preparing compile enviorment ..."
|
||||
prepare_compile_env "${os_sysbench}"
|
||||
@@ -282,15 +422,15 @@ prepare_compile_env() {
|
||||
}
|
||||
|
||||
env_check() {
|
||||
REGEX=("debian|astra" "ubuntu" "centos|red hat|kernel|oracle linux|alma|rocky" "'amazon linux'" "fedora" "arch" "freebsd" "alpine" "openbsd")
|
||||
RELEASE=("Debian" "Ubuntu" "CentOS" "CentOS" "Fedora" "Arch" "FreeBSD" "Alpine" "OpenBSD")
|
||||
PACKAGE_UPDATE=("apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update" "pacman -Sy" "pkg update" "apk update" "pkg_add -u")
|
||||
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")
|
||||
# 检查系统信息
|
||||
if [ -f /etc/alpine-release ]; then
|
||||
SYS="alpine"
|
||||
REGEX=("debian|astra" "ubuntu" "centos|red hat|kernel|oracle linux|alma|rocky" "'amazon linux'" "fedora" "arch" "freebsd" "alpine" "openbsd" "opencloudos")
|
||||
RELEASE=("Debian" "Ubuntu" "CentOS" "CentOS" "Fedora" "Arch" "FreeBSD" "Alpine" "OpenBSD" "OpenCloudOS")
|
||||
PACKAGE_UPDATE=("apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update" "pacman -Sy" "pkg update" "apk update" "pkg_add -qu" "yum -y update")
|
||||
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 --no-cache" "pkg_add -I" "yum -y install")
|
||||
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" "pkg_delete -I" "yum -y remove")
|
||||
PACKAGE_UNINSTALL=("apt-get -y autoremove" "apt-get -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove" "pacman -Rns --noconfirm" "pkg autoremove" "apk autoremove" "pkg_delete -a" "yum -y autoremove")
|
||||
# Check system information
|
||||
if [ -f /etc/opencloudos-release ]; then
|
||||
SYS="opencloudos"
|
||||
elif [ -s /etc/os-release ]; then
|
||||
SYS="$(grep -i pretty_name /etc/os-release | cut -d \" -f2)"
|
||||
elif [ -x "$(type -p hostnamectl)" ]; then
|
||||
@@ -306,76 +446,104 @@ env_check() {
|
||||
else
|
||||
SYS="$(uname -s)"
|
||||
fi
|
||||
[[ -n $SYS ]] || exit 1
|
||||
# 匹配操作系统
|
||||
# Match operating system
|
||||
SYSTEM=""
|
||||
for ((int = 0; int < ${#REGEX[@]}; int++)); do
|
||||
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
|
||||
SYSTEM="${RELEASE[int]}"
|
||||
[[ -n $SYSTEM ]] && break
|
||||
UPDATE_CMD=${PACKAGE_UPDATE[int]}
|
||||
INSTALL_CMD=${PACKAGE_INSTALL[int]}
|
||||
REMOVE_CMD=${PACKAGE_REMOVE[int]}
|
||||
UNINSTALL_CMD=${PACKAGE_UNINSTALL[int]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
# 检查是否成功匹配
|
||||
[[ -n $SYSTEM ]] || exit 1
|
||||
# 根据 SYSTEM 设置相应的包管理命令
|
||||
UPDATE_CMD=${PACKAGE_UPDATE[int]}
|
||||
INSTALL_CMD=${PACKAGE_INSTALL[int]}
|
||||
REMOVE_CMD=${PACKAGE_REMOVE[int]}
|
||||
UNINSTALL_CMD=${PACKAGE_UNINSTALL[int]}
|
||||
echo "System: $SYSTEM"
|
||||
echo "Update command: $UPDATE_CMD"
|
||||
echo "Install command: $INSTALL_CMD"
|
||||
echo "Remove command: $REMOVE_CMD"
|
||||
echo "Uninstall command: $UNINSTALL_CMD"
|
||||
# If system is unrecognized, try common package managers
|
||||
if [ -z "$SYSTEM" ]; then
|
||||
_yellow "Unable to recognize system, trying common package managers..."
|
||||
# Try apt
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
SYSTEM="Unknown-Debian"
|
||||
UPDATE_CMD="apt-get update"
|
||||
INSTALL_CMD="apt-get -y install"
|
||||
REMOVE_CMD="apt-get -y remove"
|
||||
UNINSTALL_CMD="apt-get -y autoremove"
|
||||
# Try yum
|
||||
elif command -v yum >/dev/null 2>&1; then
|
||||
SYSTEM="Unknown-RHEL"
|
||||
UPDATE_CMD="yum -y update"
|
||||
INSTALL_CMD="yum -y install"
|
||||
REMOVE_CMD="yum -y remove"
|
||||
UNINSTALL_CMD="yum -y autoremove"
|
||||
# Try dnf
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
SYSTEM="Unknown-Fedora"
|
||||
UPDATE_CMD="dnf -y update"
|
||||
INSTALL_CMD="dnf -y install"
|
||||
REMOVE_CMD="dnf -y remove"
|
||||
UNINSTALL_CMD="dnf -y autoremove"
|
||||
# Try pacman
|
||||
elif command -v pacman >/dev/null 2>&1; then
|
||||
SYSTEM="Unknown-Arch"
|
||||
UPDATE_CMD="pacman -Sy"
|
||||
INSTALL_CMD="pacman -S --noconfirm"
|
||||
REMOVE_CMD="pacman -R --noconfirm"
|
||||
UNINSTALL_CMD="pacman -Rns --noconfirm"
|
||||
# Try apk
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
SYSTEM="Unknown-Alpine"
|
||||
UPDATE_CMD="apk update"
|
||||
INSTALL_CMD="apk add"
|
||||
REMOVE_CMD="apk del"
|
||||
UNINSTALL_CMD="apk del"
|
||||
elif command -v zypper >/dev/null 2>&1; then
|
||||
SYSTEM="Unknown-SLES"
|
||||
UPDATE_CMD="zypper refresh"
|
||||
INSTALL_CMD="zypper install -y"
|
||||
REMOVE_CMD="zypper remove -y"
|
||||
UNINSTALL_CMD="zypper remove -y"
|
||||
else
|
||||
_red "Unable to recognize package manager, exiting installation"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
_green "System information: $SYSTEM"
|
||||
_green "Update command: $UPDATE_CMD"
|
||||
_green "Install command: $INSTALL_CMD"
|
||||
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
|
||||
check_cdn_file
|
||||
_green "Update system manager."
|
||||
${PACKAGE_UPDATE[int]} 2>/dev/null
|
||||
if ! command -v sudo >/dev/null 2>&1; then
|
||||
_green "Installing sudo"
|
||||
${PACKAGE_INSTALL[int]} sudo
|
||||
fi
|
||||
if ! command -v wget >/dev/null 2>&1; then
|
||||
_green "Installing wget"
|
||||
${PACKAGE_INSTALL[int]} wget
|
||||
fi
|
||||
if ! command -v tar >/dev/null 2>&1; then
|
||||
_green "Installing tar"
|
||||
${PACKAGE_INSTALL[int]} tar
|
||||
fi
|
||||
if ! command -v unzip >/dev/null 2>&1; then
|
||||
_green "Installing unzip"
|
||||
${PACKAGE_INSTALL[int]} unzip
|
||||
fi
|
||||
if ! command -v systemd-detect-virt >/dev/null 2>&1; then
|
||||
_green "Installing systemd-detect-virt"
|
||||
${PACKAGE_INSTALL[int]} systemd-detect-virt
|
||||
if [ $? -ne 0 ]; then
|
||||
if ! command -v dmidecode >/dev/null 2>&1; then
|
||||
_green "Installing dmidecode"
|
||||
${PACKAGE_INSTALL[int]} dmidecode
|
||||
_yellow "Warning: System update will be performed"
|
||||
_yellow "This operation may:"
|
||||
_yellow "1. Take considerable time"
|
||||
_yellow "2. Cause temporary network interruptions"
|
||||
_yellow "3. Impact system stability"
|
||||
_yellow "4. Affect subsequent system startups"
|
||||
if [ "$noninteractive" != "true" ]; then
|
||||
reading "Continue with system update? (y/N): " update_confirm
|
||||
if [[ ! $update_confirm =~ ^[Yy]$ ]]; then
|
||||
_yellow "Skipping system update"
|
||||
_yellow "Note: Some packages may fail to install"
|
||||
else
|
||||
_green "Updating system package manager..."
|
||||
if ! ${UPDATE_CMD} 2>/dev/null; then
|
||||
_red "System update failed!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if ! command -v dd >/dev/null 2>&1; then
|
||||
_green "Installing dd"
|
||||
${PACKAGE_INSTALL[int]} coreutils
|
||||
if [ $? -ne 0 ]; then
|
||||
${PACKAGE_INSTALL[int]} man
|
||||
# Install necessary commands
|
||||
for cmd in sudo wget tar unzip iproute2 systemd-detect-virt dd fio; do
|
||||
if ! command -v "$cmd" >/dev/null 2>&1; then
|
||||
_green "Installing $cmd"
|
||||
${INSTALL_CMD} "$cmd"
|
||||
fi
|
||||
fi
|
||||
if ! command -v fio >/dev/null 2>&1; then
|
||||
_green "Installing fio"
|
||||
${PACKAGE_INSTALL[int]} fio
|
||||
fi
|
||||
if ! command -v sysbench >/dev/null 2>&1 && [ "${REGEX[int]}" != "freebsd" ]; then
|
||||
done
|
||||
# sysbench installation
|
||||
if ! command -v sysbench >/dev/null 2>&1; then
|
||||
_green "Installing sysbench"
|
||||
${PACKAGE_INSTALL[int]} sysbench
|
||||
${INSTALL_CMD} sysbench
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Unable to download sysbench through the system's package manager, speak to try compiling and installing it..."
|
||||
if ! wget -O /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"; then
|
||||
echo "wget failed, trying with curl"
|
||||
curl -Lk -o /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"
|
||||
fi
|
||||
echo "Unable to download sysbench through package manager, attempting compilation..."
|
||||
wget -O /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip" || curl -Lk -o /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"
|
||||
if [ ! -f /tmp/sysbench.zip ]; then
|
||||
wget -q -O /tmp/sysbench.zip "https://hub.fgit.cf/akopytov/sysbench/archive/1.0.20.zip"
|
||||
fi
|
||||
@@ -384,70 +552,71 @@ env_check() {
|
||||
Check_SysBench
|
||||
fi
|
||||
fi
|
||||
# geekbench and speedtest installation
|
||||
if ! command -v geekbench >/dev/null 2>&1; then
|
||||
_green "Installing geekbench"
|
||||
curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/cputest/main/dgb.sh" -o dgb.sh && chmod +x dgb.sh
|
||||
bash dgb.sh -v gb5
|
||||
_blue "If you not want to use geekbench5, you can use"
|
||||
echo "bash dgb.sh -v gb6"
|
||||
echo "bash dgb.sh -v gb4"
|
||||
_blue "to change version, or use"
|
||||
echo "rm -rf /usr/bin/geekbench*"
|
||||
_blue "to uninstall geekbench"
|
||||
rm -rf dgb.sh
|
||||
fi
|
||||
if ! command -v speedtest >/dev/null 2>&1; then
|
||||
_green "Installing geekbench"
|
||||
_green "Installing speedtest"
|
||||
curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/speedtest/main/dspt.sh" -o dspt.sh && chmod +x dspt.sh
|
||||
bash dspt.sh
|
||||
rm -rf dspt.sh
|
||||
rm -rf speedtest.tar.gz
|
||||
_blue "if you want to use golang origin speedtest, you can use"
|
||||
echo "rm -rf /usr/bin/speedtest"
|
||||
echo "rm -rf /usr/bin/speedtest-go"
|
||||
_blue "to uninstall speedtest and speedtest-go"
|
||||
fi
|
||||
if ! command -v ping >/dev/null 2>&1; then
|
||||
_green "Installing ping"
|
||||
${PACKAGE_INSTALL[int]} iputils-ping >/dev/null 2>&1
|
||||
${PACKAGE_INSTALL[int]} ping >/dev/null 2>&1
|
||||
${INSTALL_CMD} iputils-ping >/dev/null 2>&1
|
||||
${INSTALL_CMD} ping >/dev/null 2>&1
|
||||
fi
|
||||
# MacOS support
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo "Detected MacOS. Installing sysbench and fio..."
|
||||
brew install --force sysbench fio dd
|
||||
# 有问题,需要修复,root环境不能brew,brew安装完毕后可能路径不在环境变量中
|
||||
echo "Detected MacOS, installing sysbench iproute2mac fio..."
|
||||
brew install --force sysbench iproute2mac fio
|
||||
else
|
||||
if ! grep -q "^net.ipv4.ping_group_range = 0 2147483647$" /etc/sysctl.conf; then
|
||||
echo "net.ipv4.ping_group_range = 0 2147483647" >> /etc/sysctl.conf
|
||||
sysctl -p
|
||||
fi
|
||||
fi
|
||||
_green "The environment is ready."
|
||||
_green "The next command is: ./goecs.sh install"
|
||||
_green "Environment preparation complete."
|
||||
_green "Next command is: ./goecs.sh install"
|
||||
}
|
||||
|
||||
uninstall_goecs() {
|
||||
rm -rf /root/goecs
|
||||
rm -rf /usr/bin/goecs
|
||||
_green "The command (goecs) has been uninstalled."
|
||||
rm -rf /root/goecs
|
||||
rm -rf /usr/bin/goecs
|
||||
_green "The command (goecs) has been uninstalled."
|
||||
}
|
||||
|
||||
show_help() {
|
||||
cat <<"EOF"
|
||||
可用命令:
|
||||
|
||||
./goecs.sh env 检查并安装的包:
|
||||
sudo (几乎所有类 Unix 系统都有。)
|
||||
tar (几乎所有类 Unix 系统都有。)
|
||||
unzip (几乎所有类 Unix 系统都有。)
|
||||
dd (几乎所有类 Unix 系统都有。)
|
||||
fio (几乎所有类 Unix 系统可以通过系统的包管理器安装。)
|
||||
sysbench (几乎所有类 Unix 系统可以通过系统的包管理器安装。)
|
||||
geekbench (geekbench5) (仅支持 IPV4 环境,且内存大于 1GB 并需要持续联网,仅支持 amd64 和 arm64 架构。)
|
||||
speedtest (使用官方提供的二进制文件以获得更准确的测试结果。)
|
||||
ping (使用官方提供的二进制文件以获得更准确的测试结果。)
|
||||
systemd-detect-virt 或 dmidecode (几乎所有类 Unix 系统都有,安装以获得更准确的测试结果。)
|
||||
事实上,sysbench/geekbench 是上述依赖项中唯一必须安装的,没有它们无法测试 CPU 分数。
|
||||
./goecs.sh env 检查并安装依赖包
|
||||
警告: 此命令会执行系统更新(可选择),可能:
|
||||
1. 耗时较长
|
||||
2. 导致网络短暂中断
|
||||
3. 影响系统稳定性
|
||||
4. 影响后续系统启动
|
||||
对于内存小于1GB的系统,还可能导致:
|
||||
1. 系统卡死
|
||||
2. SSH连接中断
|
||||
3. 关键服务失败
|
||||
推荐:
|
||||
环境依赖安装过程中挂起执行
|
||||
|
||||
必需组件:
|
||||
sysbench/geekbench (CPU性能测试必需)
|
||||
|
||||
可选组件:
|
||||
sudo, tar, unzip, dd, fio
|
||||
speedtest (网络测试)
|
||||
ping (网络连通性测试)
|
||||
systemd-detect-virt/dmidecode (系统信息检测)
|
||||
|
||||
./goecs.sh install 安装 goecs 命令
|
||||
./goecs.sh upgrade 升级 goecs 命令
|
||||
./goecs.sh uninstall 卸载 goecs 命令
|
||||
@@ -455,18 +624,28 @@ show_help() {
|
||||
|
||||
Available commands:
|
||||
|
||||
./goecs.sh env Check and Install package:
|
||||
sudo (Almost all unix-like systems have it.)
|
||||
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.)
|
||||
ping (Use the officially provided binaries for more accurate test results.)
|
||||
systemd-detect-virt OR dmidecode (Almost all unix-like systems have it, 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 env Check and Install dependencies
|
||||
Warning: This command performs system update(optional), which may:
|
||||
1. Take considerable time
|
||||
2. Cause temporary network interruptions
|
||||
3. Impact system stability
|
||||
4. Affect subsequent system startups
|
||||
For systems with less than 1GB RAM, additional risks:
|
||||
1. System freeze
|
||||
2. SSH connection loss
|
||||
3. Critical service failures
|
||||
Recommended:
|
||||
Hanging execution during environment dependency installation
|
||||
|
||||
Required components:
|
||||
sysbench/geekbench (Required for CPU testing)
|
||||
|
||||
Optional components:
|
||||
sudo, tar, unzip, dd, fio
|
||||
speedtest (Network testing)
|
||||
ping (Network connectivity)
|
||||
systemd-detect-virt/dmidecode (System info detection)
|
||||
|
||||
./goecs.sh install Install goecs command
|
||||
./goecs.sh upgrade Upgrade goecs command
|
||||
./goecs.sh uninstall Uninstall goecs command
|
||||
@@ -493,3 +672,4 @@ case "$1" in
|
||||
show_help
|
||||
;;
|
||||
esac
|
||||
|
||||
|
177
utils/utils.go
177
utils/utils.go
@@ -1,10 +1,12 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/imroc/req/v3"
|
||||
"github.com/oneclickvirt/UnlockTests/uts"
|
||||
"github.com/oneclickvirt/basics/ipv6"
|
||||
"github.com/oneclickvirt/basics/system"
|
||||
. "github.com/oneclickvirt/defaultset"
|
||||
"github.com/oneclickvirt/security/network"
|
||||
@@ -58,59 +60,24 @@ func CheckChina(enableLogger bool) bool {
|
||||
SetRetryBackoffInterval(1*time.Second, 3*time.Second).
|
||||
SetRetryFixedInterval(2 * time.Second)
|
||||
ipapiURL := "https://ipapi.co/json"
|
||||
cipccURL := "http://cip.cc"
|
||||
ipapiResp, err := client.R().Get(ipapiURL)
|
||||
if err != nil {
|
||||
if enableLogger {
|
||||
Logger.Info("无法获取IP信息:" + err.Error())
|
||||
}
|
||||
} else {
|
||||
defer ipapiResp.Body.Close()
|
||||
var ipapiBody string
|
||||
ipapiBody, err = ipapiResp.ToString()
|
||||
if err != nil {
|
||||
if enableLogger {
|
||||
Logger.Info("无法读取IP信息响应:" + err.Error())
|
||||
}
|
||||
} else {
|
||||
isInChina := strings.Contains(ipapiBody, "China")
|
||||
if isInChina {
|
||||
fmt.Println("根据ipapi.co提供的信息,当前IP可能在中国")
|
||||
var input string
|
||||
fmt.Print("是否选用中国专项测试(无流媒体测试,有三网Ping值测试)? ([y]/n) ")
|
||||
fmt.Scanln(&input)
|
||||
switch strings.ToLower(input) {
|
||||
case "yes", "y":
|
||||
fmt.Println("使用中国专项测试")
|
||||
selectChina = true
|
||||
case "no", "n":
|
||||
fmt.Println("不使用中国专项测试")
|
||||
default:
|
||||
fmt.Println("使用中国专项测试")
|
||||
selectChina = true
|
||||
}
|
||||
return selectChina
|
||||
}
|
||||
}
|
||||
}
|
||||
cipccResp, err := client.R().Get(cipccURL)
|
||||
if err != nil {
|
||||
if enableLogger {
|
||||
Logger.Info("无法获取IP信息:" + err.Error())
|
||||
}
|
||||
return false
|
||||
}
|
||||
defer cipccResp.Body.Close()
|
||||
cipccBody, err := cipccResp.ToString()
|
||||
defer ipapiResp.Body.Close()
|
||||
ipapiBody, err := ipapiResp.ToString()
|
||||
if err != nil {
|
||||
if enableLogger {
|
||||
Logger.Info("无法读取IP信息响应:" + err.Error())
|
||||
}
|
||||
return false
|
||||
}
|
||||
isInChina := strings.Contains(cipccBody, "中国")
|
||||
isInChina := strings.Contains(ipapiBody, "China")
|
||||
if isInChina {
|
||||
fmt.Println("根据cip.cc提供的信息,当前IP可能在中国")
|
||||
fmt.Println("根据 ipapi.co 提供的信息,当前IP可能在中国")
|
||||
var input string
|
||||
fmt.Print("是否选用中国专项测试(无流媒体测试,有三网Ping值测试)? ([y]/n) ")
|
||||
fmt.Scanln(&input)
|
||||
@@ -121,19 +88,19 @@ func CheckChina(enableLogger bool) bool {
|
||||
case "no", "n":
|
||||
fmt.Println("不使用中国专项测试")
|
||||
default:
|
||||
fmt.Println("不使用中国专项测试")
|
||||
fmt.Println("使用中国专项测试")
|
||||
selectChina = true
|
||||
}
|
||||
}
|
||||
return selectChina
|
||||
}
|
||||
|
||||
// SecurityCheck 执行安全检查
|
||||
func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) {
|
||||
// BasicsAndSecurityCheck 执行安全检查
|
||||
func BasicsAndSecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) {
|
||||
var wgt sync.WaitGroup
|
||||
var ipInfo, securityInfo, systemInfo string
|
||||
var err error
|
||||
wgt.Add(2)
|
||||
wgt.Add(1)
|
||||
go func() {
|
||||
defer wgt.Done()
|
||||
ipInfo, securityInfo, err = network.NetworkCheck("both", securtyCheckStatus, language)
|
||||
@@ -141,12 +108,18 @@ func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (stri
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
}()
|
||||
wgt.Add(1)
|
||||
go func() {
|
||||
defer wgt.Done()
|
||||
systemInfo = system.CheckSystemInfo(language)
|
||||
}()
|
||||
wgt.Wait()
|
||||
ipv6Info, errv6 := ipv6.GetIPv6Mask(language)
|
||||
basicInfo := systemInfo + ipInfo
|
||||
if errv6 == nil && ipv6Info != "" {
|
||||
basicInfo += ipv6Info
|
||||
basicInfo += "\n"
|
||||
}
|
||||
if strings.Contains(ipInfo, "IPV4") && strings.Contains(ipInfo, "IPV6") {
|
||||
uts.IPV4 = true
|
||||
uts.IPV6 = true
|
||||
@@ -239,95 +212,127 @@ func PrintAndCapture(f func(), tempOutput, output string) string {
|
||||
|
||||
// UploadText 上传文本内容到指定URL
|
||||
func UploadText(absPath string) (string, string, error) {
|
||||
primaryURL := "http://hpaste.spiritlhl.net/api/upload"
|
||||
backupURL := "https://paste.spiritlhl.net/api/upload"
|
||||
primaryURL := "http://hpaste.spiritlhl.net/api/UL/upload"
|
||||
backupURL := "https://paste.spiritlhl.net/api/UL/upload"
|
||||
token := network.SecurityUploadToken
|
||||
client := req.DefaultClient()
|
||||
client.SetTimeout(6 * time.Second)
|
||||
client := req.C().SetTimeout(6 * time.Second)
|
||||
client.R().
|
||||
SetRetryCount(2).
|
||||
SetRetryBackoffInterval(1*time.Second, 5*time.Second).
|
||||
SetRetryFixedInterval(2 * time.Second)
|
||||
// 打开文件
|
||||
file, err := os.Open(absPath)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
return "", "", fmt.Errorf("failed to open file: %w", err)
|
||||
}
|
||||
defer file.Close()
|
||||
// 获取文件信息并检查大小
|
||||
fileInfo, err := file.Stat()
|
||||
if err != nil {
|
||||
return "", "", fmt.Errorf("failed to get file info: %w", err)
|
||||
}
|
||||
if fileInfo.Size() > 25*1024 { // 25KB
|
||||
return "", "", fmt.Errorf("file size exceeds 25KB limit")
|
||||
}
|
||||
// 上传逻辑
|
||||
upload := func(url string) (string, string, error) {
|
||||
file, err := os.Open(absPath)
|
||||
if err != nil {
|
||||
return "", "", fmt.Errorf("failed to re-open file for %s: %w", url, err)
|
||||
}
|
||||
defer file.Close()
|
||||
content, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return "", "", fmt.Errorf("failed to read file content for %s: %w", url, err)
|
||||
}
|
||||
resp, err := client.R().
|
||||
SetHeader("Authorization", token).
|
||||
SetHeader("Format", "RANDOM").
|
||||
SetHeader("Max-Views", "0").
|
||||
SetHeader("UploadText", "true").
|
||||
SetHeader("Content-Type", "multipart/form-data").
|
||||
SetHeader("No-JSON", "true").
|
||||
SetFileReader("file", "goecs.txt", file).
|
||||
SetFileBytes("file", filepath.Base(absPath), content).
|
||||
Post(url)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
return "", "", fmt.Errorf("failed to make request to %s: %w", url, err)
|
||||
}
|
||||
if resp.StatusCode >= 200 && resp.StatusCode <= 299 {
|
||||
return strings.ReplaceAll(resp.String(), "https://paste.spiritlhl.net/", "http://hpaste.spiritlhl.net/"),
|
||||
strings.ReplaceAll(resp.String(), "http://hpaste.spiritlhl.net/", "https://paste.spiritlhl.net/"), nil
|
||||
} else {
|
||||
return "", "", fmt.Errorf("upload failed with status code: %d", resp.StatusCode)
|
||||
if resp.StatusCode >= 200 && resp.StatusCode <= 299 && resp.String() != "" {
|
||||
fileID := strings.TrimSpace(resp.String())
|
||||
if strings.Contains(fileID, "show") {
|
||||
fileID = fileID[strings.LastIndex(fileID, "/")+1:]
|
||||
}
|
||||
httpURL := fmt.Sprintf("http://hpaste.spiritlhl.net/#/show/%s", fileID)
|
||||
httpsURL := fmt.Sprintf("https://paste.spiritlhl.net/#/show/%s", fileID)
|
||||
return httpURL, httpsURL, nil
|
||||
}
|
||||
return "", "", fmt.Errorf("upload failed for %s with status code: %d", url, resp.StatusCode)
|
||||
}
|
||||
http_url, https_url, err := upload(primaryURL)
|
||||
// 尝试上传到主URL
|
||||
httpURL, httpsURL, err := upload(primaryURL)
|
||||
if err == nil {
|
||||
return http_url, https_url, nil
|
||||
return httpURL, httpsURL, nil
|
||||
}
|
||||
http_url, https_url, err = upload(backupURL)
|
||||
// 尝试上传到备份URL
|
||||
httpURL, httpsURL, err = upload(backupURL)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
return "", "", fmt.Errorf("failed to upload to both primary and backup URLs: %w", err)
|
||||
}
|
||||
return http_url, https_url, nil
|
||||
return httpURL, httpsURL, nil
|
||||
}
|
||||
|
||||
// ProcessAndUpload 创建结果文件并上传文件
|
||||
func ProcessAndUpload(output string, filePath string, enableUplaod bool) {
|
||||
func ProcessAndUpload(output string, filePath string, enableUplaod bool) (string, string) {
|
||||
// 使用 defer 来处理 panic
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Printf("处理上传时发生错误: %v\n", r)
|
||||
}
|
||||
}()
|
||||
// 检查文件是否存在
|
||||
if _, err := os.Stat(filePath); err == nil {
|
||||
// 文件存在,删除文件
|
||||
err = os.Remove(filePath)
|
||||
if err != nil {
|
||||
fmt.Println("Cannot delete file:", err)
|
||||
return
|
||||
fmt.Println("无法删除文件:", err)
|
||||
return "", ""
|
||||
}
|
||||
}
|
||||
// 创建文件
|
||||
file, err := os.Create(filePath)
|
||||
if err != nil {
|
||||
fmt.Println("Cannot create file:", err)
|
||||
return
|
||||
fmt.Println("无法创建文件:", err)
|
||||
return "", ""
|
||||
}
|
||||
defer file.Close()
|
||||
// 匹配 ANSI 转义序列
|
||||
ansiRegex := regexp.MustCompile("\x1B\\[[0-9;]+[a-zA-Z]")
|
||||
// 移除 ANSI 转义序列
|
||||
cleanedOutput := ansiRegex.ReplaceAllString(output, "")
|
||||
// 写入文件
|
||||
_, err = file.WriteString(cleanedOutput)
|
||||
// 使用 bufio.Writer 提高写入效率
|
||||
writer := bufio.NewWriter(file)
|
||||
_, err = writer.WriteString(cleanedOutput)
|
||||
if err != nil {
|
||||
fmt.Println("Cannot write to file:", err)
|
||||
return
|
||||
} else {
|
||||
fmt.Println("Write test result in ", filePath)
|
||||
fmt.Println("无法写入文件:", err)
|
||||
return "", ""
|
||||
}
|
||||
// 确保写入缓冲区的数据都刷新到文件中
|
||||
err = writer.Flush()
|
||||
if err != nil {
|
||||
fmt.Println("无法刷新文件缓冲:", err)
|
||||
return "", ""
|
||||
}
|
||||
fmt.Printf("测试结果已写入 %s\n", filePath)
|
||||
if enableUplaod {
|
||||
// 获取文件的绝对路径
|
||||
absPath, err2 := filepath.Abs(filePath)
|
||||
if err2 != nil {
|
||||
fmt.Println("Failed to get absolute file path:", err2)
|
||||
return
|
||||
absPath, err := filepath.Abs(filePath)
|
||||
if err != nil {
|
||||
fmt.Println("无法获取文件绝对路径:", err)
|
||||
return "", ""
|
||||
}
|
||||
// 上传文件并生成短链接
|
||||
http_url, https_url, err3 := UploadText(absPath)
|
||||
if err3 != nil {
|
||||
fmt.Println("Upload failed, cannot generate short URL.")
|
||||
fmt.Println(err3.Error())
|
||||
return
|
||||
http_url, https_url, err := UploadText(absPath)
|
||||
if err != nil {
|
||||
fmt.Println("上传失败,无法生成链接")
|
||||
fmt.Println(err.Error())
|
||||
return "", ""
|
||||
}
|
||||
fmt.Printf("Upload successful!\nHttp URL: %s\nHttps URL: %s\n", http_url, https_url)
|
||||
return http_url, https_url
|
||||
}
|
||||
return "", ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user