mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-27 19:52:08 +08:00
Compare commits
27 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 |
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.10
|
||||
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
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
vendor/
|
||||
vendor/
|
||||
.idea/
|
@@ -52,4 +52,27 @@ builds:
|
||||
goarch:
|
||||
- arm64
|
||||
main: ./
|
||||
binary: goecs
|
||||
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
|
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,7 +1,5 @@
|
||||
# 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
|
||||
@@ -12,6 +10,5 @@ RUN curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -
|
||||
chmod +x goecs.sh && \
|
||||
bash goecs.sh env && \
|
||||
bash goecs.sh install
|
||||
|
||||
# 设置 goecs 为入口点
|
||||
ENTRYPOINT ["goecs"]
|
92
README.md
92
README.md
@@ -1,6 +1,10 @@
|
||||
# ECS
|
||||
|
||||
[](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml) [](https://www.spiritlhl.net/)
|
||||
[](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml)
|
||||
|
||||
[](https://www.spiritlhl.net/)
|
||||
|
||||
[<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 重构版本
|
||||
|
||||
@@ -48,12 +52,10 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
|
||||
|
||||
## **功能**
|
||||
|
||||
- 系统基础信息查询:
|
||||
- 系统基础信息查询,IP基础信息并发查询:
|
||||
自研 [basics](https://github.com/oneclickvirt/basics)、[gostun](https://github.com/oneclickvirt/gostun)
|
||||
- IP 基础信息并发查询:
|
||||
自研 [basics](https://github.com/oneclickvirt/basics)
|
||||
- CPU 测试:
|
||||
自研 [cputest](https://github.com/oneclickvirt/cputest),支持 sysbench、geekbench、winsat
|
||||
自研 [cputest](https://github.com/oneclickvirt/cputest),支持 sysbench(lua/golang版本)、geekbench、winsat
|
||||
- 内存测试:
|
||||
自研 [memorytest](https://github.com/oneclickvirt/memorytest),支持 sysbench、dd
|
||||
- 硬盘测试:
|
||||
@@ -69,7 +71,7 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
|
||||
- 三网回程测试:
|
||||
借鉴 [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)
|
||||
基于 [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 值测试:
|
||||
@@ -83,6 +85,8 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
|
||||
|
||||
#### **一键命令**
|
||||
|
||||
将默认安装依赖,默认更新包管理器,默认非互动模式,下面的非一键命令版本可控制是否安装依赖/是否更新包管理器/默认互动模式
|
||||
|
||||
- **国际用户无加速:**
|
||||
|
||||
```bash
|
||||
@@ -153,7 +157,13 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
|
||||
./goecs.sh uninstall
|
||||
```
|
||||
|
||||
6. **唤起菜单**
|
||||
6. **帮助命令**
|
||||
|
||||
```bash
|
||||
./goecs.sh -h
|
||||
```
|
||||
|
||||
7. **唤起菜单**
|
||||
|
||||
```bash
|
||||
goecs
|
||||
@@ -161,6 +171,9 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
|
||||
|
||||
#### **命令参数化**
|
||||
|
||||
<details>
|
||||
<summary>展开查看各参数说明</summary>
|
||||
|
||||
```bash
|
||||
Usage: goecs [options]
|
||||
-backtrace
|
||||
@@ -214,6 +227,7 @@ Usage: goecs [options]
|
||||
Enable/Disable unlock media test (default true)
|
||||
-v Display version information
|
||||
```
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
@@ -260,21 +274,64 @@ docker run --rm --privileged --network host docker.cnb.cool/oneclickvirt/ecs:lat
|
||||
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测试方式可使用参数指定,默认只是为了更多用户快速测试的需求
|
||||
|
||||
@@ -296,5 +353,4 @@ LUA编写且开源,各架构系统可自行编译 仅官方二进制文件
|
||||
|
||||
#### Q: 非Root环境如何进行测试?
|
||||
|
||||
#### A: 手动执行安装命令,实在装不上也没问题,直接在release中下载对应架构的压缩包解压后执行即可,只要你能执行的了文件。或者你能使用docker的话用docker执行。
|
||||
|
||||
#### A: 手动执行安装命令,实在装不上也没问题,直接在release中下载对应架构的压缩包解压后执行即可,只要你能执行的了文件。或者你能使用docker的话用docker执行。
|
345
README_EN.md
345
README_EN.md
@@ -1,141 +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
|
||||
[](https://www.spiritlhl.net/)
|
||||
|
||||
Please report any issues via issues.
|
||||
[<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 version:[https://github.com/oneclickvirt/ecs](https://github.com/oneclickvirt/ecs)
|
||||
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
|
||||
---
|
||||
|
||||
## **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.
|
||||
|
||||
```
|
||||
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
|
||||
```
|
||||
### **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
|
||||
```
|
||||
---
|
||||
|
||||
If you don't want interaction, use ```export noninteractive=true``` and then execute the ```env``` command
|
||||
## **Instructions for Use**
|
||||
|
||||
Install goecs
|
||||
### **Linux/FreeBSD/MacOS**
|
||||
|
||||
```
|
||||
./goecs.sh install
|
||||
```
|
||||
#### **One-click command**
|
||||
|
||||
Upgrade goecs
|
||||
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.
|
||||
|
||||
```
|
||||
./goecs.sh upgrade
|
||||
```
|
||||
- **International users without acceleration:**
|
||||
|
||||
Uninstall goecs
|
||||
```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
|
||||
```
|
||||
|
||||
```
|
||||
./goecs.sh uninstall
|
||||
```
|
||||
- **International/domestic users with CDN acceleration:**
|
||||
|
||||
Explanation of the shell script
|
||||
```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
|
||||
```
|
||||
|
||||
```
|
||||
Available commands:
|
||||
- **Domestic users with CNB acceleration:**
|
||||
|
||||
./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)
|
||||
```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.sh install Install goecs command
|
||||
./goecs.sh upgrade Upgrade goecs command
|
||||
./goecs.sh uninstall Uninstall goecs command
|
||||
./goecs.sh help Show this message
|
||||
```
|
||||
#### **Detailed instructions**
|
||||
|
||||
Invoke the goecs menu
|
||||
1. **Download the script**
|
||||
|
||||
```
|
||||
goecs -l en
|
||||
```
|
||||
**International users without acceleration:**
|
||||
|
||||
or
|
||||
```bash
|
||||
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
|
||||
```
|
||||
|
||||
```
|
||||
./goecs -l en
|
||||
```
|
||||
**International/domestic users with CDN acceleration:**
|
||||
|
||||
Parameterized goecs command
|
||||
```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)
|
||||
@@ -188,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
|
||||
@@ -216,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.
|
6
go.mod
6
go.mod
@@ -5,9 +5,9 @@ go 1.23.4
|
||||
require (
|
||||
github.com/imroc/req/v3 v3.49.0
|
||||
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502
|
||||
github.com/oneclickvirt/UnlockTests v0.0.23-20250118055400
|
||||
github.com/oneclickvirt/UnlockTests v0.0.26-20250223034957
|
||||
github.com/oneclickvirt/backtrace v0.0.4-20240702140722
|
||||
github.com/oneclickvirt/basics v0.0.8-20241108124433
|
||||
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
|
||||
@@ -17,7 +17,7 @@ require (
|
||||
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-20241005164804
|
||||
github.com/oneclickvirt/speedtest v0.0.8-20250217133052
|
||||
)
|
||||
|
||||
require (
|
||||
|
12
go.sum
12
go.sum
@@ -103,12 +103,12 @@ github.com/nxtrace/NTrace-core v1.3.7 h1:ZnTbPrPqpyeraCvUyNbQTNyl4Gz3NRQDh06WdII
|
||||
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.23-20250118055400 h1:vDqJOsM6ooL6TYkGZFbkOIaX4JnIkCGPPZI39T48MdA=
|
||||
github.com/oneclickvirt/UnlockTests v0.0.23-20250118055400/go.mod h1:yXWIZB6iLS88pEd9m4QJi1GENn+7I91zA72y5ONz2Oc=
|
||||
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.8-20241108124433 h1:eKZcoNoa9uLWmfisk+qN/QOvSGT4ajCmZdZfIAcHG+o=
|
||||
github.com/oneclickvirt/basics v0.0.8-20241108124433/go.mod h1:fUdVpU8gdjaZsTCyqnQBAbHc9BbbN8Fxr3sGPKooUpU=
|
||||
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=
|
||||
@@ -127,8 +127,8 @@ github.com/oneclickvirt/portchecker v0.0.3-20250118031146 h1:tXTcpq8P3KgQupEZhPc
|
||||
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-20241005164804 h1:qguczGucxyRCRaeI2Av7+QpgYb6o8lTJJmOjPkmGiSg=
|
||||
github.com/oneclickvirt/speedtest v0.0.8-20241005164804/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
|
||||
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=
|
||||
|
2
goecs.go
2
goecs.go
@@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ecsVersion = "v0.1.5"
|
||||
ecsVersion = "v0.1.14"
|
||||
menuMode bool
|
||||
onlyChinaTest bool
|
||||
input, choice string
|
||||
|
47
goecs.sh
47
goecs.sh
@@ -85,40 +85,11 @@ check_china() {
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# 在非交互模式下默认使用中国镜像
|
||||
CN=true
|
||||
fi
|
||||
else
|
||||
# 如果 ipapi.co 检测失败,尝试使用 cip.cc
|
||||
if ! curl -m 6 -s https://ipapi.co/json >/dev/null 2>&1; then
|
||||
if curl -m 6 -s cip.cc | grep -q "中国"; then
|
||||
_yellow "根据cip.cc提供的信息,当前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=true
|
||||
fi
|
||||
else
|
||||
CN=false
|
||||
fi
|
||||
else
|
||||
# 在非交互模式下默认不使用中国镜像
|
||||
CN=false
|
||||
fi
|
||||
else
|
||||
CN=false
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -168,8 +139,8 @@ goecs_check() {
|
||||
sleep 1
|
||||
done
|
||||
if [ -z "$ECS_VERSION" ]; then
|
||||
_yellow "Unable to get version info, using default version 0.1.5"
|
||||
ECS_VERSION="0.1.5"
|
||||
_yellow "Unable to get version info, using default version 0.1.8"
|
||||
ECS_VERSION="0.1.8"
|
||||
fi
|
||||
# Check if original goecs command exists
|
||||
version_output=""
|
||||
@@ -525,6 +496,12 @@ env_check() {
|
||||
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
|
||||
@@ -645,8 +622,6 @@ show_help() {
|
||||
./goecs.sh uninstall 卸载 goecs 命令
|
||||
./goecs.sh help 显示此消息
|
||||
|
||||
[English version follows...]
|
||||
|
||||
Available commands:
|
||||
|
||||
./goecs.sh env Check and Install dependencies
|
||||
|
@@ -60,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)
|
||||
@@ -123,7 +88,7 @@ func CheckChina(enableLogger bool) bool {
|
||||
case "no", "n":
|
||||
fmt.Println("不使用中国专项测试")
|
||||
default:
|
||||
fmt.Println("不使用中国专项测试")
|
||||
fmt.Println("使用中国专项测试")
|
||||
selectChina = true
|
||||
}
|
||||
}
|
||||
@@ -153,6 +118,7 @@ func BasicsAndSecurityCheck(language, nt3CheckType string, securtyCheckStatus bo
|
||||
basicInfo := systemInfo + ipInfo
|
||||
if errv6 == nil && ipv6Info != "" {
|
||||
basicInfo += ipv6Info
|
||||
basicInfo += "\n"
|
||||
}
|
||||
if strings.Contains(ipInfo, "IPV4") && strings.Contains(ipInfo, "IPV6") {
|
||||
uts.IPV4 = true
|
||||
@@ -254,11 +220,21 @@ func UploadText(absPath string) (string, string, error) {
|
||||
SetRetryCount(2).
|
||||
SetRetryBackoffInterval(1*time.Second, 5*time.Second).
|
||||
SetRetryFixedInterval(2 * time.Second)
|
||||
// 打开文件
|
||||
file, err := os.Open(absPath)
|
||||
if err != nil {
|
||||
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 {
|
||||
@@ -287,10 +263,12 @@ func UploadText(absPath string) (string, string, error) {
|
||||
}
|
||||
return "", "", fmt.Errorf("upload failed for %s with status code: %d", url, resp.StatusCode)
|
||||
}
|
||||
// 尝试上传到主URL
|
||||
httpURL, httpsURL, err := upload(primaryURL)
|
||||
if err == nil {
|
||||
return httpURL, httpsURL, nil
|
||||
}
|
||||
// 尝试上传到备份URL
|
||||
httpURL, httpsURL, err = upload(backupURL)
|
||||
if err != nil {
|
||||
return "", "", fmt.Errorf("failed to upload to both primary and backup URLs: %w", err)
|
||||
|
Reference in New Issue
Block a user