Compare commits

..

63 Commits

Author SHA1 Message Date
spiritlhl
d80f3451ff v0.0.87 修复部分流媒体检测错误识别Ban为No的问题 2024-12-07 21:25:53 +08:00
spiritlhl
ebce9e493d v0.0.86 增加GooglePlay流媒体检测 2024-11-23 21:01:20 +08:00
spiritlhl
176899d3e9 Update 2024-11-18 13:19:11 +08:00
spiritlhl
e58da9e921 Update 2024-11-18 13:09:43 +08:00
spiritlhl
651bbb94d0 Add noninteractive option 2024-11-18 12:54:09 +08:00
spiritlhl
91ffbfa417 v0.0.85 更新分区模块,更新shell相关脚本修复隐藏BUG 2024-11-18 11:24:36 +08:00
spiritlhl
84b0303468 2024.11.17 2024-11-17 08:58:14 +00:00
spiritlhl
f3e10a999b 2024.11.17 更新shell相关内容,支持epel安装回退和可选是否更新包管理器 2024-11-17 08:38:52 +00:00
spiritlhl
76a6e09d97 2024.11.17 更新shell相关内容,支持epel安装回退和可选是否更新包管理器 2024-11-17 08:37:32 +00:00
spiritsoul
9c9dbc6200 增加对应的子网掩码检测调用 2024-11-08 22:19:57 +08:00
spiritsoul
20c8063e5e v0.0.83 增加IPV6子网掩码检测所需的依赖 2024-11-08 20:55:14 +08:00
spiritsoul
fbe5eb8e58 v0.0.83 增加IPV6子网掩码检测 2024-11-08 20:21:17 +08:00
spiritlhl
290f0d8d8c Update 2024-10-20 11:37:06 +08:00
spiritlhl
140347c2a6 v0.0.81
优化在按ctrl+c终止程序时依然生成分享链接
2024-10-06 21:22:14 +08:00
spiritlhl
aeda7a6e88 Update goecs.sh 2024-10-06 21:04:23 +08:00
spiritlhl
a205ca38be v0.0.80
修复选项识别错误以及测速识别错误的问题
修正终止命令的检测和退出机制
pingtest优化日志记录
2024-10-06 20:41:36 +08:00
spiritlhl
43bf9c81ed Update goecs.sh 2024-10-06 19:13:22 +08:00
spiritlhl
d47f8987a7 Update goecs.sh 2024-10-06 19:00:18 +08:00
spiritlhl
ffbe5a539a Update goecs.sh 2024-10-06 16:09:26 +08:00
spiritsoul
4b8ae06df8 v0.0.79 2024-10-06 00:50:52 +08:00
spiritsoul
859e783241 v0.0.78 2024-10-06 00:03:28 +08:00
spiritsoul
3cd912219e v0.0.77 临时修复测速BUG,未完全修复
v0.0.77 临时修复测速BUG,未完全修复
2024-10-05 23:26:09 +08:00
spiritsoul
a85a06b440 v0.0.76
调整输出文本
2024-10-04 23:53:57 +08:00
spiritsoul
681da08f01 v0.0.75
修复终止命令在选项选择时不可用的问题
展示分享链接时同时展示http和https协议的链接
2024-10-04 23:30:06 +08:00
spiritsoul
bdd00d46f8 v0.0.74 2024-08-25 18:01:24 +08:00
spiritsoul
1f213bb788 update 2024-08-22 20:33:39 +08:00
spiritsoul
1dec7c323b update 2024-08-20 17:22:12 +08:00
spiritsoul
391cc351c4 update 2024-08-20 17:05:54 +08:00
spiritsoul
282a947156 update 2024-08-15 21:47:56 +08:00
spiritsoul
73916d324a v0.0.72 2024-08-14 20:34:24 +08:00
spiritsoul
6cce2a7e8e Add https://hub.docker.com/r/spiritlhl/goecs 2024-08-14 18:01:29 +08:00
spiritsoul
2a653930a8 update 2024-08-14 17:54:20 +08:00
spiritsoul
2295035706 v0.0.71 2024-08-14 17:32:21 +08:00
spiritsoul
3e8c7112a0 Merge branch 'master' of https://github.com/oneclickvirt/ecs 2024-08-14 17:09:25 +08:00
spiritsoul
a8175219d5 v0.0.70 2024-08-14 17:09:02 +08:00
spiritlhl
a827583b76 Update build_docker.yaml 2024-08-14 15:37:48 +08:00
spiritlhl
82a1d19c6c Update build_docker.yaml 2024-08-14 13:12:23 +08:00
spiritsoul
4ef0ac8d5a update 2024-08-14 13:10:44 +08:00
spiritsoul
3bb70191e7 update 2024-08-14 13:09:59 +08:00
spiritsoul
1bca0052c5 update 2024-08-14 13:05:54 +08:00
spiritsoul
7c06d278e0 Build Dockerfile 2024-08-14 13:00:35 +08:00
spiritlhl
5cec395f3c Create build_docker.yaml 2024-08-14 12:49:54 +08:00
spiritsoul
4994994d4f v0.0.69 2024-08-13 21:46:30 +08:00
spiritsoul
91ad962b13 更新部分说明 2024-08-09 23:31:43 +08:00
spiritsoul
8356d95566 update 2024-08-09 23:28:45 +08:00
spiritsoul
1428087818 v0.0.68 - 修复fio测试索引结果错误的问题 2024-08-09 13:38:39 +08:00
spiritsoul
7b1e78fb7e remove 2024-08-08 14:04:30 +08:00
spiritsoul
0a62c62dd8 v0.0.67 修复部分流媒体检测 2024-08-08 14:00:37 +08:00
spiritsoul
34b4f66289 update 2024-08-07 23:28:16 +08:00
spiritsoul
eca268048f v0.0.66 - 修复DNS检测漏洞 2024-08-07 23:03:37 +08:00
spiritsoul
c3ffe741ad v0.0.65 2024-08-05 19:58:05 +08:00
spiritsoul
9de837ef71 update 2024-08-05 14:48:32 +08:00
spiritsoul
2c3da79871 update 2024-08-05 11:09:04 +08:00
spiritsoul
e7ad87ecbd fix old wget err 2024-08-05 11:04:27 +08:00
spiritsoul
a89a79c11c v0.0.64 - 优化增加原生实现ping测试
v0.0.64 - 优化增加原生实现ping测试
2024-08-04 21:47:50 +08:00
spiritsoul
ee38b65a5a update 2024-08-03 23:19:11 +08:00
spiritsoul
0a756f04ca update 2024-08-03 18:46:08 +08:00
spiritsoul
f040ffb1d4 v0.0.63 2024-08-01 13:14:17 +08:00
spiritsoul
efb870a9de v0.0.63 2024-08-01 13:13:02 +08:00
spiritsoul
9151cd3b70 update 2024-07-31 14:16:04 +08:00
spiritsoul
ef8e2789e2 update 2024-07-31 14:15:29 +08:00
spiritsoul
2dad691bd6 update 2024-07-30 21:59:50 +08:00
spiritsoul
a9c5ed359a v0.0.61 2024-07-30 18:26:59 +08:00
12 changed files with 704 additions and 383 deletions

35
.github/workflows/build_docker.yaml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Build and Push Docker Image
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/riscv64
# linux/mips,linux/mipsle 暂不支持 alpine, linux/s390x 编译卡死
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/goecs:latest

17
Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
# syntax=docker/dockerfile:1
FROM alpine:latest
# 安装必要的工具
RUN apk add --no-cache wget curl bash
RUN apk add --no-cache bind-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
RUN apk add --no-cache grep openssl ca-certificates uuidgen
RUN export noninteractive=true
# 下载并执行 goecs.sh 脚本
RUN curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && \
chmod +x goecs.sh && \
bash goecs.sh env && \
bash goecs.sh install
# 设置 goecs 为入口点
ENTRYPOINT ["goecs"]

View File

