Compare commits

...

74 Commits

Author SHA1 Message Date
spiritlhl
df6d1236cc fix: 暂时注释调freebsd进行编译 2025-07-17 03:12:06 +00:00
spiritlhl
7c64102581 fix: 修复头文件导入 2025-07-17 03:07:18 +00:00
spiritlhl
58cb4f3831 fix: 修复头文件导入 2025-07-17 03:04:13 +00:00
spiritlhl
20bddae048 fix: 更新版本 2025-07-17 02:49:04 +00:00
spiritlhl
3c0590ca8d fix: 删除暂不适配的freebsd-arm 2025-07-17 02:43:28 +00:00
spiritlhl
a752eeeeb0 fix: 修复配置错配 2025-07-17 02:26:32 +00:00
spiritlhl
630a28f2f2 fix: 编译顺序执行避免报错无法溯源 2025-07-17 02:14:19 +00:00
spiritlhl
cfd70e100b fix: 编译顺序执行避免报错无法溯源 2025-07-17 02:02:59 +00:00
spiritlhl
9114f5b97a fix: linux的amd64架构无需额外设置gcc 2025-07-17 01:36:26 +00:00
spiritlhl
8c0fc16384 fix: 升级默认编译容器的版本 2025-07-17 01:25:15 +00:00
spiritlhl
2ded570639 fix: 去除暂不支持的系统 2025-07-16 16:52:34 +00:00
spiritlhl
42f0cb3399 fix: 去除暂不支持的系统 2025-07-16 16:35:48 +00:00
spiritlhl
14adbddeb9 fix: 添加错误追踪 2025-07-16 16:19:21 +00:00
spiritlhl
27fd06b007 fix: 无法去除默认验证 2025-07-16 16:08:41 +00:00
spiritlhl
88db8df827 fix: 重构编译逻辑避免全部任务失败 2025-07-16 16:03:46 +00:00
spiritlhl
ec728796f4 fix: 修复缺失的前置依赖 2025-07-16 15:44:40 +00:00
spiritlhl
147e8c1113 fix: 修复缺失的前置依赖 2025-07-16 15:27:55 +00:00
spiritlhl
b9b1d5ca76 fix: 删除goreleaser的部分无效参数 2025-07-16 15:00:35 +00:00
spiritlhl
1500c8342e fix: 更新goreleaser的yaml版本 2025-07-16 14:54:49 +00:00
spiritlhl
e523ca3c84 fix: 修复cputest和memorytest的C重构,尽量使用CGO编译嵌入依赖,拓展编译支持的系统和架构,增加容错机制 2025-07-16 14:47:11 +00:00
github-actions[bot]
42943370bb chore: update ECS_VERSION to 0.1.55 in goecs.sh 2025-07-15 12:48:33 +00:00
spiritlhl
7339f0336c fix: 修复传递过程中非指针传递导致的写入丢失 2025-07-15 12:44:24 +00:00
github-actions[bot]
54bbe16563 chore: update ECS_VERSION to 0.1.54 in goecs.sh 2025-07-15 12:27:50 +00:00
spiritlhl
2a66452f40 fix: 更新版本号 2025-07-15 12:23:20 +00:00
spiritlhl
aab6bf197d fix: 修复测试项目自动切换了测试方式在测试项头部同步更改说明 2025-07-15 12:22:51 +00:00
github-actions[bot]
9206088bad chore: update ECS_VERSION to 0.1.53 in goecs.sh 2025-07-15 11:55:49 +00:00
spiritlhl
48e150036d fix: 在CPU测试自动切换测试类型的时候头部测试方式自动替换测试说明 2025-07-15 11:51:30 +00:00
spiritlhl
486b767a25 fix: 修复文本赋值顺序错位 2025-07-15 19:29:13 +08:00
spiritlhl
5a2e68bf92 fix: 修复文本赋值顺序错位 2025-07-15 19:27:11 +08:00
github-actions[bot]
97d05f4b57 chore: update ECS_VERSION to 0.1.52 in goecs.sh 2025-07-15 11:12:52 +00:00
spiritlhl
4f08a33de8 fix: 离线环境下不再尝试结果分享链接的生成 2025-07-15 10:58:40 +00:00
spiritlhl
ff8712a743 fix: 修复中途退出文本内容未正常保存并生成分享链接的问题 2025-07-15 10:51:55 +00:00
spiritlhl
abd38554b6 fix: 更新basics模块支持多盘智能检测同时显示boot和mount路径 2025-07-15 10:29:41 +00:00
github-actions[bot]
918a9b3a46 chore: update ECS_VERSION to 0.1.51 in goecs.sh 2025-07-10 08:15:00 +00:00
spiritlhl
d9dac50487 fix: 更新basics支持多盘检测,更新security数据库来源,增加maxmind数据库获取IP信息 2025-07-10 08:02:54 +00:00
spiritlhl
cd65f04433 fix: 添加测试环境类型说明 2025-07-01 13:36:18 +00:00
github-actions[bot]
8b5193eca1 chore: update ECS_VERSION to 0.1.50 in goecs.sh 2025-07-01 13:14:04 +00:00
spiritlhl
4797ff0b34 fix: 优化pingtest的日志记录 2025-07-01 13:02:39 +00:00
github-actions[bot]
9886cad73e chore: update ECS_VERSION to 0.1.49 in goecs.sh 2025-07-01 12:18:04 +00:00
spiritlhl
ca0470f01a fix: 修复pingtest和speedtest在无root权限环境下的鉴权问题 2025-07-01 12:06:59 +00:00
github-actions[bot]
5a6d6845c1 chore: update ECS_VERSION to 0.1.48 in goecs.sh 2025-07-01 09:57:47 +00:00
spiritlhl
487dd7c1d2 fix: 测试修复无权限下硬盘测试引擎选择的问题 2025-07-01 09:37:56 +00:00
spiritlhl
2dbf97de8c fix: 测试修复无权限下硬盘测试引擎选择的问题 2025-07-01 09:35:56 +00:00
github-actions[bot]
97e7cae2c2 chore: update ECS_VERSION to 0.1.47 in goecs.sh 2025-07-01 08:44:22 +00:00
spiritlhl
d61a1879f5 fix: 修复macos上无权限时的测试路径选择 2025-07-01 08:33:30 +00:00
github-actions[bot]
29dd4ac57e chore: update ECS_VERSION to 0.1.46 in goecs.sh 2025-07-01 03:30:58 +00:00
spiritlhl
dc3eff1fe3 fix: 更新版本 2025-07-01 11:20:24 +08:00
spiritlhl
0a0f2199bc fix: 修复内存和硬盘测试的权限校验问题 2025-07-01 03:19:07 +00:00
github-actions[bot]
91004d87f5 chore: update ECS_VERSION to 0.1.45 in goecs.sh 2025-06-30 14:30:04 +00:00
spiritlhl
8f41c37203 fix: 修复windows下的Admin权限检测 2025-06-30 14:18:42 +00:00
github-actions[bot]
12b1ae0702 chore: update ECS_VERSION to 0.1.44 in goecs.sh 2025-06-30 13:43:29 +00:00
spiritlhl
653cd75a97 fix: 修复内存测试在无root环境下测试的权限问题,添加无权限的内存测试方法mbw 2025-06-30 13:32:20 +00:00
github-actions[bot]
ea36e88c9f chore: update ECS_VERSION to 0.1.43 in goecs.sh 2025-06-29 08:49:03 +00:00
spiritlhl
c81ebb3c7a fix: 异步函数传值需要指针传递,值传递可能会出现同步问题 2025-06-29 08:45:15 +00:00
github-actions[bot]
7896b3ead5 chore: update ECS_VERSION to 0.1.42 in goecs.sh 2025-06-29 08:33:10 +00:00
spiritlhl
eb98a7b857 fix: 更加严格的启动条件,同时避免死锁等待 2025-06-29 08:29:24 +00:00
github-actions[bot]
d4d86229de chore: update ECS_VERSION to 0.1.41 in goecs.sh 2025-06-29 07:59:30 +00:00
spiritlhl
651a183382 fix: 修复版本号 2025-06-29 15:55:56 +08:00
spiritlhl
afc313a2a8 fix: 同步流媒体检测的判断逻辑 2025-06-29 15:44:16 +08:00
github-actions[bot]
39ac8d198d chore: update ECS_VERSION to 0.1.40 in goecs.sh 2025-06-29 07:36:33 +00:00
spiritlhl
a70dc2bab1 fix: 更新版本号至 v0.1.40 2025-06-29 07:26:48 +00:00
spiritlhl
5041a16a9a fix: 修复同步机制问题,保护最终输出不出现数据竞争 2025-06-29 07:22:27 +00:00
github-actions[bot]
21deb3587e chore: update ECS_VERSION to 0.1.39 in goecs.sh 2025-06-29 07:07:10 +00:00
spiritlhl
3bac30edc2 fix: 修复协程部分等待位置错误的问题 2025-06-29 07:02:10 +00:00
github-actions[bot]
9ef2ec4a9e chore: update ECS_VERSION to 0.1.38 in goecs.sh 2025-06-29 06:39:24 +00:00
spiritlhl
ac33e00e0a fix: 拆分main函数,分函数方便后续维护,添加前置检测自动切换离线模式 2025-06-29 06:27:59 +00:00
spiritlhl
7a439f7095 fix: 优化编译文件的大小 2025-06-29 10:55:39 +08:00
spiritlhl
e3bfa65f66 Merge pull request #12 from fossabot/add-license-scan-badge
Add license scan report and status
2025-06-29 09:36:58 +08:00
fossabot
74e33a212c Add license scan report and status
Signed off by: fossabot <badges@fossa.com>
2025-06-28 21:22:21 -04:00
spiritlhl
bba8595033 fix: 统一致谢图标大小 2025-06-29 01:00:05 +00:00
spiritlhl
530181be87 feat: 添加zmto对本开源项目的支持 2025-06-29 00:57:46 +00:00
github-actions[bot]
7deb986209 chore: update ECS_VERSION to 0.1.37 in goecs.sh 2025-06-28 14:02:18 +00:00
spiritlhl
ea8e5efbd3 fix: 修复部分失效的流媒体检测,基础信息检测适配MACOS系统 2025-06-28 13:50:54 +00:00
spiritlhl
db88ee8479 fix: 添加sysbench的天梯图: https://sysbench.spiritlhl.net/ 2025-06-15 12:44:45 +00:00
21 changed files with 1598 additions and 603 deletions