@@ -12,7 +12,7 @@ Shell版本 https://github.com/spiritLHLS/ecs
## 适配系统和架构 ## 适配系统和架构
编译支持的架构: amd64、arm、arm64、386、s390x、mips、mipsle、s390x、riscv64 编译支持的架构: amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
测试支持的架构: amd64、arm64 测试支持的架构: amd64、arm64
@@ -33,13 +33,13 @@ Shell版本 https://github.com/spiritLHLS/ecs
- [x] CPU测试[自研[cputest](https://github.com/oneclickvirt/cputest)支持sysbench、geekbench、winsat] - [x] CPU测试[自研[cputest](https://github.com/oneclickvirt/cputest)支持sysbench、geekbench、winsat]
- [x] 内存测试[自研[memorytest](https://github.com/oneclickvirt/memorytest)支持sysbench、dd] - [x] 内存测试[自研[memorytest](https://github.com/oneclickvirt/memorytest)支持sysbench、dd]
- [x] 硬盘测试[自研[disktest](https://github.com/oneclickvirt/disktest)支持dd、fio、winsat] - [x] 硬盘测试[自研[disktest](https://github.com/oneclickvirt/disktest)支持dd、fio、winsat]
- [x] 御三家流媒体解锁信息并发查询[借鉴[netflix-verify](https://github.com/sjlleo/netflix-verify)、[VerifyDisneyPlus](https://github.com/sjlleo/VerifyDisneyPlus)、[TubeCheck](https://github.com/sjlleo/TubeCheck)二次开发至于[CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)] - [x] 御三家流媒体解锁信息并发查询[借鉴[netflix-verify](https://github.com/sjlleo/netflix-verify)、[VerifyDisneyPlus](https://github.com/sjlleo/VerifyDisneyPlus)、[TubeCheck](https://github.com/sjlleo/TubeCheck)逻辑开发至于[CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)]
- [x] 常见流媒体测试并发查询[自研代码,逻辑借鉴[RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck)、[MediaUnlockTest](https://github.com/HsukqiLee/MediaUnlockTest)并自行修复错漏至于[UnlockTests](https://github.com/oneclickvirt/UnlockTests)] - [x] 常见流媒体测试并发查询[自研至于[UnlockTests](https://github.com/oneclickvirt/UnlockTests),逻辑借鉴[RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck)、[MediaUnlockTest](https://github.com/HsukqiLee/MediaUnlockTest)]
- [x] IP质量/安全信息并发查询[自研,由于测试含密钥信息,故而私有化开发,但二进制文件编译至于[securityCheck](https://github.com/oneclickvirt/securityCheck)] - [x] IP质量/安全信息并发查询[自研,由于测试含密钥信息,故而私有化开发,但二进制文件编译至于[securityCheck](https://github.com/oneclickvirt/securityCheck)]
- [x] 邮件端口测试[自研[portchecker](https://github.com/oneclickvirt/portchecker)] - [x] 邮件端口测试[自研[portchecker](https://github.com/oneclickvirt/portchecker)]
- [x] 三网回程测试[借鉴[zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace)二次开发至于[oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)] - [x] 三网回程测试[借鉴[zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace)二次开发至于[oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)]
- [x] 三网路由测试[借鉴[NTrace-core](https://github.com/nxtrace/NTrace-core)二次开发至于[nt3](https://github.com/oneclickvirt/nt3)] - [x] 三网路由测试[借鉴[NTrace-core](https://github.com/nxtrace/NTrace-core)二次开发至于[nt3](https://github.com/oneclickvirt/nt3)]
- [x] 测试网速[基于[speedtest.net-爬虫](https://github.com/spiritLHLS/speedtest.net-CN-ID)、[speedtest.cn-爬虫](https://github.com/spiritLHLS/speedtest.cn-CN-ID)的数据,借鉴[speedtest-go](https://github.com/showwin/speedtest-go)二次开发至于[oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)] - [x] 测试网速[基于[speedtest.net-爬虫](https://github.com/spiritLHLS/speedtest.net-CN-ID)、[speedtest.cn-爬虫](https://github.com/spiritLHLS/speedtest.cn-CN-ID)的数据,使用[speedtest-go](https://github.com/showwin/speedtest-go)开发至于[oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)]
- [x] 测试三网Ping值[借鉴[ecsspeed](https://github.com/spiritLHLS/ecsspeed)的逻辑二次开发至于[pingtest](https://github.com/oneclickvirt/pingtest)] - [x] 测试三网Ping值[借鉴[ecsspeed](https://github.com/spiritLHLS/ecsspeed)的逻辑二次开发至于[pingtest](https://github.com/oneclickvirt/pingtest)]
## Linux/FreeBSD/MacOS上使用的说明 ## Linux/FreeBSD/MacOS上使用的说明
@@ -47,13 +47,13 @@ Shell版本 https://github.com/spiritLHLS/ecs
### 一键命令 ### 一键命令
``` ```
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 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
``` ```
``` ```
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 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
``` ```
### 详细说明 ### 详细说明
@@ -70,12 +70,14 @@ curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o go
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
``` ```
安装环境 更新包管理器(可选择)和安装环境
``` ```
./goecs.sh env ./goecs.sh env
``` ```
如果不想要互动,可使用```export noninteractive=true```再执行```env```命令
安装goecs 安装goecs
``` ```
@@ -99,18 +101,28 @@ shell脚本的说明
``` ```
可用命令: 可用命令:
./goecs.sh env 检查并安装的包: ./goecs.sh env 检查并安装依赖包
sudo (几乎所有类 Unix 系统都有。) 警告: 此命令会执行系统更新(可选择),可能:
tar (几乎所有类 Unix 系统都有。) 1. 耗时较长
unzip (几乎所有类 Unix 系统都有。) 2. 导致网络短暂中断
dd (几乎所有类 Unix 系统都有。) 3. 影响系统稳定性
fio (几乎所有类 Unix 系统可以通过系统的包管理器安装。) 4. 影响后续系统启动
sysbench (几乎所有类 Unix 系统可以通过系统的包管理器安装。) 对于内存小于1GB的系统还可能导致:
geekbench (geekbench5) (仅支持 IPV4 环境,且内存大于 1GB 并需要持续联网,仅支持 amd64 和 arm64 架构。) 1. 系统卡死
speedtest (使用官方提供的二进制文件以获得更准确的测试结果。) 2. SSH连接中断
ping (使用官方提供的二进制文件以获得更准确的测试结果。) 3. 关键服务失败
systemd-detect-virt 或 dmidecode (几乎所有类 Unix 系统都有,安装以获得更准确的测试结果。) 推荐:
事实上sysbench/geekbench 是上述依赖项中唯一必须安装的,没有它们无法测试 CPU 分数。 环境依赖安装过程中挂起执行
必需组件:
sysbench/geekbench (CPU性能测试必需)
可选组件:
sudo, tar, unzip, dd, fio
speedtest (网络测试)
ping (网络连通性测试)
systemd-detect-virt/dmidecode (系统信息检测)
./goecs.sh install 安装 goecs 命令 ./goecs.sh install 安装 goecs 命令
./goecs.sh upgrade 升级 goecs 命令 ./goecs.sh upgrade 升级 goecs 命令
./goecs.sh uninstall 卸载 goecs 命令 ./goecs.sh uninstall 卸载 goecs 命令
@@ -163,7 +175,7 @@ Usage: goecs [options]
-memory -memory
Enable/Disable memory test (default true) Enable/Disable memory test (default true)
-memorym string -memorym string
Set memory test method (supported: sysbench, dd, winsat) (default "dd") Set memory test method (supported: sysbench, dd, winsat) (default "sysbench")
-menu -menu
Enable/Disable menu mode, disable example: -menu=false (default true) Enable/Disable menu mode, disable example: -menu=false (default true)
-nt3 -nt3
@@ -197,6 +209,26 @@ https://github.com/oneclickvirt/ecs/releases
windows测试无需进行环境安装 windows测试无需进行环境安装
## 在Docker中使用的说明
地址https://hub.docker.com/r/spiritlhl/goecs
请确保执行下述命令前本机已安装Docker
特权模式+host网络
```shell
docker run --rm --privileged --network host spiritlhl/goecs:latest -menu=false -l zh
```
非特权模式+非host网络
```shell
docker run --rm spiritlhl/goecs:latest -menu=false -l zh
```
使用Docker执行测试硬件测试会有一些偏差和虚拟化架构判断失效还是推荐直接测试而不使用Docker测试。
## QA ## QA
#### Q: 为什么默认使用sysbench而不是geekbench #### Q: 为什么默认使用sysbench而不是geekbench
@@ -208,9 +240,9 @@ sysbench geekbench
轻量几乎所有服务器都能跑 重型小机器跑不动 轻量几乎所有服务器都能跑 重型小机器跑不动
测试无联网需求,无硬件需求 测试必须联网且必须IPV4环境且有内存大小1G的最低需求 测试无联网需求,无硬件需求 测试必须联网且必须IPV4环境且有内存大小1G的最低需求
LUA编写且开源各架构系统可自行编译 仅官方二进制文件且不开源,无对应架构时无法自行编译 LUA编写且开源各架构系统可自行编译 仅官方二进制文件且不开源,无对应架构时无法自行编译
核心测试组件十多年不变 每次大版本更新对标的CPU不同版本间得分互相之间难转化你只能以对标的CPU为准 核心测试组件十多年不变 每次大版本更新对标的CPU不同版本间得分互相之间难转化你只能以对标的CPU为准
测试仅测试计算性能 测试涵盖多种性能测试,得分以权重计算,但实际很多测试项目实际是用不到的 测试仅测试计算性能 测试涵盖多种性能测试,得分以权重计算,但实际很多测试项目实际是用不到的
适合快速测试 适合全面测试 适合快速测试 适合全面测试
``` ```
且```goecs```测试使用何种CPU测试方式可使用参数指定默认只是为了更多用户快速测试的需求 且```goecs```测试使用何种CPU测试方式可使用参数指定默认只是为了更多用户快速测试的需求

View File

@@ -12,7 +12,7 @@ Shell version: https://github.com/spiritLHLS/ecs/blob/main/README_EN.md
## Supported Systems and Architectures ## Supported Systems and Architectures
Architectures supported for compilation: amd64、arm、arm64、386、s390x、mips、mipsle、s390x、riscv64 Architectures supported for compilation: amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
Tested architectures: amd64, arm64 Tested architectures: amd64, arm64
@@ -47,7 +47,7 @@ Systems to be supported (hardware testing bugs not yet fixed): MacOS、FreeBSD
### one-click command ### one-click command
``` ```
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 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
``` ```
### explain in detail ### explain in detail
@@ -64,6 +64,8 @@ Install environment
./goecs.sh env ./goecs.sh env
``` ```
If you don't want interaction, use ```export noninteractive=true``` and then execute the ```env``` command
Install goecs Install goecs
``` ```
@@ -87,18 +89,28 @@ Explanation of the shell script
``` ```
Available commands: Available commands:
./goecs.sh env Check and Install package: ./goecs.sh env Check and Install dependencies
sudo (Almost all unix-like systems have it.) Warning: This command performs system update(optional), which may:
tar (Almost all unix-like systems have it.) 1. Take considerable time
unzip (Almost all unix-like systems have it.) 2. Cause temporary network interruptions
dd (Almost all unix-like systems have it.) 3. Impact system stability
fio (Almost all unix-like systems can be installed through the system's package manager.) 4. Affect subsequent system startups
sysbench (Almost all unix-like systems can be installed through the system's package manager.) For systems with less than 1GB RAM, additional risks:
geekbench (geekbench5)(Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.) 1. System freeze
speedtest (Use the officially provided binaries for more accurate test results.) 2. SSH connection loss
ping (Use the officially provided binaries for more accurate test results.) 3. Critical service failures
systemd-detect-virt OR dmidecode (Almost all unix-like systems have it, for more accurate test results.) Recommended:
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested. Hanging execution during environment dependency installation
Required components:
sysbench/geekbench (Required for CPU testing)
Optional components:
sudo, tar, unzip, dd, fio
speedtest (Network testing)
ping (Network connectivity)
systemd-detect-virt/dmidecode (System info detection)
./goecs.sh install Install goecs command ./goecs.sh install Install goecs command
./goecs.sh upgrade Upgrade goecs command ./goecs.sh upgrade Upgrade goecs command
./goecs.sh uninstall Uninstall goecs command ./goecs.sh uninstall Uninstall goecs command
@@ -108,13 +120,13 @@ Available commands:
Invoke the goecs menu Invoke the goecs menu
``` ```
goecs goecs -l en
``` ```
or or
``` ```
./goecs ./goecs -l en
``` ```
Parameterized goecs command Parameterized goecs command
@@ -151,7 +163,7 @@ Usage: goecs [options]
-memory -memory
Enable/Disable memory test (default true) Enable/Disable memory test (default true)
-memorym string -memorym string
Set memory test method (supported: sysbench, dd, winsat) (default "dd") Set memory test method (supported: sysbench, dd, winsat) (default "sysbench")
-menu -menu
Enable/Disable menu mode, disable example: -menu=false (default true) Enable/Disable menu mode, disable example: -menu=false (default true)
-nt3 -nt3
@@ -183,4 +195,26 @@ Find the latest version, download the .zip file corresponding to your architectu
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. 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.
No environment installation is required for Windows testing. No environment installation is required for Windows testing.
## Instructions for Use in Docker
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
```shell
docker run --rm --privileged --network host spiritlhl/goecs:latest -menu=false -l en
```
Unprivileged mode + non-host network
```shell
docker run --rm spiritlhl/goecs:latest
```
Using Docker to execute tests, hardware testing will have some bias and virtualization architecture to determine the failure.
Recommended direct testing without using Docker testing.

View File

@@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
// 本包不在main中使用仅做测试使用 // 本包不在main中使用仅做测试使用,真正调用的在 utils 中的 BasicsAndSecurityCheck
func Basic(language string) { func Basic(language string) {
ipInfo, _, _ := network.NetworkCheck("both", false, language) ipInfo, _, _ := network.NetworkCheck("both", false, language)
systemInfo := system.CheckSystemInfo(language) systemInfo := system.CheckSystemInfo(language)

0
go
View File

37
go.mod
View File

@@ -5,19 +5,19 @@ go 1.22.4
require ( require (
github.com/imroc/req/v3 v3.43.7 github.com/imroc/req/v3 v3.43.7
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502 github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502
github.com/oneclickvirt/UnlockTests v0.0.13-20240728133802 github.com/oneclickvirt/UnlockTests v0.0.20-20241207132231
github.com/oneclickvirt/backtrace v0.0.4-20240702140722 github.com/oneclickvirt/backtrace v0.0.4-20240702140722
github.com/oneclickvirt/basics v0.0.7-20240729065559 github.com/oneclickvirt/basics v0.0.8-20241108124433
github.com/oneclickvirt/cputest v0.0.8-20240702070215 github.com/oneclickvirt/cputest v0.0.8-20240702070215
github.com/oneclickvirt/defaultset v0.0.2-20240624082446 github.com/oneclickvirt/defaultset v0.0.2-20240624082446
github.com/oneclickvirt/disktest v0.0.4-20240730100055 github.com/oneclickvirt/disktest v0.0.4-20240809053456
github.com/oneclickvirt/gostun v0.0.3-20240702054621 github.com/oneclickvirt/gostun v0.0.3-20240702054621
github.com/oneclickvirt/memorytest v0.0.3-20240730095857 github.com/oneclickvirt/memorytest v0.0.4-20240820095126
github.com/oneclickvirt/nt3 v0.0.3-20240702132013 github.com/oneclickvirt/nt3 v0.0.3-20240809100110
github.com/oneclickvirt/pingtest v0.0.4-20240703142340 github.com/oneclickvirt/pingtest v0.0.5-20241006123443
github.com/oneclickvirt/portchecker v0.0.1-20240624155429 github.com/oneclickvirt/portchecker v0.0.2-20240803151204
github.com/oneclickvirt/security v0.0.4-20240729065854 github.com/oneclickvirt/security v0.0.4-20240729065854
github.com/oneclickvirt/speedtest v0.0.7-20240704023701 github.com/oneclickvirt/speedtest v0.0.8-20241005164804
) )
require ( require (
@@ -34,7 +34,8 @@ require (
github.com/gofrs/uuid/v5 v5.2.0 // indirect github.com/gofrs/uuid/v5 v5.2.0 // indirect
github.com/google/gopacket v1.1.19 // indirect github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 // indirect github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
@@ -53,14 +54,15 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/miekg/dns v1.1.61 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxtrace/NTrace-core v1.3.1 // indirect github.com/nxtrace/NTrace-core v1.3.2 // indirect
github.com/onsi/ginkgo/v2 v2.19.0 // indirect github.com/onsi/ginkgo/v2 v2.19.0 // indirect
github.com/oschwald/maxminddb-golang v1.12.0 // indirect github.com/oschwald/maxminddb-golang v1.13.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pion/dtls/v2 v2.2.7 // indirect github.com/pion/dtls/v2 v2.2.7 // indirect
github.com/pion/logging v0.2.2 // indirect github.com/pion/logging v0.2.2 // indirect
@@ -69,12 +71,13 @@ require (
github.com/pion/transport/v3 v3.0.1 // indirect github.com/pion/transport/v3 v3.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus-community/pro-bing v0.4.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.45.1 // indirect github.com/quic-go/quic-go v0.45.1 // indirect
github.com/refraction-networking/utls v1.6.6 // indirect github.com/refraction-networking/utls v1.6.6 // indirect
github.com/rivo/uniseg v0.4.7 // indirect github.com/rivo/uniseg v0.4.7 // indirect
github.com/rodaine/table v1.2.0 // indirect github.com/rodaine/table v1.2.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/schollz/progressbar/v3 v3.14.4 // indirect github.com/schollz/progressbar/v3 v3.14.4 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect
@@ -85,7 +88,7 @@ require (
github.com/spf13/afero v1.11.0 // indirect github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.18.2 // indirect github.com/spf13/viper v1.19.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/gjson v1.17.1 // indirect github.com/tidwall/gjson v1.17.1 // indirect
github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/match v1.1.1 // indirect
@@ -97,13 +100,13 @@ require (
go.uber.org/mock v0.4.0 // indirect go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.24.0 // indirect golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/mod v0.18.0 // indirect golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.26.0 // indirect golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.21.0 // indirect golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.22.0 // indirect golang.org/x/tools v0.22.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect

76
go.sum
View File

@@ -37,8 +37,10 @@ github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 h1:e+8XbKB6IMn8A4OAyZccO4pYfB3s7bt6azNIPE7AnPg= github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 h1:e+8XbKB6IMn8A4OAyZccO4pYfB3s7bt6azNIPE7AnPg=
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.2 h1:qoW6V1GT3aZxybsbC6oLnailWnB+qTMVwMreOso9XUw=
github.com/gorilla/websocket v1.5.2/go.mod h1:0n9H61RBAcf5/38py2MCYbxzPIY9rOkpvvMT24Rqs30=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -85,6 +87,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
@@ -96,44 +100,42 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nxtrace/NTrace-core v1.3.1 h1:f4z5UaZEuhUP/g6xElpZ2bo+guWITJVrMKrJTqd27oc= github.com/nxtrace/NTrace-core v1.3.2 h1:8aU/IQFmPnwbaWGVBIJHwwVIWk+roo+9+lG+U0OFZ+o=
github.com/nxtrace/NTrace-core v1.3.1/go.mod h1:0Px/Zc60qk6cssmP+yv4kstFxvX9sXqDduoVqBO+qf8= github.com/nxtrace/NTrace-core v1.3.2/go.mod h1:qCVsgSs982jw02BVjTtN8mjSg5OIXW9TaUdISQrMnTw=
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502 h1:hRIYJ2uEp2N3AH5bP5X6bwfdwWfZQO/2WoqpUJ8+WsY= 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/CommonMediaTests v0.0.4-20240704024502/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
github.com/oneclickvirt/UnlockTests v0.0.13-20240728133802 h1:oh75eNsAkIe4pjoxJtxc5+inYXIDycTucT3CKSYx1Vg= github.com/oneclickvirt/UnlockTests v0.0.20-20241207132231 h1:GS84R/LZL5oOaVIYHkivSrYcAHxRGY/CNJpyAdEwwJk=
github.com/oneclickvirt/UnlockTests v0.0.13-20240728133802/go.mod h1:HP3CvAS+AJWxxY+BVbxIOlvaQ87YOSge89vAMG52b5o= github.com/oneclickvirt/UnlockTests v0.0.20-20241207132231/go.mod h1:UELwZDDiddSxe38boYOPl1FlrL0ptEZYSQwdE3MYvUM=
github.com/oneclickvirt/backtrace v0.0.4-20240702140722 h1:UJ/VWf+ZbhGarc9HcHMIyenpmX+b2LxkXu0hlLk3Gxs= github.com/oneclickvirt/backtrace v0.0.4-20240702140722 h1:UJ/VWf+ZbhGarc9HcHMIyenpmX+b2LxkXu0hlLk3Gxs=
github.com/oneclickvirt/backtrace v0.0.4-20240702140722/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8= github.com/oneclickvirt/backtrace v0.0.4-20240702140722/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8=
github.com/oneclickvirt/basics v0.0.7-20240729065559 h1:BNMPuW+ZT9RqqIjEQJ+r+lRX6iESnhmOE6dVWEd5Jqg= github.com/oneclickvirt/basics v0.0.8-20241108124433 h1:eKZcoNoa9uLWmfisk+qN/QOvSGT4ajCmZdZfIAcHG+o=
github.com/oneclickvirt/basics v0.0.7-20240729065559/go.mod h1:fUdVpU8gdjaZsTCyqnQBAbHc9BbbN8Fxr3sGPKooUpU= github.com/oneclickvirt/basics v0.0.8-20241108124433/go.mod h1:fUdVpU8gdjaZsTCyqnQBAbHc9BbbN8Fxr3sGPKooUpU=
github.com/oneclickvirt/cputest v0.0.8-20240702070215 h1:CcFpyVPlQkJ6vjFP17BRuJhh/afiJhOhZ0BW+TtfVDg= github.com/oneclickvirt/cputest v0.0.8-20240702070215 h1:CcFpyVPlQkJ6vjFP17BRuJhh/afiJhOhZ0BW+TtfVDg=
github.com/oneclickvirt/cputest v0.0.8-20240702070215/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY= github.com/oneclickvirt/cputest v0.0.8-20240702070215/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
github.com/oneclickvirt/defaultset v0.0.2-20240624082446 h1:5Pg3mK/u/vQvSz7anu0nxzrNdELi/AcDAU1mMsmPzyc= github.com/oneclickvirt/defaultset v0.0.2-20240624082446 h1:5Pg3mK/u/vQvSz7anu0nxzrNdELi/AcDAU1mMsmPzyc=
github.com/oneclickvirt/defaultset v0.0.2-20240624082446/go.mod h1:e9Jt4tf2sbemCtc84/XgKcHy9EZ2jkc5x2sW1NiJS+E= github.com/oneclickvirt/defaultset v0.0.2-20240624082446/go.mod h1:e9Jt4tf2sbemCtc84/XgKcHy9EZ2jkc5x2sW1NiJS+E=
github.com/oneclickvirt/disktest v0.0.4-20240704095213 h1:ATIc0VeFBnYvfKjJCtDZS6hTxTU9nTFvUmfzGkr6Clw= github.com/oneclickvirt/disktest v0.0.4-20240809053456 h1:g6fKzvImIV8YQZKKEJ2FdvooL+EUf9NndAU8c4aGCX4=
github.com/oneclickvirt/disktest v0.0.4-20240704095213/go.mod h1:wIZy8G6Mbcy8Op8tc0HmJNpbJQQ5A15fvnUqMJXIdO0= github.com/oneclickvirt/disktest v0.0.4-20240809053456/go.mod h1:wIZy8G6Mbcy8Op8tc0HmJNpbJQQ5A15fvnUqMJXIdO0=
github.com/oneclickvirt/disktest v0.0.4-20240730100055 h1:3if6RkcgOuZQ0TpgHJJp/XMlTFVV7Ge2eqbQtWS0A/k=
github.com/oneclickvirt/disktest v0.0.4-20240730100055/go.mod h1:wIZy8G6Mbcy8Op8tc0HmJNpbJQQ5A15fvnUqMJXIdO0=
github.com/oneclickvirt/gostun v0.0.3-20240702054621 h1:IE89eEYV9TJbF94SakQDAxTLIaqX+Tb6ZhJ/CCIP+90= github.com/oneclickvirt/gostun v0.0.3-20240702054621 h1:IE89eEYV9TJbF94SakQDAxTLIaqX+Tb6ZhJ/CCIP+90=
github.com/oneclickvirt/gostun v0.0.3-20240702054621/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA= github.com/oneclickvirt/gostun v0.0.3-20240702054621/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
github.com/oneclickvirt/memorytest v0.0.3-20240730095857 h1:5b0gaCfWSUrSkvR1InHt8y318Hxk5bGtRl+r6oW1xPg= github.com/oneclickvirt/memorytest v0.0.4-20240820095126 h1:Il3rvWkrZy/6B2iO3HRe9039/qRllA4CzcZ/dI8aG2A=
github.com/oneclickvirt/memorytest v0.0.3-20240730095857/go.mod h1:+YNzy+NeVg61d0kNwSyVDqHyVtKzjuRe1NvMzsDLg0I= github.com/oneclickvirt/memorytest v0.0.4-20240820095126/go.mod h1:+YNzy+NeVg61d0kNwSyVDqHyVtKzjuRe1NvMzsDLg0I=
github.com/oneclickvirt/nt3 v0.0.3-20240702132013 h1:zPI/zqqCraIVwRnYz07hMkBKDRJVkEBb6gZpZ4M9CjI= github.com/oneclickvirt/nt3 v0.0.3-20240809100110 h1:UyF0jBDP0xpxSV9L/GYG83SKUMPSjHPru+3iPZHYG7U=
github.com/oneclickvirt/nt3 v0.0.3-20240702132013/go.mod h1:UojPmtangn17TiQaDccVrZbn6sZwJOtzBgg3idp68cA= github.com/oneclickvirt/nt3 v0.0.3-20240809100110/go.mod h1:4SDl5o83wbixk9YJqvG0eNo2w8aWt/QgntfPBi9wEpY=
github.com/oneclickvirt/pingtest v0.0.4-20240703142340 h1:012W8Ly6ALISwIL5cYFM8O1ZLSc9l+Z2hHUCscMemms= github.com/oneclickvirt/pingtest v0.0.5-20241006123443 h1:Ywrh0Yd/PYXOKGE8VaNiKGWlIqdgLLgsthAzxy0t7s8=
github.com/oneclickvirt/pingtest v0.0.4-20240703142340/go.mod h1:IU9RzZpS5tfP2kcFd2sw2fE80BgtiMUK8jp6qnN/0cY= github.com/oneclickvirt/pingtest v0.0.5-20241006123443/go.mod h1:d3Ntx5m9lMll3a/k3+2B+5emj//vgDh4/NHTxs2qQE8=
github.com/oneclickvirt/portchecker v0.0.1-20240624155429 h1:+wapaOcFrg1iWJDhBKThDzppyIMY7hWxK7F5RBkZg4o= github.com/oneclickvirt/portchecker v0.0.2-20240803151204 h1:ZruxRgyIv3d6Y8n0Ney5FHhQtcQLxCvs+xJmGsh9/7E=
github.com/oneclickvirt/portchecker v0.0.1-20240624155429/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k= github.com/oneclickvirt/portchecker v0.0.2-20240803151204/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
github.com/oneclickvirt/security v0.0.4-20240729065854 h1:I27XtMUEHmXw1RN0jNDQmFqNdu6vL4v1g8UZtXiCuBY= 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/security v0.0.4-20240729065854/go.mod h1:384ZpNE3H6T6rtl0QhA4eQn8xGw7tc0rLD8ZH47qNGc=
github.com/oneclickvirt/speedtest v0.0.7-20240704023701 h1:F8ChZXf3U1/bUk+dCFt0Gc01LSPLhbBhCeHjkEJ6K88= github.com/oneclickvirt/speedtest v0.0.8-20241005164804 h1:qguczGucxyRCRaeI2Av7+QpgYb6o8lTJJmOjPkmGiSg=
github.com/oneclickvirt/speedtest v0.0.7-20240704023701/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI= github.com/oneclickvirt/speedtest v0.0.8-20241005164804/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
github.com/oschwald/maxminddb-golang v1.12.0 h1:9FnTOD0YOhP7DGxGsq4glzpGy5+w7pq50AS6wALUMYs= github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE=
github.com/oschwald/maxminddb-golang v1.12.0/go.mod h1:q0Nob5lTCqyQ8WT6FYgS1L7PXKVVbgiymefNwIjPzgY= github.com/oschwald/maxminddb-golang v1.13.1/go.mod h1:K4pgV9N/GcK694KSTmVSDTODk4IsCNThNdTmnaBZ/F8=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8= github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8=
@@ -153,6 +155,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/prometheus-community/pro-bing v0.4.1 h1:aMaJwyifHZO0y+h8+icUz0xbToHbia0wdmzdVZ+Kl3w=
github.com/prometheus-community/pro-bing v0.4.1/go.mod h1:aLsw+zqCaDoa2RLVVSX3+UiCkBBXTMtZC3c7EkfWnAE=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/quic-go v0.45.1 h1:tPfeYCk+uZHjmDRwHHQmvHRYL2t44ROTujLeFVBmjCA= github.com/quic-go/quic-go v0.45.1 h1:tPfeYCk+uZHjmDRwHHQmvHRYL2t44ROTujLeFVBmjCA=
@@ -166,8 +170,8 @@ github.com/rodaine/table v1.2.0 h1:38HEnwK4mKSHQJIkavVj+bst1TEY7j9zhLMWu4QJrMA=
github.com/rodaine/table v1.2.0/go.mod h1:wejb/q/Yd4T/SVmBSRMr7GCq3KlcZp3gyNYdLSBhkaE= github.com/rodaine/table v1.2.0/go.mod h1:wejb/q/Yd4T/SVmBSRMr7GCq3KlcZp3gyNYdLSBhkaE=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk=
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74= github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74=
@@ -190,8 +194,8 @@ github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -234,8 +238,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
@@ -252,8 +256,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -275,8 +279,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.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.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.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-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.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -284,8 +288,8 @@ golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=

285
goecs.go
View File

@@ -2,6 +2,7 @@ package main
import ( import (
"bufio" "bufio"
"context"
"flag" "flag"
"fmt" "fmt"
"github.com/oneclickvirt/CommonMediaTests/commediatests" "github.com/oneclickvirt/CommonMediaTests/commediatests"
@@ -38,7 +39,7 @@ import (
) )
var ( var (
ecsVersion = "v0.0.59" ecsVersion = "v0.0.87"
menuMode bool menuMode bool
onlyChinaTest bool onlyChinaTest bool
input, choice string input, choice string
@@ -60,8 +61,67 @@ var (
enabelUpload = true enabelUpload = true
help bool help bool
goecsFlag = flag.NewFlagSet("goecs", flag.ContinueOnError) goecsFlag = flag.NewFlagSet("goecs", flag.ContinueOnError)
finish bool
) )
func getMenuChoice(language string) string {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
defer signal.Stop(sigChan)
inputChan := make(chan string, 1)
go func() {
select {
case <-sigChan:
fmt.Println("\n程序在选择过程中被用户中断")
os.Exit(0)
case <-ctx.Done():
return
}
}()
for {
go func() {
var input string
fmt.Print("请输入选项 / Please enter your choice: ")
fmt.Scanln(&input)
input = strings.TrimSpace(input)
input = strings.TrimRight(input, "\n")
select {
case inputChan <- input:
case <-ctx.Done():
return
}
}()
select {
case input := <-inputChan:
re := regexp.MustCompile(`^\d+$`) // 正则表达式匹配纯数字
if re.MatchString(input) {
inChoice := input
switch inChoice {
case "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
return inChoice
default:
if language == "zh" {
fmt.Println("无效的选项")
} else {
fmt.Println("Invalid choice")
}
}
} else {
if language == "zh" {
fmt.Println("输入错误,请输入一个纯数字")
} else {
fmt.Println("Invalid input, please enter a number")
}
}
case <-ctx.Done():
return ""
}
}
}
func main() { func main() {
goecsFlag.BoolVar(&help, "h", false, "Show help information") goecsFlag.BoolVar(&help, "h", false, "Show help information")
goecsFlag.BoolVar(&showVersion, "v", false, "Display version information") goecsFlag.BoolVar(&showVersion, "v", false, "Display version information")
@@ -80,7 +140,7 @@ func main() {
goecsFlag.BoolVar(&speedTestStatus, "speed", true, "Enable/Disable speed test") goecsFlag.BoolVar(&speedTestStatus, "speed", true, "Enable/Disable speed test")
goecsFlag.StringVar(&cpuTestMethod, "cpum", "sysbench", "Set CPU test method (supported: sysbench, geekbench, winsat)") goecsFlag.StringVar(&cpuTestMethod, "cpum", "sysbench", "Set CPU test method (supported: sysbench, geekbench, winsat)")
goecsFlag.StringVar(&cpuTestThreadMode, "cput", "multi", "Set CPU test thread mode (supported: single, multi)") goecsFlag.StringVar(&cpuTestThreadMode, "cput", "multi", "Set CPU test thread mode (supported: single, multi)")
goecsFlag.StringVar(&memoryTestMethod, "memorym", "dd", "Set memory test method (supported: sysbench, dd, winsat)") goecsFlag.StringVar(&memoryTestMethod, "memorym", "sysbench", "Set memory test method (supported: sysbench, dd, winsat)")
goecsFlag.StringVar(&diskTestMethod, "diskm", "fio", "Set disk test method (supported: fio, dd, winsat)") goecsFlag.StringVar(&diskTestMethod, "diskm", "fio", "Set disk test method (supported: fio, dd, winsat)")
goecsFlag.StringVar(&diskTestPath, "diskp", "", "Set disk test path, e.g., -diskp /root") goecsFlag.StringVar(&diskTestPath, "diskp", "", "Set disk test path, e.g., -diskp /root")
goecsFlag.BoolVar(&diskMultiCheck, "diskmc", false, "Enable/Disable multiple disk checks, e.g., -diskmc=false") goecsFlag.BoolVar(&diskMultiCheck, "diskmc", false, "Enable/Disable multiple disk checks, e.g., -diskmc=false")
@@ -95,8 +155,6 @@ func main() {
goecsFlag.PrintDefaults() goecsFlag.PrintDefaults()
return return
} }
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
if showVersion { if showVersion {
fmt.Println(ecsVersion) fmt.Println(ecsVersion)
return return
@@ -149,103 +207,90 @@ func main() {
} }
Loop: Loop:
for { for {
fmt.Print("请输入选项 / Please enter your choice: ") choice = getMenuChoice(language)
fmt.Scanln(&input) switch choice {
input = strings.TrimSpace(input) case "1":
input = strings.TrimRight(input, "\n") basicStatus = true
re := regexp.MustCompile(`^\d+$`) // 正则表达式匹配纯数字 cpuTestStatus = true
if re.MatchString(input) { memoryTestStatus = true
choice = input diskTestStatus = true
switch choice { commTestStatus = true
case "1": utTestStatus = true
basicStatus = true securityTestStatus = true
cpuTestStatus = true emailTestStatus = true
memoryTestStatus = true backtraceStatus = true
diskTestStatus = true nt3Status = true
commTestStatus = true speedTestStatus = true
utTestStatus = true onlyChinaTest = utils.CheckChina(enableLogger)
securityTestStatus = true break Loop
emailTestStatus = true case "2":
backtraceStatus = true basicStatus = true
nt3Status = true cpuTestStatus = true
speedTestStatus = true memoryTestStatus = true
onlyChinaTest = utils.CheckChina(enableLogger) diskTestStatus = true
break Loop speedTestStatus = true
case "2": break Loop
basicStatus = true case "3":
cpuTestStatus = true basicStatus = true
memoryTestStatus = true cpuTestStatus = true
diskTestStatus = true memoryTestStatus = true
speedTestStatus = true diskTestStatus = true
break Loop utTestStatus = true
case "3": nt3Status = true
basicStatus = true speedTestStatus = true
cpuTestStatus = true break Loop
memoryTestStatus = true case "4":
diskTestStatus = true basicStatus = true
utTestStatus = true cpuTestStatus = true
nt3Status = true memoryTestStatus = true
speedTestStatus = true diskTestStatus = true
break Loop backtraceStatus = true
case "4": nt3Status = true
basicStatus = true speedTestStatus = true
cpuTestStatus = true break Loop
memoryTestStatus = true case "5":
diskTestStatus = true basicStatus = true
backtraceStatus = true cpuTestStatus = true
nt3Status = true memoryTestStatus = true
speedTestStatus = true diskTestStatus = true
break Loop commTestStatus = true
case "5": utTestStatus = true
basicStatus = true speedTestStatus = true
cpuTestStatus = true break Loop
memoryTestStatus = true case "6":
diskTestStatus = true securityTestStatus = true
commTestStatus = true speedTestStatus = true
utTestStatus = true backtraceStatus = true
speedTestStatus = true nt3Status = true
break Loop break Loop
case "6": case "7":
securityTestStatus = true commTestStatus = true
speedTestStatus = true utTestStatus = true
backtraceStatus = true enabelUpload = false
nt3Status = true break Loop
break Loop case "8":
case "7": basicStatus = true
commTestStatus = true cpuTestStatus = true
utTestStatus = true memoryTestStatus = true
enabelUpload = false diskTestStatus = true
break Loop securityTestStatus = false
case "8": autoChangeDiskTestMethod = false
basicStatus = true break Loop
cpuTestStatus = true case "9":
memoryTestStatus = true securityTestStatus = true
diskTestStatus = true emailTestStatus = true
securityTestStatus = false break Loop
autoChangeDiskTestMethod = false case "10":
break Loop backtraceStatus = true
case "9": nt3Status = true
securityTestStatus = true pingTestStatus = true
emailTestStatus = true enabelUpload = false
break Loop break Loop
case "10": default:
backtraceStatus = true
nt3Status = true
pingTestStatus = true
enabelUpload = false
break Loop
default:
if language == "zh" {
fmt.Println("无效的选项")
} else {
fmt.Println("Invalid choice")
}
}
} else {
if language == "zh" { if language == "zh" {
fmt.Println("输入错误,请输入一个纯数字") fmt.Println("无效的选项")
} else { } else {
fmt.Println("Invalid input, please enter a number") fmt.Println("Invalid choice")
} }
} }
} }
@@ -263,24 +308,29 @@ func main() {
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
output, tempOutput string output, tempOutput string
) )
// 设置主程序的信号处理
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
// 启动一个goroutine来等待信号内置计时器 // 启动一个goroutine来等待信号内置计时器
go func() { go func() {
startTime = time.Now() startTime = time.Now()
// 等待信号 // 等待信号
<-sig <-sig
endTime := time.Now() if !finish {
duration := endTime.Sub(startTime) endTime := time.Now()
minutes := int(duration.Minutes()) duration := endTime.Sub(startTime)
seconds := int(duration.Seconds()) % 60 minutes := int(duration.Minutes())
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006") seconds := int(duration.Seconds()) % 60
output = utils.PrintAndCapture(func() { currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
utils.PrintCenteredTitle("", width) output = utils.PrintAndCapture(func() {
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds) utils.PrintCenteredTitle("", width)
fmt.Printf("Current Time : %s\n", currentTime) fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
utils.PrintCenteredTitle("", width) fmt.Printf("Current Time : %s\n", currentTime)
}, tempOutput, output) utils.PrintCenteredTitle("", width)
utils.ProcessAndUpload(output, filePath, enabelUpload) }, tempOutput, output)
os.Exit(1) // 使用非零状态码退出,表示意外退出 utils.ProcessAndUpload(output, filePath, enabelUpload)
}
os.Exit(0)
}() }()
switch language { switch language {
case "zh": case "zh":
@@ -290,7 +340,7 @@ func main() {
if basicStatus { if basicStatus {
utils.PrintCenteredTitle("系统基础信息", width) utils.PrintCenteredTitle("系统基础信息", width)
} }
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus) basicInfo, securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus)
if basicStatus { if basicStatus {
fmt.Printf(basicInfo) fmt.Printf(basicInfo)
} else if (input == "6" || input == "9") && securityTestStatus { } else if (input == "6" || input == "9") && securityTestStatus {
@@ -400,14 +450,16 @@ func main() {
if speedTestStatus { if speedTestStatus {
utils.PrintCenteredTitle("就近节点测速", width) utils.PrintCenteredTitle("就近节点测速", width)
speedtest.ShowHead(language) speedtest.ShowHead(language)
if (menuMode && choice == "1") || !menuMode { if choice == "1" || !menuMode {
speedtest.NearbySP() speedtest.NearbySP()
speedtest.CustomSP("net", "global", 2, language) speedtest.CustomSP("net", "global", 2, language)
speedtest.CustomSP("net", "cu", spNum, language) speedtest.CustomSP("net", "cu", spNum, language)
speedtest.CustomSP("net", "ct", spNum, language) speedtest.CustomSP("net", "ct", spNum, language)
speedtest.CustomSP("net", "cmcc", spNum, language) speedtest.CustomSP("net", "cmcc", spNum, language)
} else if menuMode && choice == "2" || choice == "3" || choice == "4" || choice == "5" { } else if choice == "2" || choice == "3" || choice == "4" || choice == "5" {
speedtest.CustomSP("net", "global", 4, language) speedtest.CustomSP("net", "global", 4, language)
} else if choice == "6" {
speedtest.CustomSP("net", "global", 11, language)
} }
} }
}, tempOutput, output) }, tempOutput, output)
@@ -429,7 +481,7 @@ func main() {
if basicStatus { if basicStatus {
utils.PrintCenteredTitle("System-Basic-Information", width) utils.PrintCenteredTitle("System-Basic-Information", width)
} }
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus) basicInfo, securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus)
if basicStatus { if basicStatus {
fmt.Printf(basicInfo) fmt.Printf(basicInfo)
} else if (input == "6" || input == "9") && securityTestStatus { } else if (input == "6" || input == "9") && securityTestStatus {
@@ -523,6 +575,7 @@ func main() {
fmt.Println("Unsupported language") fmt.Println("Unsupported language")
} }
utils.ProcessAndUpload(output, filePath, enabelUpload) utils.ProcessAndUpload(output, filePath, enabelUpload)
finish = true
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
fmt.Println("Press Enter to exit...") fmt.Println("Press Enter to exit...")
fmt.Scanln() fmt.Scanln()

410
goecs.sh
View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
#From https://github.com/oneclickvirt/ecs # From https://github.com/oneclickvirt/ecs
#2024.07.21 # 2024.11.18
# curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh # curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
@@ -24,6 +24,7 @@ _red() { echo -e "\033[31m\033[01m$@\033[0m"; }
_green() { echo -e "\033[32m\033[01m$@\033[0m"; } _green() { echo -e "\033[32m\033[01m$@\033[0m"; }
_yellow() { echo -e "\033[33m\033[01m$@\033[0m"; } _yellow() { echo -e "\033[33m\033[01m$@\033[0m"; }
_blue() { echo -e "\033[36m\033[01m$@\033[0m"; } _blue() { echo -e "\033[36m\033[01m$@\033[0m"; }
reading() { read -rp "$(_green "$1")" "$2"; }
check_cdn() { check_cdn() {
local o_url=$1 local o_url=$1
@@ -40,12 +41,51 @@ check_cdn() {
check_cdn_file() { check_cdn_file() {
check_cdn "https://raw.githubusercontent.com/spiritLHLS/ecs/main/back/test" check_cdn "https://raw.githubusercontent.com/spiritLHLS/ecs/main/back/test"
if [ -n "$cdn_success_url" ]; then if [ -n "$cdn_success_url" ]; then
echo "CDN available, using CDN" _green "CDN available, using CDN"
else else
echo "No CDN available, no use CDN" _yellow "No CDN available, no use CDN"
fi fi
} }
download_file() {
local url="$1"
local output="$2"
if ! wget -O "$output" "$url"; then
_yellow "wget failed, trying curl..."
if ! curl -L -o "$output" "$url"; then
_red "Both wget and curl failed. Unable to download the file."
return 1
fi
fi
return 0
}
get_memory_size() {
if [ -f /proc/meminfo ]; then
local mem_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
echo $((mem_kb / 1024)) # Convert to MB
return
fi
if command -v free >/dev/null 2>&1; then
local mem_kb=$(free -m | awk '/^Mem:/ {print $2}')
echo "$mem_kb" # Already in MB
return
fi
if command -v sysctl >/dev/null 2>&1; then
local mem_bytes=$(sysctl -n hw.memsize 2>/dev/null || sysctl -n hw.physmem 2>/dev/null)
if [ -n "$mem_bytes" ]; then
echo $((mem_bytes / 1024 / 1024)) # Convert to MB
return
fi
fi
}
cleanup_epel() {
_yellow "Cleaning up EPEL repositories..."
rm -f /etc/yum.repos.d/*epel*
yum clean all
}
goecs_check() { goecs_check() {
os=$(uname -s) os=$(uname -s)
arch=$(uname -m) arch=$(uname -m)
@@ -65,74 +105,87 @@ goecs_check() {
if [ -n "$extracted_version" ]; then if [ -n "$extracted_version" ]; then
ecs_version=$ECS_VERSION ecs_version=$ECS_VERSION
if [[ "$(echo -e "$extracted_version\n$ecs_version" | sort -V | tail -n 1)" == "$extracted_version" ]]; then if [[ "$(echo -e "$extracted_version\n$ecs_version" | sort -V | tail -n 1)" == "$extracted_version" ]]; then
echo "goecs version ($extracted_version) is latest, no need to upgrade." _green "goecs version ($extracted_version) is latest, no need to upgrade."
return return
else else
echo "goecs version ($extracted_version) < $ecs_version, need to upgrade, 5 seconds later will start to upgrade" _yellow "goecs version ($extracted_version) < $ecs_version, need to upgrade, 5 seconds later will start to upgrade"
rm -rf /usr/bin/goecs rm -rf /usr/bin/goecs
rm -rf goecs rm -rf goecs
fi fi
fi fi
else else
echo "Can not find goecs, need to download and install, 5 seconds later will start to install" _green "Can not find goecs, need to download and install, 5 seconds later will start to install"
fi fi
sleep 5 sleep 5
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/") cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
check_cdn_file check_cdn_file
case $os in case $os in
Linux) Linux)
case $arch in
"x86_64" | "x86" | "amd64" | "x64")
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_amd64.zip"
;;
"i386" | "i686")
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_386.zip"
;;
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_arm64.zip"
;;
*)
echo "Unsupported architecture: $arch"
exit 1
;;
esac
;;
FreeBSD)
case $arch in case $arch in
"x86_64" | "x86" | "amd64" | "x64") "x86_64" | "x86" | "amd64" | "x64")
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_amd64.zip" download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_amd64.zip" "goecs.zip"
;; ;;
"i386" | "i686") "i386" | "i686")
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_386.zip" download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_386.zip" "goecs.zip"
;; ;;
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_arm64.zip" download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_arm64.zip" "goecs.zip"
;;
"mips")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mips.zip" "goecs.zip"
;;
"mipsle")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mipsle.zip" "goecs.zip"
;;
"s390x")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_s390x.zip" "goecs.zip"
;;
"riscv64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_riscv64.zip" "goecs.zip"
;; ;;
*) *)
echo "Unsupported architecture: $arch" _red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
exit 1 exit 1
;; ;;
esac esac
;; ;;
Darwin) FreeBSD)
case $arch in case $arch in
"x86_64" | "x86" | "amd64" | "x64") "x86_64" | "x86" | "amd64" | "x64")
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_amd64.zip" download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_amd64.zip" "goecs.zip"
;;
"i386" | "i686")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_386.zip" "goecs.zip"
;;
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_arm64.zip" "goecs.zip"
;;
*)
_red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
exit 1
;;
esac
;; ;;
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") Darwin)
wget -O goecs.zip "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_arm64.zip" case $arch in
"x86_64" | "x86" | "amd64" | "x64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_amd64.zip" "goecs.zip"
;;
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ ecs/releases/download/v${ECS_VERSION}/goecs_arm64.zip" "goecs.zip"
;;
*)
_red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
exit 1
;;
esac
;; ;;
*) *)
echo "Unsupported architecture: $arch" _red "Unsupported operating system: $os , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
exit 1 exit 1
;; ;;
esac
;;
*)
echo "Unsupported operating system: $os"
exit 1
;;
esac esac
unzip goecs.zip unzip goecs.zip
rm -rf goecs.zip rm -rf goecs.zip
rm -rf README.md rm -rf README.md
@@ -144,12 +197,27 @@ goecs_check() {
cp goecs /usr/bin/goecs cp goecs /usr/bin/goecs
rm -rf README_EN.md rm -rf README_EN.md
rm -rf README.md rm -rf README.md
PARAM="net.ipv4.ping_group_range"
NEW_VALUE="0 2147483647"
CURRENT_VALUE=$(sysctl -n "$PARAM" 2>/dev/null)
if [ -f /etc/sysctl.conf ] && [ "$CURRENT_VALUE" != "$NEW_VALUE" ]; then
if grep -q "^$PARAM" /etc/sysctl.conf; then
sudo sed -i "s/^$PARAM.*/$PARAM = $NEW_VALUE/" /etc/sysctl.conf
else
echo "$PARAM = $NEW_VALUE" | sudo tee -a /etc/sysctl.conf
fi
sudo sysctl -p
fi
setcap cap_net_raw=+ep goecs
setcap cap_net_raw=+ep /usr/bin/goecs
echo "goecs version:" echo "goecs version:"
goecs -v || ./goecs -v goecs -v || ./goecs -v
} }
InstallSysbench() { InstallSysbench() {
if [ -f "/etc/centos-release" ]; then # CentOS if [ -f "/etc/opencloudos-release" ]; then # OpenCloudOS
Var_OSRelease="opencloudos"
elif [ -f "/etc/centos-release" ]; then # CentOS
Var_OSRelease="centos" Var_OSRelease="centos"
elif [ -f "/etc/fedora-release" ]; then # Fedora elif [ -f "/etc/fedora-release" ]; then # Fedora
Var_OSRelease="fedora" Var_OSRelease="fedora"
@@ -165,7 +233,6 @@ InstallSysbench() {
Var_OSRelease="alpinelinux" Var_OSRelease="alpinelinux"
elif [ -f "/etc/almalinux-release" ]; then # almalinux elif [ -f "/etc/almalinux-release" ]; then # almalinux
Var_OSRelease="almalinux" Var_OSRelease="almalinux"
# rockylinux
elif [ -f "/etc/arch-release" ]; then # archlinux elif [ -f "/etc/arch-release" ]; then # archlinux
Var_OSRelease="arch" Var_OSRelease="arch"
elif [ -f "/etc/freebsd-update.conf" ]; then # freebsd elif [ -f "/etc/freebsd-update.conf" ]; then # freebsd
@@ -173,15 +240,70 @@ InstallSysbench() {
else else
Var_OSRelease="unknown" # 未知系统分支 Var_OSRelease="unknown" # 未知系统分支
fi fi
case "$Var_OSRelease" in local mem_size=$(get_memory_size)
ubuntu | debian | astra) ! apt-get install -y sysbench && apt-get --fix-broken install -y && apt-get install --no-install-recommends -y sysbench ;; if [ -z "$mem_size" ] || [ "$mem_size" -eq 0 ]; then
centos | rhel | almalinux | redhat) (yum -y install epel-release && yum -y install sysbench) || (dnf install epel-release -y && dnf install sysbench -y) ;; echo "Error: Unable to determine memory size or memory size is zero."
fedora) dnf -y install sysbench ;; elif [ $mem_size -lt 1024 ]; then
arch) pacman -S --needed --noconfirm sysbench && pacman -S --needed --noconfirm libaio && ldconfig ;; _red "Warning: Your system has less than 1GB RAM (${mem_size}MB)"
freebsd) pkg install -y sysbench ;; if [ "$noninteractive" != "true" ]; then
alpinelinux) echo -e "${Msg_Warning}Sysbench Module not found, installing ..." && echo -e "${Msg_Warning}SysBench Current not support Alpine Linux, Skipping..." && Var_Skip_SysBench="1" ;; reading "Do you want to continue with EPEL installation? (y/N): " confirm
*) echo "Error: Unknown OS release: $os_release" ;; if [[ ! $confirm =~ ^[Yy]$ ]]; then
esac _yellow "Skipping EPEL installation"
return 1
fi
fi
case "$Var_OSRelease" in
ubuntu | debian | astra)
! apt-get install -y sysbench && apt-get --fix-broken install -y && apt-get install --no-install-recommends -y sysbench ;;
centos | rhel | almalinux | redhat | opencloudos)
(yum -y install epel-release && yum -y install sysbench) || (dnf install epel-release -y && dnf install sysbench -y) ;;
fedora)
dnf -y install sysbench ;;
arch)
pacman -S --needed --noconfirm sysbench && pacman -S --needed --noconfirm libaio && ldconfig ;;
freebsd)
pkg install -y sysbench ;;
alpinelinux)
if [ "$noninteractive" != "true" ]; then
reading "Do you want to continue with sysbench installation? (y/N): " confirm
if [[ ! $confirm =~ ^[Yy]$ ]]; then
_yellow "Skipping sysbench installation"
return 1
fi
fi
ALPINE_VERSION=$(grep -o '^[0-9]\+\.[0-9]\+' /etc/alpine-release)
COMMUNITY_REPO="http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community"
if grep -q "^${COMMUNITY_REPO}" /etc/apk/repositories; then
echo "Community repository is already enabled."
else
echo "Enabling community repository..."
echo "${COMMUNITY_REPO}" >> /etc/apk/repositories
echo "Community repository has been added."
echo "Updating apk package index..."
apk update && echo "Package index updated successfully."
fi
if apk info sysbench >/dev/null 2>&1; then
echo -e "${Msg_Info}Sysbench already installed."
else
apk add --no-cache sysbench
if [ $? -ne 0 ]; then
echo -e "${Msg_Warning}Sysbench Module not found, installing ..." && echo -e "${Msg_Warning}SysBench Current not support Alpine Linux, Skipping..." && Var_Skip_SysBench="1"
else
echo -e "${Msg_Success}Sysbench installed successfully."
fi
fi ;;
*)
_red "Sysbench Install Error: Unknown OS release: $Var_OSRelease" ;;
esac
if [[ $SYSTEM =~ ^(CentOS|RHEL|AlmaLinux)$ ]]; then
_yellow "Installing EPEL repository..."
if ! yum -y install epel-release; then
_red "EPEL installation failed!"
cleanup_epel
_yellow "Attempting to continue without EPEL..."
fi
fi
fi
} }
Check_SysBench() { Check_SysBench() {
@@ -210,6 +332,9 @@ Check_Sysbench_InstantBuild() {
if [ "$os_sysbench" = "astra" ]; then if [ "$os_sysbench" = "astra" ]; then
os_sysbench="debian" os_sysbench="debian"
fi fi
if [ "$os_sysbench" = "opencloudos" ]; then
os_sysbench="centos"
fi
echo -e "${Msg_Info}Release Detected: ${os_sysbench}" echo -e "${Msg_Info}Release Detected: ${os_sysbench}"
echo -e "${Msg_Info}Preparing compile enviorment ..." echo -e "${Msg_Info}Preparing compile enviorment ..."
prepare_compile_env "${os_sysbench}" prepare_compile_env "${os_sysbench}"
@@ -244,15 +369,15 @@ prepare_compile_env() {
} }
env_check() { env_check() {
REGEX=("debian|astra" "ubuntu" "centos|red hat|kernel|oracle linux|alma|rocky" "'amazon linux'" "fedora" "arch" "freebsd" "alpine" "openbsd") REGEX=("debian|astra" "ubuntu" "centos|red hat|kernel|oracle linux|alma|rocky" "'amazon linux'" "fedora" "arch" "freebsd" "alpine" "openbsd" "opencloudos")
RELEASE=("Debian" "Ubuntu" "CentOS" "CentOS" "Fedora" "Arch" "FreeBSD" "Alpine" "OpenBSD") RELEASE=("Debian" "Ubuntu" "CentOS" "CentOS" "Fedora" "Arch" "FreeBSD" "Alpine" "OpenBSD" "OpenCloudOS")
PACKAGE_UPDATE=("apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update" "pacman -Sy" "pkg update" "apk update" "pkg_add -u") PACKAGE_UPDATE=("apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update" "pacman -Sy" "pkg update" "apk update" "pkg_add -qu" "yum -y update")
PACKAGE_INSTALL=("apt-get -y install" "apt-get -y install" "yum -y install" "yum -y install" "yum -y install" "pacman -Sy --noconfirm --needed" "pkg install -y" "apk add") PACKAGE_INSTALL=("apt-get -y install" "apt-get -y install" "yum -y install" "yum -y install" "yum -y install" "pacman -Sy --noconfirm --needed" "pkg install -y" "apk add --no-cache" "pkg_add -I" "yum -y install")
PACKAGE_REMOVE=("apt-get -y remove" "apt-get -y remove" "yum -y remove" "yum -y remove" "yum -y remove" "pacman -Rsc --noconfirm" "pkg delete" "apk del") PACKAGE_REMOVE=("apt-get -y remove" "apt-get -y remove" "yum -y remove" "yum -y remove" "yum -y remove" "pacman -Rsc --noconfirm" "pkg delete" "apk del" "pkg_delete -I" "yum -y remove")
PACKAGE_UNINSTALL=("apt-get -y autoremove" "apt-get -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove" "" "pkg autoremove" "apk autoremove") PACKAGE_UNINSTALL=("apt-get -y autoremove" "apt-get -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove" "pacman -Rns --noconfirm" "pkg autoremove" "apk autoremove" "pkg_delete -a" "yum -y autoremove")
# 检查系统信息 # 检查系统信息
if [ -f /etc/alpine-release ]; then if [ -f /etc/opencloudos-release ]; then
SYS="alpine" SYS="opencloudos"
elif [ -s /etc/os-release ]; then elif [ -s /etc/os-release ]; then
SYS="$(grep -i pretty_name /etc/os-release | cut -d \" -f2)" SYS="$(grep -i pretty_name /etc/os-release | cut -d \" -f2)"
elif [ -x "$(type -p hostnamectl)" ]; then elif [ -x "$(type -p hostnamectl)" ]; then
@@ -269,6 +394,7 @@ env_check() {
SYS="$(uname -s)" SYS="$(uname -s)"
fi fi
[[ -n $SYS ]] || exit 1 [[ -n $SYS ]] || exit 1
# 匹配操作系统 # 匹配操作系统
for ((int = 0; int < ${#REGEX[@]}; int++)); do for ((int = 0; int < ${#REGEX[@]}; int++)); do
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
@@ -276,65 +402,57 @@ env_check() {
[[ -n $SYSTEM ]] && break [[ -n $SYSTEM ]] && break
fi fi
done done
# 检查是否成功匹配 # 检查是否成功匹配
[[ -n $SYSTEM ]] || exit 1 [[ -n $SYSTEM ]] || exit 1
# 根据 SYSTEM 设置相应的包管理命令 # 根据 SYSTEM 设置相应的包管理命令
UPDATE_CMD=${PACKAGE_UPDATE[int]} UPDATE_CMD=${PACKAGE_UPDATE[int]}
INSTALL_CMD=${PACKAGE_INSTALL[int]} INSTALL_CMD=${PACKAGE_INSTALL[int]}
REMOVE_CMD=${PACKAGE_REMOVE[int]} REMOVE_CMD=${PACKAGE_REMOVE[int]}
UNINSTALL_CMD=${PACKAGE_UNINSTALL[int]} UNINSTALL_CMD=${PACKAGE_UNINSTALL[int]}
echo "System: $SYSTEM" echo "System: $SYSTEM"
echo "Update command: $UPDATE_CMD" echo "Update command: $UPDATE_CMD"
echo "Install command: $INSTALL_CMD" echo "Install command: $INSTALL_CMD"
echo "Remove command: $REMOVE_CMD" echo "Remove command: $REMOVE_CMD"
echo "Uninstall command: $UNINSTALL_CMD" echo "Uninstall command: $UNINSTALL_CMD"
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/") cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
check_cdn_file check_cdn_file
_green "Update system manager." _yellow "Warning: System update will be performed"
${PACKAGE_UPDATE[int]} 2>/dev/null _yellow "This operation may:"
if ! command -v sudo >/dev/null 2>&1; then _yellow "1. Take significant time to complete"
_green "Installing sudo" _yellow "2. Cause temporary network interruptions"
${PACKAGE_INSTALL[int]} sudo _yellow "3. Impact system stability"
fi _yellow "4. Affect future system startup"
if ! command -v wget >/dev/null 2>&1; then if [ "$noninteractive" != "true" ]; then
_green "Installing wget" reading "Do you want to proceed with system update? (y/N): " update_confirm
${PACKAGE_INSTALL[int]} wget if [[ ! $update_confirm =~ ^[Yy]$ ]]; then
fi _yellow "Skipping system update"
if ! command -v tar >/dev/null 2>&1; then _yellow "Note: Some package installations may fail"
_green "Installing tar" else
${PACKAGE_INSTALL[int]} tar _green "Updating system package manager..."
fi if ! ${PACKAGE_UPDATE[int]} 2>/dev/null; then
if ! command -v unzip >/dev/null 2>&1; then _red "System update failed!"
_green "Installing unzip"
${PACKAGE_INSTALL[int]} unzip
fi
if ! command -v systemd-detect-virt >/dev/null 2>&1; then
_green "Installing systemd-detect-virt"
${PACKAGE_INSTALL[int]} systemd-detect-virt
if [ $? -ne 0 ]; then
if ! command -v dmidecode >/dev/null 2>&1; then
_green "Installing dmidecode"
${PACKAGE_INSTALL[int]} dmidecode
fi fi
fi fi
fi fi
if ! command -v dd >/dev/null 2>&1; then
_green "Installing dd" # 安装必要的命令
${PACKAGE_INSTALL[int]} dd for cmd in sudo wget tar unzip iproute2 systemd-detect-virt dd fio; do
fi if ! command -v "$cmd" >/dev/null 2>&1; then
if ! command -v fio >/dev/null 2>&1; then _green "Installing $cmd"
_green "Installing fio" ${PACKAGE_INSTALL[int]} "$cmd"
${PACKAGE_INSTALL[int]} fio fi
fi done
if ! command -v sysbench >/dev/null 2>&1 && [ "${REGEX[int]}" != "freebsd" ]; then
if ! command -v sysbench >/dev/null 2>&1; then
_green "Installing sysbench" _green "Installing sysbench"
${PACKAGE_INSTALL[int]} sysbench ${PACKAGE_INSTALL[int]} sysbench
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Unable to download sysbench through the system's package manager, speak to try compiling and installing it..." echo "Unable to download sysbench through the system's package manager, trying to compile and install it..."
if ! wget -O /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"; then wget -O /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip" || curl -Lk -o /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"
echo "wget failed, trying with curl"
curl -Lk -o /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"
fi
if [ ! -f /tmp/sysbench.zip ]; then if [ ! -f /tmp/sysbench.zip ]; then
wget -q -O /tmp/sysbench.zip "https://hub.fgit.cf/akopytov/sysbench/archive/1.0.20.zip" wget -q -O /tmp/sysbench.zip "https://hub.fgit.cf/akopytov/sysbench/archive/1.0.20.zip"
fi fi
@@ -343,11 +461,12 @@ env_check() {
Check_SysBench Check_SysBench
fi fi
fi fi
if ! command -v geekbench >/dev/null 2>&1; then if ! command -v geekbench >/dev/null 2>&1; then
_green "Installing geekbench" _green "Installing geekbench"
curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/cputest/main/dgb.sh" -o dgb.sh && chmod +x dgb.sh curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/cputest/main/dgb.sh" -o dgb.sh && chmod +x dgb.sh
bash dgb.sh -v gb5 bash dgb.sh -v gb5
_blue "If you not want to use geekbench5, you can use" _blue "If you do not want to use geekbench5, you can use"
echo "bash dgb.sh -v gb6" echo "bash dgb.sh -v gb6"
echo "bash dgb.sh -v gb4" echo "bash dgb.sh -v gb4"
_blue "to change version, or use" _blue "to change version, or use"
@@ -355,26 +474,28 @@ env_check() {
_blue "to uninstall geekbench" _blue "to uninstall geekbench"
rm -rf dgb.sh rm -rf dgb.sh
fi fi
if ! command -v speedtest >/dev/null 2>&1; then if ! command -v speedtest >/dev/null 2>&1; then
_green "Installing geekbench" _green "Installing speedtest"
curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/speedtest/main/dspt.sh" -o dspt.sh && chmod +x dspt.sh curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/speedtest/main/dspt.sh" -o dspt.sh && chmod +x dspt.sh
bash dspt.sh bash dspt.sh
rm -rf dspt.sh rm -rf dspt.sh
rm -rf speedtest.tar.gz rm -rf speedtest.tar.gz
_blue "if you want to use golang origin speedtest, you can use" _blue "if you want to use golang original speedtest, you can use"
echo "rm -rf /usr/bin/speedtest" echo "rm -rf /usr/bin/speedtest"
echo "rm -rf /usr/bin/speedtest-go" echo "rm -rf /usr/bin/speedtest-go"
_blue "to uninstall speedtest and speedtest-go" _blue "to uninstall speedtest and speedtest-go"
fi fi
if ! command -v ping >/dev/null 2>&1; then if ! command -v ping >/dev/null 2>&1; then
_green "Installing ping" _green "Installing ping"
${PACKAGE_INSTALL[int]} iputils-ping >/dev/null 2>&1 ${PACKAGE_INSTALL[int]} iputils-ping >/dev/null 2>&1
${PACKAGE_INSTALL[int]} ping >/dev/null 2>&1 ${PACKAGE_INSTALL[int]} ping >/dev/null 2>&1
fi fi
if [ "$(uname -s)" = "Darwin" ]; then if [ "$(uname -s)" = "Darwin" ]; then
echo "Detected MacOS. Installing sysbench and fio..." echo "Detected MacOS. Installing sysbench iproute2mac fio..."
brew install --force sysbench fio dd brew install --force sysbench iproute2mac fio
# 有问题需要修复root环境不能brewbrew安装完毕后可能路径不在环境变量中
else else
if ! grep -q "^net.ipv4.ping_group_range = 0 2147483647$" /etc/sysctl.conf; then if ! grep -q "^net.ipv4.ping_group_range = 0 2147483647$" /etc/sysctl.conf; then
echo "net.ipv4.ping_group_range = 0 2147483647" >> /etc/sysctl.conf echo "net.ipv4.ping_group_range = 0 2147483647" >> /etc/sysctl.conf
@@ -386,46 +507,68 @@ env_check() {
} }
uninstall_goecs() { uninstall_goecs() {
rm -rf /root/goecs rm -rf /root/goecs
rm -rf /usr/bin/goecs rm -rf /usr/bin/goecs
_green "The command (goecs) has been uninstalled." _green "The command (goecs) has been uninstalled."
} }
show_help() { show_help() {
cat <<"EOF" cat <<"EOF"
可用命令: 可用命令:
./goecs.sh env 检查并安装的包: ./goecs.sh env 检查并安装依赖包
sudo (几乎所有类 Unix 系统都有。) 警告: 此命令会执行系统更新(可选择),可能:
tar (几乎所有类 Unix 系统都有。) 1. 耗时较长
unzip (几乎所有类 Unix 系统都有。) 2. 导致网络短暂中断
dd (几乎所有类 Unix 系统都有。) 3. 影响系统稳定性
fio (几乎所有类 Unix 系统可以通过系统的包管理器安装。) 4. 影响后续系统启动
sysbench (几乎所有类 Unix 系统可以通过系统的包管理器安装。) 对于内存小于1GB的系统还可能导致:
geekbench (geekbench5) (仅支持 IPV4 环境,且内存大于 1GB 并需要持续联网,仅支持 amd64 和 arm64 架构。) 1. 系统卡死
speedtest (使用官方提供的二进制文件以获得更准确的测试结果。) 2. SSH连接中断
ping (使用官方提供的二进制文件以获得更准确的测试结果。) 3. 关键服务失败
systemd-detect-virt 或 dmidecode (几乎所有类 Unix 系统都有,安装以获得更准确的测试结果。) 推荐:
事实上sysbench/geekbench 是上述依赖项中唯一必须安装的,没有它们无法测试 CPU 分数。 环境依赖安装过程中挂起执行
必需组件:
sysbench/geekbench (CPU性能测试必需)
可选组件:
sudo, tar, unzip, dd, fio
speedtest (网络测试)
ping (网络连通性测试)
systemd-detect-virt/dmidecode (系统信息检测)
./goecs.sh install 安装 goecs 命令 ./goecs.sh install 安装 goecs 命令
./goecs.sh upgrade 升级 goecs 命令 ./goecs.sh upgrade 升级 goecs 命令
./goecs.sh uninstall 卸载 goecs 命令 ./goecs.sh uninstall 卸载 goecs 命令
./goecs.sh help 显示此消息 ./goecs.sh help 显示此消息
[English version follows...]
Available commands: Available commands:
./goecs.sh env Check and Install package: ./goecs.sh env Check and Install dependencies
sudo (Almost all unix-like systems have it.) Warning: This command performs system update(optional), which may:
tar (Almost all unix-like systems have it.) 1. Take considerable time
unzip (Almost all unix-like systems have it.) 2. Cause temporary network interruptions
dd (Almost all unix-like systems have it.) 3. Impact system stability
fio (Almost all unix-like systems can be installed through the system's package manager.) 4. Affect subsequent system startups
sysbench (Almost all unix-like systems can be installed through the system's package manager.) For systems with less than 1GB RAM, additional risks:
geekbench (geekbench5)(Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.) 1. System freeze
speedtest (Use the officially provided binaries for more accurate test results.) 2. SSH connection loss
ping (Use the officially provided binaries for more accurate test results.) 3. Critical service failures
systemd-detect-virt OR dmidecode (Almost all unix-like systems have it, for more accurate test results.) Recommended:
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested. Hanging execution during environment dependency installation
Required components:
sysbench/geekbench (Required for CPU testing)
Optional components:
sudo, tar, unzip, dd, fio
speedtest (Network testing)
ping (Network connectivity)
systemd-detect-virt/dmidecode (System info detection)
./goecs.sh install Install goecs command ./goecs.sh install Install goecs command
./goecs.sh upgrade Upgrade goecs command ./goecs.sh upgrade Upgrade goecs command
./goecs.sh uninstall Uninstall goecs command ./goecs.sh uninstall Uninstall goecs command
@@ -452,3 +595,4 @@ case "$1" in
show_help show_help
;; ;;
esac esac

View File

@@ -1,20 +0,0 @@
@echo off
setlocal enabledelayedexpansion
set repo_path=C:\Users\spiritlhl\Documents\GoWorks\ecs
git add -A
git commit -am"update"
:push
cd %repo_path%
git push -f origin master
if errorlevel 1 (
echo Push failed. Retrying in 3 seconds...
timeout /nobreak /t 3 >nul
goto push
)
echo Push successful.
endlocal

View File

@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"github.com/imroc/req/v3" "github.com/imroc/req/v3"
"github.com/oneclickvirt/UnlockTests/uts" "github.com/oneclickvirt/UnlockTests/uts"
"github.com/oneclickvirt/basics/ipv6"
"github.com/oneclickvirt/basics/system" "github.com/oneclickvirt/basics/system"
. "github.com/oneclickvirt/defaultset" . "github.com/oneclickvirt/defaultset"
"github.com/oneclickvirt/security/network" "github.com/oneclickvirt/security/network"
@@ -128,12 +129,12 @@ func CheckChina(enableLogger bool) bool {
return selectChina return selectChina
} }
// SecurityCheck 执行安全检查 // BasicsAndSecurityCheck 执行安全检查
func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) { func BasicsAndSecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) {
var wgt sync.WaitGroup var wgt sync.WaitGroup
var ipInfo, securityInfo, systemInfo string var ipInfo, securityInfo, systemInfo string
var err error var err error
wgt.Add(2) wgt.Add(1)
go func() { go func() {
defer wgt.Done() defer wgt.Done()
ipInfo, securityInfo, err = network.NetworkCheck("both", securtyCheckStatus, language) ipInfo, securityInfo, err = network.NetworkCheck("both", securtyCheckStatus, language)
@@ -141,12 +142,17 @@ func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (stri
fmt.Println(err.Error()) fmt.Println(err.Error())
} }
}() }()
wgt.Add(1)
go func() { go func() {
defer wgt.Done() defer wgt.Done()
systemInfo = system.CheckSystemInfo(language) systemInfo = system.CheckSystemInfo(language)
}() }()
wgt.Wait() wgt.Wait()
ipv6Info, errv6 := ipv6.GetIPv6Mask(language)
basicInfo := systemInfo + ipInfo basicInfo := systemInfo + ipInfo
if errv6 == nil && ipv6Info != "" {
basicInfo += ipv6Info
}
if strings.Contains(ipInfo, "IPV4") && strings.Contains(ipInfo, "IPV6") { if strings.Contains(ipInfo, "IPV4") && strings.Contains(ipInfo, "IPV6") {
uts.IPV4 = true uts.IPV4 = true
uts.IPV6 = true uts.IPV6 = true
@@ -238,22 +244,33 @@ func PrintAndCapture(f func(), tempOutput, output string) string {
} }
// UploadText 上传文本内容到指定URL // UploadText 上传文本内容到指定URL
func UploadText(absPath string) (string, error) { func UploadText(absPath string) (string, string, error) {
primaryURL := "http://hpaste.spiritlhl.net/api/upload" primaryURL := "http://hpaste.spiritlhl.net/api/upload"
backupURL := "https://paste.spiritlhl.net/api/upload" backupURL := "https://paste.spiritlhl.net/api/upload"
token := network.SecurityUploadToken token := network.SecurityUploadToken
client := req.DefaultClient() client := req.C().SetTimeout(6 * time.Second)
client.SetTimeout(6 * time.Second)
client.R(). client.R().
SetRetryCount(2). SetRetryCount(2).
SetRetryBackoffInterval(1*time.Second, 5*time.Second). SetRetryBackoffInterval(1*time.Second, 5*time.Second).
SetRetryFixedInterval(2 * time.Second) SetRetryFixedInterval(2 * time.Second)
file, err := os.Open(absPath) file, err := os.Open(absPath)
if err != nil { if err != nil {
return "", err return "", "", fmt.Errorf("failed to open file: %w", err)
} }
defer file.Close() defer file.Close()
upload := func(url string) (string, error) { upload := func(url string) (string, string, error) {
// 重新打开文件,以确保我们总是从文件开头读取
file, err := os.Open(absPath)
if err != nil {
return "", "", fmt.Errorf("failed to re-open file for %s: %w", url, err)
}
defer file.Close()
// 读取文件内容
content, err := io.ReadAll(file)
if err != nil {
return "", "", fmt.Errorf("failed to read file content for %s: %w", url, err)
}
resp, err := client.R(). resp, err := client.R().
SetHeader("Authorization", token). SetHeader("Authorization", token).
SetHeader("Format", "RANDOM"). SetHeader("Format", "RANDOM").
@@ -261,26 +278,28 @@ func UploadText(absPath string) (string, error) {
SetHeader("UploadText", "true"). SetHeader("UploadText", "true").
SetHeader("Content-Type", "multipart/form-data"). SetHeader("Content-Type", "multipart/form-data").
SetHeader("No-JSON", "true"). SetHeader("No-JSON", "true").
SetFileReader("file", "goecs.txt", file). SetFileBytes("file", "goecs.txt", content).
Post(url) Post(url)
if err != nil { if err != nil {
return "", err return "", "", fmt.Errorf("failed to make request to %s: %w", url, err)
} }
if resp.StatusCode >= 200 && resp.StatusCode <= 299 { if resp.StatusCode >= 200 && resp.StatusCode <= 299 {
return strings.ReplaceAll(resp.String(), "https://paste.spiritlhl.net/", "http://hpaste.spiritlhl.net/"), nil http_url := strings.ReplaceAll(resp.String(), "https://paste.spiritlhl.net/", "http://hpaste.spiritlhl.net/")
https_url := strings.ReplaceAll(resp.String(), "http://hpaste.spiritlhl.net/", "https://paste.spiritlhl.net/")
return http_url, https_url, nil
} else { } else {
return "", fmt.Errorf("upload failed with status code: %d", resp.StatusCode) return "", "", fmt.Errorf("upload failed for %s with status code: %d", url, resp.StatusCode)
} }
} }
result, err := upload(primaryURL) http_url, https_url, err := upload(primaryURL)
if err == nil { if err == nil {
return result, nil return http_url, https_url, nil
} }
result, err = upload(backupURL) http_url, https_url, err = upload(backupURL)
if err != nil { if err != nil {
return "", err return "", "", fmt.Errorf("failed to upload to both primary and backup URLs: %w", err)
} }
return result, nil return http_url, https_url, nil
} }
// ProcessAndUpload 创建结果文件并上传文件 // ProcessAndUpload 创建结果文件并上传文件
@@ -321,12 +340,12 @@ func ProcessAndUpload(output string, filePath string, enableUplaod bool) {
return return
} }
// 上传文件并生成短链接 // 上传文件并生成短链接
shorturl, err3 := UploadText(absPath) http_url, https_url, err3 := UploadText(absPath)
if err3 != nil { if err3 != nil {
fmt.Println("Upload failed, cannot generate short URL.") fmt.Println("Upload failed, cannot generate short URL.")
fmt.Println(err3.Error()) fmt.Println(err3.Error())
return return
} }
fmt.Println("Upload successful, short URL:", shorturl) fmt.Printf("Upload successful!\nHttp URL: %s\nHttps URL: %s\n", http_url, https_url)
} }
} }