121
.github/workflows/build.yaml vendored Normal file
View File

@@ -0,0 +1,121 @@
name: Goreleaser
on:
workflow_dispatch:
tags:
- "v*.*.*"
jobs:
goreleaser:
runs-on: ubuntu-latest
container:
# 1.20 是 Windows 7/8 Server 2008/2012 最后一个支持版本
image: goreleaser/goreleaser-cross:v1.20
steps:
- name: Configure git safe directory
run: |
git config --global --add safe.directory /__w/ecs/ecs
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23.4
- 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: Install missing cross-compilation tools
run: |
echo "Installing missing cross-compilation tools..."
apt-get update
apt-get install -y gcc-multilib g++-multilib
dpkg --add-architecture i386
apt-get update
apt-get install -y \
linux-libc-dev \
gcc-aarch64-linux-gnu \
gcc-riscv64-linux-gnu \
gcc-mips64-linux-gnuabi64 \
gcc-mips64el-linux-gnuabi64 \
gcc-powerpc64le-linux-gnu \
gcc-mingw-w64-x86-64 \
gcc-mingw-w64-i686 \
libc6-dev-i386 \
|| echo "Some packages may already be installed"
- name: Verify cross-compilation tools
run: |
echo "Checking available cross-compilation tools..."
echo "=== GCC compilers ==="
which gcc || echo "gcc not found"
which x86_64-linux-gnu-gcc || echo "x86_64-linux-gnu-gcc not found"
which aarch64-linux-gnu-gcc || echo "aarch64-linux-gnu-gcc not found"
which riscv64-linux-gnu-gcc || echo "riscv64-linux-gnu-gcc not found"
which mips64-linux-gnuabi64-gcc || echo "mips64-linux-gnuabi64-gcc not found"
which mips64el-linux-gnuabi64-gcc || echo "mips64el-linux-gnuabi64-gcc not found"
which powerpc64le-linux-gnu-gcc || echo "powerpc64le-linux-gnu-gcc not found"
echo "=== MinGW compilers ==="
which x86_64-w64-mingw32-gcc || echo "x86_64-w64-mingw32-gcc not found"
which i686-w64-mingw32-gcc || echo "i686-w64-mingw32-gcc not found"
echo "=== OSXCross compilers ==="
which o64-clang || echo "o64-clang not found"
which oa64-clang || echo "oa64-clang not found"
which o64-clang++ || echo "o64-clang++ not found"
which oa64-clang++ || echo "oa64-clang++ not found"
echo "=== Clang compilers ==="
which clang || echo "clang not found"
echo "=== Available gcc binaries ==="
ls -la /usr/bin/*gcc* | head -20
echo "=== Available clang binaries ==="
ls -la /usr/bin/*clang* | head -10
echo "=== OSXCross directory ==="
ls -la /usr/osxcross/bin/ 2>/dev/null || echo "OSXCross not found in /usr/osxcross/bin/"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --parallelism 1 --verbose
env:
GITHUB_TOKEN: ${{ secrets.GHT }}
GOPRIVATE: github.com/oneclickvirt/security
- name: Update goecs.sh with new version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
else
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.1.37")
fi
echo "Using version: $VERSION"
FILE="goecs.sh"
BRANCH="master"
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --unset url."git@github.com:".insteadOf || true
git fetch origin $BRANCH
git checkout $BRANCH
if [ ! -f "$FILE" ]; then
echo "Error: $FILE not found"
exit 1
fi
sed -i "s/\(_yellow \"Unable to get version info, using default version \).*\(\".*\)/\1$VERSION\2/" "$FILE"
sed -i "s/\(ECS_VERSION=\"\).*\(\"\)/\1$VERSION\2/" "$FILE"
if git diff --quiet "$FILE"; then
echo "No changes detected in $FILE"
exit 0
fi
git add "$FILE"
git commit -m "chore: update ECS_VERSION to $VERSION in goecs.sh"
git push origin $BRANCH
env:
GITHUB_TOKEN: ${{ secrets.GHT }}

View File

@@ -1,73 +0,0 @@
name: goreleaser
on:
workflow_dispatch:
tags:
- "v*.*.*"
jobs:
goreleaser:
runs-on: ubuntu-latest
container:
# 1.20 是 Windows 7/8 Server 2008/2012 最后一个支持版本
image: goreleaser/goreleaser-cross:v1.20
steps:
- run: |
git config --global --add safe.directory /__w/ecs/ecs
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23.4
- 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: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release
env:
GITHUB_TOKEN: ${{ secrets.GHT }}
GOPRIVATE: github.com/oneclickvirt/security
- name: Update goecs.sh with new version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
else
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.1.36")
fi
echo "Using version: $VERSION"
FILE="goecs.sh"
BRANCH="master"
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --unset url."git@github.com:".insteadOf || true
git fetch origin $BRANCH
git checkout $BRANCH
if [ ! -f "$FILE" ]; then
echo "Error: $FILE not found"
exit 1
fi
sed -i "s/\(_yellow \"Unable to get version info, using default version \).*\(\".*\)/\1$VERSION\2/" "$FILE"
sed -i "s/\(ECS_VERSION=\"\).*\(\"\)/\1$VERSION\2/" "$FILE"
if git diff --quiet "$FILE"; then
echo "No changes detected in $FILE"
exit 0
fi
git add "$FILE"
git commit -m "chore: update ECS_VERSION to $VERSION in goecs.sh"
git push origin $BRANCH
env:
GITHUB_TOKEN: ${{ secrets.GHT }}

View File

@@ -1,70 +1,517 @@
version: 2
project_name: goecs
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy -v
builds:
- id: universal
# Linux AMD64 with CGO
- id: linux-amd64-cgo
env:
- CGO_ENABLED=0
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
- CGO_CFLAGS=-O2 -static -fno-stack-protector -Wl,--gc-sections
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- linux
- windows
- freebsd
goarch:
- arm
- arm64
- 386
- amd64
- mips
- mipsle
- s390x
- riscv64
gomips:
- softfloat
ignore:
- goos: windows
goarch: arm
main: ./
binary: goecs
- id: darwin-amd64
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/amd64 (CGO)"
post:
- echo "Successfully built linux/amd64 (CGO)"
- echo "---"
# Linux 386 with CGO
- id: linux-386-cgo
env:
- CGO_ENABLED=1
- CC=gcc -m32
- CGO_CFLAGS=-m32 -static -O1 -march=i686 -mtune=generic -fno-stack-protector
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- linux
goarch:
- 386
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/386 (CGO)"
post:
- echo "Successfully built linux/386 (CGO)"
- echo "---"
# Linux ARM64 with CGO
- id: linux-arm64-cgo
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-gcc
- CGO_CFLAGS=-static -O1 -fno-stack-protector
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- linux
goarch:
- arm64
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/arm64 (CGO)"
post:
- echo "Successfully built linux/arm64 (CGO)"
- echo "---"
# Windows AMD64 with CGO
- id: windows-amd64-cgo
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CGO_CFLAGS=-O2 -static -static-libgcc -static-libstdc++
- CGO_LDFLAGS=-static -static-libgcc -static-libstdc++
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- windows
goarch:
- amd64
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for windows/amd64 (CGO)"
post:
- echo "Successfully built windows/amd64 (CGO)"
- echo "---"
# Windows 386 with CGO
- id: windows-386-cgo
env:
- CGO_ENABLED=1
- CC=gcc-mingw-w64-i686
- CGO_CFLAGS=-O2 -static -static-libgcc -static-libstdc++
- CGO_LDFLAGS=-static -static-libgcc -static-libstdc++
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- windows
goarch:
- 386
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for windows/386 (CGO)"
post:
- echo "Successfully built windows/386 (CGO)"
- echo "---"
# Darwin AMD64 with CGO
- id: darwin-amd64-cgo
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
- CGO_CFLAGS=-O2 -arch x86_64 -mmacosx-version-min=10.12
- CGO_LDFLAGS=-arch x86_64 -mmacosx-version-min=10.12
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
flags:
- -trimpath
goos:
- darwin
goarch:
- amd64
main: ./
binary: goecs
- id: darwin-arm64
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for darwin/amd64 (CGO)"
- echo "Checking osxcross tools..."
- which o64-clang || echo "o64-clang not found"
- which o64-clang++ || echo "o64-clang++ not found"
post:
- echo "Successfully built darwin/amd64 (CGO)"
- echo "---"
# Darwin ARM64 with CGO
- id: darwin-arm64-cgo
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
- CGO_CFLAGS=-O2 -arch arm64 -mmacosx-version-min=11.0
- CGO_LDFLAGS=-arch arm64 -mmacosx-version-min=11.0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
flags:
- -trimpath
goos:
- darwin
goarch:
- arm64
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for darwin/arm64 (CGO)"
- echo "Checking osxcross tools..."
- which oa64-clang || echo "oa64-clang not found"
- which oa64-clang++ || echo "oa64-clang++ not found"
post:
- echo "Successfully built darwin/arm64 (CGO)"
- echo "---"
# Linux RISC-V 64 with CGO
- id: linux-riscv64-cgo
env:
- CGO_ENABLED=1
- CC=riscv64-linux-gnu-gcc
- CGO_CFLAGS=-static -O1 -fno-stack-protector
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- linux
goarch:
- riscv64
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/riscv64 (CGO)"
post:
- echo "Successfully built linux/riscv64 (CGO)"
- echo "---"
# Linux MIPS64 with CGO
- id: linux-mips64-cgo
env:
- CGO_ENABLED=1
- CC=mips64-linux-gnuabi64-gcc
- CGO_CFLAGS=-static -O1 -fno-stack-protector
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- linux
goarch:
- mips64
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/mips64 (CGO)"
post:
- echo "Successfully built linux/mips64 (CGO)"
- echo "---"
# Linux MIPS64LE with CGO
- id: linux-mips64le-cgo
env:
- CGO_ENABLED=1
- CC=mips64el-linux-gnuabi64-gcc
- CGO_CFLAGS=-static -O1 -fno-stack-protector
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- linux
goarch:
- mips64le
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/mips64le (CGO)"
post:
- echo "Successfully built linux/mips64le (CGO)"
- echo "---"
# Linux PPC64LE with CGO
- id: linux-ppc64le-cgo
env:
- CGO_ENABLED=1
- CC=powerpc64le-linux-gnu-gcc
- CGO_CFLAGS=-static -O1 -fno-stack-protector
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- linux
goarch:
- ppc64le
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/ppc64le (CGO)"
post:
- echo "Successfully built linux/ppc64le (CGO)"
- echo "---"
# Linux ARM (no CGO)
- id: linux-arm-nocgo
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
flags:
- -trimpath
goos:
- linux
goarch:
- arm
goarm:
- "5"
- "6"
- "7"
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/arm (no CGO)"
post:
- echo "Successfully built linux/arm (no CGO)"
- echo "---"
# Linux S390X (no CGO)
- id: linux-s390x-nocgo
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
flags:
- -trimpath
goos:
- linux
goarch:
- s390x
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/s390x (no CGO)"
post:
- echo "Successfully built linux/s390x (no CGO)"
- echo "---"
# Linux MIPS (no CGO)
- id: linux-mips-nocgo
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
flags:
- -trimpath
goos:
- linux
goarch:
- mips
gomips:
- softfloat
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/mips (no CGO)"
post:
- echo "Successfully built linux/mips (no CGO)"
- echo "---"
# Linux MIPSLE (no CGO)
- id: linux-mipsle-nocgo
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
flags:
- -trimpath
goos:
- linux
goarch:
- mipsle
gomips:
- softfloat
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/mipsle (no CGO)"
post:
- echo "Successfully built linux/mipsle (no CGO)"
- echo "---"
# Linux PPC64 (no CGO)
- id: linux-ppc64-nocgo
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
flags:
- -trimpath
goos:
- linux
goarch:
- ppc64
main: ./
binary: goecs
no_unique_dist_dir: true
hooks:
pre:
- echo "Starting build for linux/ppc64 (no CGO)"
post:
- echo "Successfully built linux/ppc64 (no CGO)"
- echo "---"
# # FreeBSD AMD64 (no CGO)
# - id: freebsd-amd64-nocgo
# env:
# - CGO_ENABLED=0
# ldflags:
# - -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
# flags:
# - -trimpath
# goos:
# - freebsd
# goarch:
# - amd64
# main: ./
# binary: goecs
# no_unique_dist_dir: true
# hooks:
# pre:
# - echo "Starting build for freebsd/amd64 (no CGO)"
# post:
# - echo "Successfully built freebsd/amd64 (no CGO)"
# - echo "---"
# # FreeBSD ARM64 (no CGO)
# - id: freebsd-arm64-nocgo
# env:
# - CGO_ENABLED=0
# ldflags:
# - -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
# flags:
# - -trimpath
# goos:
# - freebsd
# goarch:
# - arm64
# main: ./
# binary: goecs
# no_unique_dist_dir: true
# hooks:
# pre:
# - echo "Starting build for freebsd/arm64 (no CGO)"
# post:
# - echo "Successfully built freebsd/arm64 (no CGO)"
# - echo "---"
universal_binaries:
- name_template: "goecs"
replace: false
ids:
- darwin-amd64-cgo
- darwin-arm64-cgo
checksum:
name_template: "checksums.txt"
algorithm: sha256
disable: false
ids:
- linux-amd64-cgo
- linux-386-cgo
- linux-arm64-cgo
- linux-riscv64-cgo
- linux-mips64-cgo
- linux-mips64le-cgo
- linux-ppc64le-cgo
- windows-amd64-cgo
- windows-386-cgo
- darwin-amd64-cgo
- darwin-arm64-cgo
- linux-arm-nocgo
- linux-s390x-nocgo
- linux-mips-nocgo
- linux-mipsle-nocgo
- linux-ppc64-nocgo
# - freebsd-amd64-nocgo
# - freebsd-arm64-nocgo
extra_files:
- glob: "./goecs.sh"
snapshot:
name_template: "goecs"
archives:
- name_template: "goecs_{{ .Os }}_{{ .Arch }}"
- id: default
name_template: "goecs_{{ .Os }}_{{ .Arch }}"
format: zip
files:
- none*
allow_different_binary_count: true
builds:
- linux-amd64-cgo
- linux-386-cgo
- linux-arm64-cgo
- linux-riscv64-cgo
- linux-mips64-cgo
- linux-mips64le-cgo
- linux-ppc64le-cgo
- windows-amd64-cgo
- windows-386-cgo
- darwin-amd64-cgo
- darwin-arm64-cgo
- linux-arm-nocgo
- linux-s390x-nocgo
- linux-mips-nocgo
- linux-mipsle-nocgo
- linux-ppc64-nocgo
# - freebsd-amd64-nocgo
# - freebsd-arm64-nocgo
changelog:
sort: asc
filters:

View File

@@ -1,6 +1,8 @@
# ECS
[![release](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml/badge.svg)](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml)
[![release](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml/badge.svg)](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs?ref=badge_shield)
[![Hits](https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net)
@@ -28,10 +30,10 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
| 编译支持的架构 | 测试支持的架构 | 编译支持的系统 | 测试支持的系统 |
|---------------------------|-----------|---------|-----------|
| amd64 | amd64 | Linux | Linux |
| arm | arm | Windows | Windows |
| arm64 | arm64 | FreeBSD | FreeBSD |
| 386 | 386 | OpenBSD | |
| mips | | MacOS | |
| arm | | Windows | Windows |
| arm64 | arm64 | FreeBSD | |
| 386 | | OpenBSD | |
| mips | | MacOS | MacOS |
| mipsle | | | |
| s390x | s390x | | |
| riscv64 | | | |
@@ -42,7 +44,6 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
### **待支持的系统**
| 系统 | 说明 |
|-----|---------------------------|
| MacOS | 存在硬件测试 BUG 未修复,存在环境依赖未修复 |
| Android(arm64) | 存在权限问题未修复非安卓系统的ARM架构无问题 |
---
@@ -61,6 +62,7 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
- 三网路由测试:基于 [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)
- 支持root或admin环境下测试也支持非root或非admin环境下测试半支持离线环境下进行测试未支持无DNS环境下进行测试
**本项目初次使用建议查看说明:[跳转](https://github.com/oneclickvirt/ecs/blob/master/README_NEW_USER.md)**
@@ -137,19 +139,19 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
export noninteractive=true && ./goecs.sh env
```
3. **安装 `goecs`**
3. **安装 `goecs` 本体(仅下载二进制文件无依赖安装)**
```bash
./goecs.sh install
```
4. **升级 `goecs`**
4. **升级 `goecs` 本体**
```bash
./goecs.sh upgrade
```
5. **卸载 `goecs`**
5. **卸载 `goecs` 本体**
```bash
./goecs.sh uninstall
@@ -341,6 +343,7 @@ GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
| 测试稳定性 | 核心测试组件10年以上未变 | 每个大版本更新测试项,分数不同版本间难以对比(每个版本对标当前最好的CPU) |
| 测试内容 | 仅测试计算性能 | 覆盖多种性能测试,分数加权计算,但部分测试实际不常用 |
| 适用场景 | 适合快速测试,仅测试计算性能 | 适合综合全面的测试 |
| 排行榜 | [sysbench.spiritlhl.net](https://sysbench.spiritlhl.net/) | [browser.geekbench.com](https://browser.geekbench.com/) |
且```goecs```测试使用何种CPU测试方式可使用参数指定默认只是为了更多用户快速测试的需求
@@ -366,12 +369,12 @@ GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
## 致谢
感谢 [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [ip.sb](https://ip.sb) [cheervision.co](https://cheervision.co) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [virustotal.com](https://www.virustotal.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) 等网站提供的API进行检测感谢互联网各网站提供的查询资源
感谢 [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [maxmind.com](https://www.maxmind.com/en/home) [cloudflare.com](https://www.cloudflare.com/) [ip.sb](https://ip.sb) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) 等网站提供的API进行检测感谢互联网各网站提供的查询资源
感谢
<a href="https://h501.io/?from=69" target="_blank">
<img src="https://github.com/spiritLHLS/ecs/assets/103393591/dfd47230-2747-4112-be69-b5636b34f07f" alt="h501">
<img src="https://github.com/spiritLHLS/ecs/assets/103393591/dfd47230-2747-4112-be69-b5636b34f07f" alt="h501" style="height: 50px;">
</a>
提供的免费托管支持本开源项目的共享测试结果存储
@@ -379,13 +382,20 @@ GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
同时感谢以下平台提供编辑和测试支持
<a href="https://www.jetbrains.com/go/" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/GoLand.png" alt="goland">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/GoLand.png" alt="goland" style="height: 50px;">
</a>
<a href="https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/" target="_blank">
<img src="https://linuxone.cloud.marist.edu/oss/resources/images/linuxonelogo03.png" alt="ibm">
<img src="https://linuxone.cloud.marist.edu/oss/resources/images/linuxonelogo03.png" alt="ibm" style="height: 50px;">
</a>
<a href="https://console.zmto.com/?affid=1524" target="_blank">
<img src="https://console.zmto.com/templates/2019/dist/images/logo_dark.svg" alt="zmto" style="height: 50px;">
</a>
## Stargazers over time
[![Stargazers over time](https://starchart.cc/oneclickvirt/ecs.svg?variant=adaptive)](https://www.spiritlhl.net)
[![Stargazers over time](https://starchart.cc/oneclickvirt/ecs.svg?variant=adaptive)](https://www.spiritlhl.net)
## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs?ref=badge_large)

View File

@@ -28,10 +28,10 @@ Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https:
| Supported for Compilation | Tested on | Supported OS for Compilation | Tested OS |
|---------------------------|-----------|------------------------------|-----------|
| amd64 | amd64 | Linux | Linux |
| arm | arm | Windows | Windows |
| arm64 | arm64 | FreeBSD | FreeBSD |
| 386 | 386 | OpenBSD | |
| mips | | MacOS | |
| arm | | Windows | Windows |
| arm64 | arm64 | FreeBSD | |
| 386 | | OpenBSD | |
| mips | | MacOS(darwin) | MacOS |
| mipsle | | | |
| s390x | s390x | | |
| riscv64 | | | |
@@ -41,7 +41,6 @@ Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https:
### **Systems Pending Support**
| OS | Notes |
|--------|-------------------------------------------------------------------------------------------------|
| MacOS | Hardware testing bugs and environment dependencies unresolved |
| Android(arm64) | Permission issues that are not fixed, no problems with ARM architecture for non-Android systems |
---
@@ -59,6 +58,7 @@ Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https:
- 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)
- Support root or admin environment testing, also support non-root or non-admin environment testing, semi-support offline environment for testing, not support no DNS environment for testing
**For first-time users of this project, it is recommended to check the instructions: [Jump to](https://github.com/oneclickvirt/ecs/blob/master/README_NEW_USER.md)**
@@ -363,12 +363,12 @@ Note that `goecs` allows you to specify CPU test method via parameters. The defa
## Thanks
Thank [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [ip.sb](https://ip.sb) [cheervision.co](https://cheervision.co) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [virustotal.com](https://www.virustotal.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) and others for providing APIs for testing, and thanks to various websites on the Internet for providing query resources.
Thank [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [maxmind.com](https://www.maxmind.com/en/home) [cloudflare.com](https://www.cloudflare.com/) [ip.sb](https://ip.sb) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) and others for providing APIs for testing, and thanks to various websites on the Internet for providing query resources.
Thank
<a href="https://h501.io/?from=69" target="_blank">
<img src="https://github.com/spiritLHLS/ecs/assets/103393591/dfd47230-2747-4112-be69-b5636b34f07f" alt="h501">
<img src="https://github.com/spiritLHLS/ecs/assets/103393591/dfd47230-2747-4112-be69-b5636b34f07f" alt="h501" style="height: 50px;">
</a>
provided free hosting support for this open source project's shared test results storage
@@ -376,11 +376,15 @@ provided free hosting support for this open source project's shared test results
Thanks also to the following platforms for editorial and testing support
<a href="https://www.jetbrains.com/go/" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/GoLand.png" alt="goland">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/GoLand.png" alt="goland" style="height: 50px;">
</a>
<a href="https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/" target="_blank">
<img src="https://linuxone.cloud.marist.edu/oss/resources/images/linuxonelogo03.png" alt="ibm">
<img src="https://linuxone.cloud.marist.edu/oss/resources/images/linuxonelogo03.png" alt="ibm" style="height: 50px;">
</a>
<a href="https://console.zmto.com/?affid=1524" target="_blank">
<img src="https://console.zmto.com/templates/2019/dist/images/logo_dark.svg" alt="zmto" style="height: 50px;">
</a>
## Stargazers over time

View File

@@ -110,6 +110,8 @@ AMD的7950x单核满血性能得分在6500左右AMD的5950x单核满血性能
有时候多核得分和单核得分一样证明商家在限制程序并发使用CPU典型例子腾讯云。
```Sysbench```的基准可见 [CPU Performance Ladder For Sysbench](https://sysbench.spiritlhl.net/) 天梯图具体得分不分测试的sysbench的版本。
```GeekBench```的基准可见 [官方网站](https://browser.geekbench.com/processor-benchmarks/) 天梯图,具体得分每个```GeekBench```版本都不一样,注意使用时测试的```GeekBench```版本是什么。
多说一句,```GeekBench```测的很多内容,实际在服务器使用过程中根本用不到,测试仅供参考。当然```Sysbench```非常不全面但它基于最基础的计算性能可以大致比较CPU的性能。
@@ -248,9 +250,9 @@ Load: Displays system load.
Virtualization Architecture: Shows what virtualization architecture the host machine uses. Generally speaking, the recommended order is `Dedicated > KVM > Xen` virtualization. Other virtualization will have performance losses, leading to shared/degraded performance during use. However, this is not definitive. Only dedicated servers have completely independent resource usage; other virtualization methods basically all have resource sharing, depending on whether the host machine seller has a conscience. The specific performance merits still depend on the specialized tests that follow.
NAT Type: Displays NAT type. Specifically recommended in order: `Full Cone > Restricted Cone > Port Restricted Cone > Symmetric`. When not detectable, it will show `Inconclusive`. Generally speaking, if you're not using it for special purposes (related to special proxy and real-time communication needs), you don't need to pay attention to this metric.
NAT Type: Displays NAT type. Specifically recommended in order: ```Full Cone > Restricted Cone > Port Restricted Cone > Symmetric```. When not detectable, it will show ```Inconclusive```. Generally speaking, if you're not using it for special purposes (related to special proxy and real-time communication needs), you don't need to pay attention to this metric.
TCP Acceleration Method: Generally this is the `cubic/bbr` congestion control protocol. Generally speaking, using bbr for proxy servers can improve network speed; for ordinary purposes, you don't need to pay attention to this indicator.
TCP Acceleration Method: Generally this is the ```cubic/bbr``` congestion control protocol. Generally speaking, using bbr for proxy servers can improve network speed; for ordinary purposes, you don't need to pay attention to this indicator.
IPv4/IPv6 ASN: Displays the ASN organization ID and name that the host machine's IP belongs to. The same IDC may have multiple ASNs, and an ASN may have multiple vendors selling servers with different IP segments. The specific upstream and downstream relationships are complex and can be further viewed using bgp.tool.
@@ -271,15 +273,17 @@ Supports selecting `GeekBench` and `Sysbench` for testing through command line p
| Test Content | Only tests computational performance, based on prime number calculation | Covers multiple performance tests, weighted score calculation, but some tests are not commonly used in practice |
| Applicable Scenarios | Suitable for quick testing, only tests computational performance | Suitable for comprehensive testing |
By default, `Sysbench` is used for testing, with the baseline roughly as follows:
By default, ```Sysbench``` is used for testing, with the baseline roughly as follows:
CPU test single-core `Sysbench` scores above 5000 can be considered first tier, 4000 to 5000 points second tier, with roughly one tier per 1000 points.
CPU test single-core ```Sysbench``` scores above 5000 can be considered first tier, 4000 to 5000 points second tier, with roughly one tier per 1000 points.
AMD's 7950x single-core full performance score is around 6500, AMD's 5950x single-core full performance score is around 5700, Intel's ordinary CPUs (E5 series, etc.) are around 1000~800, and single-core CPUs scoring below 500 can be said to have relatively poor performance.
Sometimes multi-core scores are the same as single-core scores, proving that the vendor is limiting program concurrent use of CPU, a typical example being Tencent Cloud.
For `GeekBench` baselines, see the [official website](https://browser.geekbench.com/processor-benchmarks/) ladder chart. Specific scores differ for each `GeekBench` version, so note which `GeekBench` version is being used when testing.
Benchmarks for ```Sysbench``` can be found in the [CPU Performance Ladder For Sysbench](https://sysbench.spiritlhl.net/) ladder chart, with specific scores regardless of the version of sysbench tested.
For ```GeekBench``` baselines, see the [official website](https://browser.geekbench.com/processor-benchmarks/) ladder chart. Specific scores differ for each ```GeekBench``` version, so note which ```GeekBench``` version is being used when testing.
As an additional note, many things tested by `GeekBench` are not actually used in server usage processes, so the test is for reference only. Of course, `Sysbench` is very incomplete, but it can roughly compare CPU performance based on the most basic computational performance.
@@ -424,6 +428,8 @@ AMDの7950xシングルコアのフルパフォーマンススコアは約6500
時々、マルチコアスコアとシングルコアスコアが同じ場合があります。これは販売者がプログラムの並列CPU使用を制限していることを示しています。典型的な例はTencent Cloudです。
Sysbenchのベンチマークは[CPU Performance Ladder For Sysbench](https://sysbench.spiritlhl.net/)のラダーチャートで見ることができる。
```GeekBench```の基準は[公式ウェブサイト](https://browser.geekbench.com/processor-benchmarks/)の階層チャートを参照してください。具体的なスコアは各```GeekBench```バージョンで異なるため、テスト時の```GeekBench```バージョンに注意してください。
補足ですが、```GeekBench```がテストする多くの内容は、サーバー使用過程で実際には必要ないことが多いです。テストは参考程度にしてください。もちろん```Sysbench```は非常に包括的ではありませんが、基本的な計算性能に基づいてCPUのパフォーマンスを大まかに比較できます。

84
back/.goreleaser.old Normal file
View File

@@ -0,0 +1,84 @@
before:
hooks:
- go mod tidy -v
builds:
- id: universal
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0 -extldflags=-static
flags:
- -trimpath
goos:
- linux
- windows
- freebsd
goarch:
- arm
- arm64
- 386
- amd64
- mips
- mipsle
- s390x
- riscv64
gomips:
- softfloat
ignore:
- goos: windows
goarch: arm
main: ./
binary: goecs
- id: darwin-amd64
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
flags:
- -trimpath
goos:
- darwin
goarch:
- amd64
main: ./
binary: goecs
- id: darwin-arm64
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
flags:
- -trimpath
goos:
- darwin
goarch:
- arm64
main: ./
binary: goecs
universal_binaries:
- name_template: "goecs"
replace: false
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "goecs"
archives:
- name_template: "goecs_{{ .Os }}_{{ .Arch }}"
format: zip
files:
- none*
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^chore"
- Merge pull request
- Merge branch
- go mod tidy
- New translations

View File

@@ -1,17 +1,17 @@
package cputest
import (
"fmt"
"github.com/oneclickvirt/cputest/cpu"
"runtime"
"strings"
"github.com/oneclickvirt/cputest/cpu"
)
func CpuTest(language, testMethod, testThread string) {
var res string
func CpuTest(language, testMethod, testThread string) (realTestMethod, res string) {
if runtime.GOOS == "windows" {
if testMethod != "winsat" && testMethod != "" {
res = "Detected host is Windows, using Winsat for testing.\n"
// res = "Detected host is Windows, using Winsat for testing.\n"
realTestMethod = "winsat"
}
res += cpu.WinsatTest(language, testThread)
} else {
@@ -19,21 +19,28 @@ func CpuTest(language, testMethod, testThread string) {
case "sysbench":
res = cpu.SysBenchTest(language, testThread)
if res == "" {
res = "Sysbench test failed, switching to Geekbench for testing.\n"
// res = "Sysbench test failed, switching to Geekbench for testing.\n"
realTestMethod = "geekbench"
res += cpu.GeekBenchTest(language, testThread)
} else {
realTestMethod = "sysbench"
}
case "geekbench":
res = cpu.GeekBenchTest(language, testThread)
if res == "" {
res = "Geekbench test failed, switching to Sysbench for testing.\n"
// res = "Geekbench test failed, switching to Sysbench for testing.\n"
realTestMethod = "sysbench"
res += cpu.SysBenchTest(language, testThread)
} else {
realTestMethod = "geekbench"
}
default:
res = "Invalid test method specified.\n"
realTestMethod = "null"
}
}
if !strings.Contains(res, "\n") && res != "" {
res += "\n"
}
fmt.Print(res)
return
}

View File

@@ -1,9 +1,11 @@
package cputest
import (
"fmt"
"testing"
)
func Test(t *testing.T) {
CpuTest("zh", "sysbench", "1")
_, res := CpuTest("zh", "sysbench", "1")
fmt.Print(res)
}

View File

@@ -1,17 +1,17 @@
package disktest
import (
"fmt"
"github.com/oneclickvirt/disktest/disk"
"runtime"
"strings"
"github.com/oneclickvirt/disktest/disk"
)
func DiskTest(language, testMethod, testPath string, isMultiCheck bool, autoChange bool) {
var res string
func DiskTest(language, testMethod, testPath string, isMultiCheck bool, autoChange bool) (realTestMethod, res string) {
if runtime.GOOS == "windows" {
if testMethod != "winsat" && testMethod != "" {
res = "Detected host is Windows, using Winsat for testing.\n"
// res = "Detected host is Windows, using Winsat for testing.\n"
realTestMethod = "winsat"
}
res = disk.WinsatTest(language, isMultiCheck, testPath)
} else {
@@ -19,23 +19,29 @@ func DiskTest(language, testMethod, testPath string, isMultiCheck bool, autoChan
case "fio":
res = disk.FioTest(language, isMultiCheck, testPath)
if res == "" && autoChange {
res = "Fio test failed, switching to DD for testing.\n"
// res = "Fio test failed, switching to DD for testing.\n"
res += disk.DDTest(language, isMultiCheck, testPath)
realTestMethod = "dd"
} else {
realTestMethod = "fio"
}
case "dd":
res = disk.DDTest(language, isMultiCheck, testPath)
if res == "" && autoChange {
res = "DD test failed, switching to Fio for testing.\n"
// res = "DD test failed, switching to Fio for testing.\n"
res += disk.FioTest(language, isMultiCheck, testPath)
realTestMethod = "fio"
} else {
realTestMethod = "dd"
}
default:
res = "Unsupported test method specified.\n"
// res = "Unsupported test method specified, switching to DD for testing.\n"
res += disk.DDTest(language, isMultiCheck, testPath)
realTestMethod = "dd"
}
}
//fmt.Println("--------------------------------------------------")
if !strings.Contains(res, "\n") && res != "" {
res += "\n"
}
fmt.Printf(res)
//fmt.Println("--------------------------------------------------")
return
}

View File

@@ -1,7 +1,11 @@
package disktest
import "testing"
import (
"fmt"
"testing"
)
func TestDiskIoTest(t *testing.T) {
DiskTest("zh", "sysbench", "", false)
_, res := DiskTest("zh", "sysbench", "", false, false)
fmt.Print(res)
}

29
go.mod
View File

@@ -1,25 +1,23 @@
module github.com/oneclickvirt/ecs
go 1.24.1
toolchain go1.24.2
go 1.24.5
require (
github.com/imroc/req/v3 v3.50.0
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841
github.com/oneclickvirt/UnlockTests v0.0.26-20250329125926
github.com/oneclickvirt/backtrace v0.0.5-20250517095024
github.com/oneclickvirt/basics v0.0.12-20250521031609
github.com/oneclickvirt/cputest v0.0.10-20250404151448
github.com/oneclickvirt/UnlockTests v0.0.27-20250628125053
github.com/oneclickvirt/backtrace v0.0.5-20250629024536
github.com/oneclickvirt/basics v0.0.15-20250714163009
github.com/oneclickvirt/cputest v0.0.11-20250716031513
github.com/oneclickvirt/defaultset v0.0.2-20240624082446
github.com/oneclickvirt/disktest v0.0.8-20250425015826
github.com/oneclickvirt/disktest v0.0.8-20250701092629
github.com/oneclickvirt/gostun v0.0.3-20250329105202
github.com/oneclickvirt/memorytest v0.0.5-20250406063420
github.com/oneclickvirt/memorytest v0.0.8-20250716133749
github.com/oneclickvirt/nt3 v0.0.5-20250416131047
github.com/oneclickvirt/pingtest v0.0.7-20250413051539
github.com/oneclickvirt/pingtest v0.0.8-20250701125637
github.com/oneclickvirt/portchecker v0.0.3-20250329125750
github.com/oneclickvirt/security v0.0.4-20250522031128
github.com/oneclickvirt/speedtest v0.0.9-20250521034111
github.com/oneclickvirt/security v0.0.6-20250715102027
github.com/oneclickvirt/speedtest v0.0.10-20250701123931
)
require (
@@ -61,8 +59,9 @@ require (
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.4.0 // indirect
github.com/oneclickvirt/dd v0.0.1-20250406062523 // indirect
github.com/oneclickvirt/fio v0.0.1-20250406060851 // indirect
github.com/oneclickvirt/dd v0.0.2-20250701085922 // indirect
github.com/oneclickvirt/fio v0.0.2-20250701085933 // indirect
github.com/oneclickvirt/mbw v0.0.1-20250630140849 // 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.4 // indirect
@@ -106,7 +105,7 @@ require (
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sync v0.13.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.31.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/tools v0.29.0 // indirect

50
go.sum
View File

@@ -99,36 +99,38 @@ github.com/nxtrace/NTrace-core v1.4.0 h1:pDN2BqxIYjedDKCDDOFBcDNOBnavGcx+4wbiG65
github.com/nxtrace/NTrace-core v1.4.0/go.mod h1:0AWqbqiIJbpbFG6W48vtJ6pWM8PPF+lQ1fi2371y+zA=
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841 h1:Zef93z9UiZQwRAKnnZYALmpBKvvuVaq34MEsuWwk6nc=
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
github.com/oneclickvirt/UnlockTests v0.0.26-20250329125926 h1:H5//xwVjDR02bQ1hLa3G7LnwccsudPMjBVt7WCx2y/U=
github.com/oneclickvirt/UnlockTests v0.0.26-20250329125926/go.mod h1:yXWIZB6iLS88pEd9m4QJi1GENn+7I91zA72y5ONz2Oc=
github.com/oneclickvirt/backtrace v0.0.5-20250517095024 h1:j912aga/17znOqMB2VAxWOQYa4GL6YMFBhv+6c7jkvA=
github.com/oneclickvirt/backtrace v0.0.5-20250517095024/go.mod h1:5AH00bo41hH3d2/JVuCTlBkZUs3AXX4nlKVXb6piZcI=
github.com/oneclickvirt/basics v0.0.12-20250521031609 h1:3WxHe+jKrZHF81oa8Xk3IgHCRqTC5GDjv8alR0geamU=
github.com/oneclickvirt/basics v0.0.12-20250521031609/go.mod h1:yN1IEOXN6v/GJqJSA70Pooo6nXBI/6rq72vTY72wJMQ=
github.com/oneclickvirt/cputest v0.0.10-20250404151448 h1:ovGtCwFXG0qmpyNDRqcNDIiAmhrtemCjIUXTJ1fPH0o=
github.com/oneclickvirt/cputest v0.0.10-20250404151448/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
github.com/oneclickvirt/dd v0.0.1-20250406062523 h1:jegTww4fuoFEqwFozvGJEqUNI/5ew3QJ0XcKZZ/zuTs=
github.com/oneclickvirt/dd v0.0.1-20250406062523/go.mod h1:tImu9sPTkLWo2tf1dEN1xQzrylWKauj9hbU8PHfyAeU=
github.com/oneclickvirt/UnlockTests v0.0.27-20250628125053 h1:Ug8kySZR1weRUcsnGOv+f3HAl791AfkA7EWV3JmiMQA=
github.com/oneclickvirt/UnlockTests v0.0.27-20250628125053/go.mod h1:yXWIZB6iLS88pEd9m4QJi1GENn+7I91zA72y5ONz2Oc=
github.com/oneclickvirt/backtrace v0.0.5-20250629024536 h1:caHCa0DHmbYWBFN1bqKxpvPnN0wOxDEqJv1VDvDdLWs=
github.com/oneclickvirt/backtrace v0.0.5-20250629024536/go.mod h1:5AH00bo41hH3d2/JVuCTlBkZUs3AXX4nlKVXb6piZcI=
github.com/oneclickvirt/basics v0.0.15-20250714163009 h1:7I1lU7N91kClw6Cb6o+vGfScc/HngrjhsaaW10AbBFs=
github.com/oneclickvirt/basics v0.0.15-20250714163009/go.mod h1:yN1IEOXN6v/GJqJSA70Pooo6nXBI/6rq72vTY72wJMQ=
github.com/oneclickvirt/cputest v0.0.11-20250716031513 h1:6xP/QCxwI6jTLmarIY3UIgaeOL2u94hzjVyG4yNa4WM=
github.com/oneclickvirt/cputest v0.0.11-20250716031513/go.mod h1:vjlH8tkPFft1tlLOpeNskXVvurxkHaJ3+dgFxQGLXY4=
github.com/oneclickvirt/dd v0.0.2-20250701085922 h1:WiWZwcnCPhRc8hLZdvkjD2kOEpnqn1S31z1j0x3V4l0=
github.com/oneclickvirt/dd v0.0.2-20250701085922/go.mod h1:tImu9sPTkLWo2tf1dEN1xQzrylWKauj9hbU8PHfyAeU=
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.8-20250425015826 h1:bwVg0zysB3uCwQV+KIIQpuq2IJXWdIcdjD2+FiKPo5w=
github.com/oneclickvirt/disktest v0.0.8-20250425015826/go.mod h1:sqVu6HwbnLmbnRj4389Xn08c301IhLnWCcbaEk2WzEc=
github.com/oneclickvirt/fio v0.0.1-20250406060851 h1:b7xHKpPmU4q0NmvigRCEr3tQuAV/83ZIAGtHycLegw8=
github.com/oneclickvirt/fio v0.0.1-20250406060851/go.mod h1:NIq+XYTey68KNERGIy/oRDlzpwLzBVoHOCiqX8didsE=
github.com/oneclickvirt/disktest v0.0.8-20250701092629 h1:B/gA6SOr4qL5pQmVpHl9m5bn3paDcL7wJ1SZ7aY66M8=
github.com/oneclickvirt/disktest v0.0.8-20250701092629/go.mod h1:6YCvGr+Z0tvcP4Ue8bezZqm/GqS/dSyEnSUhvS3Q03o=
github.com/oneclickvirt/fio v0.0.2-20250701085933 h1:4P7QcOTxbqyx5DhHdFvyeRSsdNajSo9l/H2XK0vICIc=
github.com/oneclickvirt/fio v0.0.2-20250701085933/go.mod h1:NIq+XYTey68KNERGIy/oRDlzpwLzBVoHOCiqX8didsE=
github.com/oneclickvirt/gostun v0.0.3-20250329105202 h1:aJ6E91Lp94lq8iWRcCaxpXTjqOOaWvufr5oras6cFtM=
github.com/oneclickvirt/gostun v0.0.3-20250329105202/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
github.com/oneclickvirt/memorytest v0.0.5-20250406063420 h1:eHqpqFIx8Ss062uyNf7Ruv7FC4AdZbElR7u9vX2Oj3g=
github.com/oneclickvirt/memorytest v0.0.5-20250406063420/go.mod h1:HTd0sSxRjT4BcV8kcCh4fF2Nia0xgZNaVjhefsnypic=
github.com/oneclickvirt/mbw v0.0.1-20250630140849 h1:p6RMhOPBnQKAm9+VEQ2axAFsidrdSdrhXMyheIyv2a8=
github.com/oneclickvirt/mbw v0.0.1-20250630140849/go.mod h1:0Vq6NRpyLmGUdfHfL3uDcFsuZhi7KlG+OCs5ky2757Y=
github.com/oneclickvirt/memorytest v0.0.8-20250716133749 h1:/z5lfsxRo5MHPfTAAKLk9vD0sQ4JDw5aEe21u6rQdfw=
github.com/oneclickvirt/memorytest v0.0.8-20250716133749/go.mod h1:7xMacjQobvFAtODht2hxTsB9hM2IFS7vZk3gxx+bsjo=
github.com/oneclickvirt/nt3 v0.0.5-20250416131047 h1:KL0xowq19cW+FMBGMJxdqpRNoeyR+eEmb+jYSubmlTk=
github.com/oneclickvirt/nt3 v0.0.5-20250416131047/go.mod h1:CVsDJEaIdyyZHn3WKbhU8Wn6GOfmBNvJlC/dDLRqcSQ=
github.com/oneclickvirt/pingtest v0.0.7-20250413051539 h1:mYOsEmMtwKr40hwM2NimVLpnbR2cjwuOh1c/9fQr2Dw=
github.com/oneclickvirt/pingtest v0.0.7-20250413051539/go.mod h1:d3Ntx5m9lMll3a/k3+2B+5emj//vgDh4/NHTxs2qQE8=
github.com/oneclickvirt/pingtest v0.0.8-20250701125637 h1:J28Ai5miTq1J0I4gdT8rewJSd3LwzD90L/bNiiaKfHM=
github.com/oneclickvirt/pingtest v0.0.8-20250701125637/go.mod h1:d3Ntx5m9lMll3a/k3+2B+5emj//vgDh4/NHTxs2qQE8=
github.com/oneclickvirt/portchecker v0.0.3-20250329125750 h1:TTNL0pnQlRsn046kW59I/9UWRpihttFHWnU7Ixycggk=
github.com/oneclickvirt/portchecker v0.0.3-20250329125750/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
github.com/oneclickvirt/security v0.0.4-20250522031128 h1:k/zpiES/W0lW6Rumlmo4i7zp2ncimfeOUKadrylde8M=
github.com/oneclickvirt/security v0.0.4-20250522031128/go.mod h1:hdCr9UFkJ0tQfFP4mIycZehF5v7VfzSQwNn2qkY0bGo=
github.com/oneclickvirt/speedtest v0.0.9-20250521034111 h1:yygDk+s5qFhPMDRzdMfyopm1xU512peNqY6WYyvYcfY=
github.com/oneclickvirt/speedtest v0.0.9-20250521034111/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
github.com/oneclickvirt/security v0.0.6-20250715102027 h1:lOaFxORBT/9nBlof7EU36YP+ZIbqkhCLGyOpYQTY1qs=
github.com/oneclickvirt/security v0.0.6-20250715102027/go.mod h1:SDFBXV0sDo8pSIcGaaJ2gfCCW+NKy4pO1q9i4SIX2jc=
github.com/oneclickvirt/speedtest v0.0.10-20250701123931 h1:IMUM0F3trrlCdl9JTO+FBIJ9zc8mbi+oyd66IkO/8mI=
github.com/oneclickvirt/speedtest v0.0.10-20250701123931/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=
@@ -278,8 +280,8 @@ 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.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
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=

991
goecs.go

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# From https://github.com/oneclickvirt/ecs
# 2025.06.05
# 2025.06.29
# curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
# 或
@@ -143,7 +143,7 @@ goecs_check() {
os=$(uname -s 2>/dev/null || echo "Unknown")
arch=$(uname -m 2>/dev/null || echo "Unknown")
check_china
ECS_VERSION=""
ECS_VERSION="0.1.55"
for api in \
"https://api.github.com/repos/oneclickvirt/ecs/releases/latest" \
"https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" \
@@ -155,8 +155,8 @@ goecs_check() {
sleep 1
done
if [ -z "$ECS_VERSION" ]; then
_yellow "Unable to get version info, using default version 0.1.33"
ECS_VERSION="0.1.33"
_yellow "Unable to get version info, using default version 0.1.55"
ECS_VERSION="0.1.55"
fi
version_output=""
for cmd_path in "goecs" "./goecs" "/usr/bin/goecs" "/usr/local/bin/goecs"; do

View File

@@ -1,17 +1,17 @@
package memorytest
import (
"fmt"
"github.com/oneclickvirt/memorytest/memory"
"runtime"
"strings"
"github.com/oneclickvirt/memorytest/memory"
)
func MemoryTest(language, testMethod string) {
var res string
func MemoryTest(language, testMethod string) (realTestMethod, res string) {
if runtime.GOOS == "windows" {
if testMethod != "winsat" && testMethod != "" {
res = "Detected host is Windows, using Winsat for testing.\n"
// res = "Detected host is Windows, using Winsat for testing.\n"
realTestMethod = "winsat"
}
res += memory.WinsatTest(language)
} else {
@@ -19,17 +19,23 @@ func MemoryTest(language, testMethod string) {
case "sysbench":
res = memory.SysBenchTest(language)
if res == "" {
res = "sysbench test failed, switch to use dd test.\n"
// res = "sysbench test failed, switch to use dd test.\n"
res += memory.DDTest(language)
realTestMethod = "dd"
} else {
realTestMethod = "sysbench"
}
case "dd":
res = memory.DDTest(language)
realTestMethod = "dd"
default:
res = "Unsupported test method"
// res = "Unsupported test method, switch to use dd test.\n"
res += memory.DDTest(language)
realTestMethod = "dd"
}
}
if !strings.Contains(res, "\n") && res != "" {
res += "\n"
}
fmt.Printf(res)
return
}

View File

@@ -1,9 +1,11 @@
package memorytest
import (
"fmt"
"testing"
)
func Test(t *testing.T) {
MemoryTest("zh", "sysbench")
_, res := MemoryTest("zh", "sysbench")
fmt.Print(res)
}

View File

@@ -6,5 +6,5 @@ import (
)
func Test(t *testing.T) {
fmt.Printf(MediaTest("zh"))
fmt.Printf("%s", MediaTest("zh"))
}

View File

@@ -3,13 +3,11 @@ package utils
import (
"bufio"
"bytes"
"context"
"fmt"
"github.com/imroc/req/v3"
"github.com/oneclickvirt/UnlockTests/uts"
"github.com/oneclickvirt/basics/system"
. "github.com/oneclickvirt/defaultset"
"github.com/oneclickvirt/security/network"
"io"
"net"
"net/http"
"os"
"path/filepath"
"regexp"
@@ -17,6 +15,12 @@ import (
"sync"
"time"
"unicode/utf8"
"github.com/imroc/req/v3"
"github.com/oneclickvirt/UnlockTests/uts"
"github.com/oneclickvirt/basics/system"
. "github.com/oneclickvirt/defaultset"
"github.com/oneclickvirt/security/network"
)
// PrintCenteredTitle 根据指定的宽度打印居中标题
@@ -95,14 +99,14 @@ func CheckChina(enableLogger bool) bool {
}
// BasicsAndSecurityCheck 执行安全检查
func BasicsAndSecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) {
func BasicsAndSecurityCheck(language, nt3CheckType string, securityCheckStatus bool) (string, string, string) {
var wgt sync.WaitGroup
var ipInfo, securityInfo, systemInfo string
var err error
wgt.Add(1)
go func() {
defer wgt.Done()
ipInfo, securityInfo, err = network.NetworkCheck("both", securtyCheckStatus, language)
ipInfo, securityInfo, err = network.NetworkCheck("both", securityCheckStatus, language)
if err != nil {
fmt.Println(err.Error())
}
@@ -330,3 +334,159 @@ func ProcessAndUpload(output string, filePath string, enableUplaod bool) (string
}
return "", ""
}
// ============================= 前置联网能力检测 =============================
var StackType string
type NetCheckResult struct {
HasIPv4 bool
HasIPv6 bool
Connected bool
StackType string // "IPv4", "IPv6", "DualStack", "None"
}
func makeResolver(proto, dnsAddr string) *net.Resolver {
return &net.Resolver{
PreferGo: true,
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
d := net.Dialer{
Timeout: 5 * time.Second,
}
return d.DialContext(ctx, proto, dnsAddr)
},
}
}
func CheckPublicAccess(timeout time.Duration) NetCheckResult {
if timeout < 2*time.Second {
timeout = 2 * time.Second
}
var wg sync.WaitGroup
resultChan := make(chan string, 8)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
checks := []struct {
Tag string
Addr string
Kind string // udp4, udp6, http4, http6
}{
// UDP DNS
{"IPv4", "223.5.5.5:53", "udp4"}, // 阿里 DNS
{"IPv4", "8.8.8.8:53", "udp4"}, // Google DNS
{"IPv6", "[2400:3200::1]:53", "udp6"}, // 阿里 IPv6 DNS
{"IPv6", "[2001:4860:4860::8888]:53", "udp6"}, // Google IPv6 DNS
// HTTP HEAD
{"IPv4", "https://www.baidu.com", "http4"}, // 百度
{"IPv4", "https://1.1.1.1", "http4"}, // Cloudflare
{"IPv6", "https://[2400:3200::1]", "http6"}, // 阿里 IPv6
{"IPv6", "https://[2606:4700::1111]", "http6"}, // Cloudflare IPv6
}
for _, check := range checks {
wg.Add(1)
go func(tag, addr, kind string) {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
}
}()
switch kind {
case "udp4", "udp6":
dialer := &net.Dialer{
Timeout: timeout / 4,
}
conn, err := dialer.DialContext(ctx, kind, addr)
if err == nil && conn != nil {
conn.Close()
select {
case resultChan <- tag:
case <-ctx.Done():
return
}
}
case "http4", "http6":
var resolver *net.Resolver
if kind == "http4" {
resolver = makeResolver("udp4", "223.5.5.5:53")
} else {
resolver = makeResolver("udp6", "[2400:3200::1]:53")
}
dialer := &net.Dialer{
Timeout: timeout / 4,
Resolver: resolver,
}
transport := &http.Transport{
DialContext: dialer.DialContext,
MaxIdleConns: 1,
MaxIdleConnsPerHost: 1,
IdleConnTimeout: time.Second,
TLSHandshakeTimeout: timeout / 4,
ResponseHeaderTimeout: timeout / 4,
DisableKeepAlives: true,
}
client := &http.Client{
Timeout: timeout / 4,
Transport: transport,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
req, err := http.NewRequestWithContext(ctx, "HEAD", addr, nil)
if err != nil {
return
}
resp, err := client.Do(req)
if err == nil && resp != nil {
if resp.Body != nil {
resp.Body.Close()
}
if resp.StatusCode < 500 {
select {
case resultChan <- tag:
case <-ctx.Done():
return
}
}
}
}
}(check.Tag, check.Addr, check.Kind)
}
go func() {
wg.Wait()
close(resultChan)
}()
hasV4 := false
hasV6 := false
for {
select {
case res, ok := <-resultChan:
if !ok {
goto result
}
if res == "IPv4" {
hasV4 = true
}
if res == "IPv6" {
hasV6 = true
}
case <-ctx.Done():
goto result
}
}
result:
stack := "None"
if hasV4 && hasV6 {
stack = "DualStack"
} else if hasV4 {
stack = "IPv4"
} else if hasV6 {
stack = "IPv6"
}
StackType = stack
return NetCheckResult{
HasIPv4: hasV4,
HasIPv6: hasV6,
Connected: hasV4 || hasV6,
StackType: stack,
}
}

17
utils/utils_test.go Normal file
View File

@@ -0,0 +1,17 @@
package utils
import (
"fmt"
"testing"
"time"
)
func TestCheckPublicAccess(t *testing.T) {
timeout := 3 * time.Second
result := CheckPublicAccess(timeout)
if result.Connected {
fmt.Printf("✅ 本机有公网连接,类型: %s\n", result.StackType)
} else {
fmt.Println("❌ 本机未检测到公网连接")
}
}