Compare commits

..

60 Commits

Author SHA1 Message Date
spiritsoul
9431fe3944 v0.1.12 - 修复CPU识别相关BUG
- 增加Linux环境下识别CPU的手段gopsutil
- 修复CPU三缓存可能识别失败的问题
- 修复s390x架构下可能识别不到具体CPU的问题,强制输出CPU制造厂商
- 修复HyperV在s390x架构下识别不成功的问题
2025-02-05 21:20:49 +08:00
spiritsoul
5dcef9f4c3 Add zypper 2025-02-05 10:09:33 +08:00
spiritsoul
865ca62f06 加强部分检测 2025-02-04 18:15:18 +08:00
spiritsoul
eea78a7c30 v0.1.10 - 更新流媒体检测 2025-01-31 12:29:06 +08:00
spiritsoul
2f5feace7b v0.1.9 - 避免错误文件的使用 2025-01-27 21:09:04 +08:00
spiritlhl
615ffca90f Update README.md 2025-01-21 09:34:46 +08:00
spiritlhl
685fe735f6 Update README.md 2025-01-20 10:45:17 +08:00
spiritlhl
5545990854 升级Action中默认的Golang版本 1.22 --> 1.23 2025-01-18 19:16:29 +08:00
spiritlhl
91d1aa4461 v0.1.8 - 在存在IPV6信息时修复排版缺少一个换行符 2025-01-18 19:11:13 +08:00
spiritlhl
94f9576383 Update README.md 2025-01-18 15:31:58 +08:00
spiritlhl
ef91a61d22 v0.1.7 2025-01-18 15:08:14 +08:00
spiritlhl
bafd77e2f5 v0.1.6 - 修复误删除强制修改release格式的问题 2025-01-18 14:33:07 +08:00
spiritlhl
eb03d50cd2 新增Claude检测,修复部分其他检测 2025-01-18 13:56:57 +08:00
spiritlhl
dbd921d8ca nt3依赖跟进上游NTrace-core更新
nt3依赖跟进上游NTrace-core更新
2025-01-18 11:31:10 +08:00
spiritlhl
8b9df2c385 邮件相关检测增加检测
邮件相关检测增加 "Apple", "MXRoute", "Namecrane", "XYAMail", "ZohoMail", "Inbox_eu", "Free_fr" 的检测
2025-01-18 11:17:10 +08:00
spiritlhl
ce57c141a0 增加QA描述 2025-01-04 17:19:00 +08:00
spiritlhl
da3dc7e11e 设置默认版本 2025-01-03 17:51:58 +08:00
spiritlhl
d4cbd0772a v0.1.4 - 修复中途终止时上传成功但分享链接未打印的问题 2025-01-03 17:44:22 +08:00
spiritlhl
2ff558ae7b v0.1.3 2025-01-03 16:45:21 +08:00
spiritlhl
f5d9752e89 v0.1.3 2025-01-03 16:44:55 +08:00
spiritlhl
1f563c823a Update 2025-01-03 16:44:08 +08:00
spiritlhl
807141751a 更新UnlockTests的版本 & 自实现CPU测试的sysbench逻辑
- 更新UnlockTests的版本
- 在sysbench和geekbench都不能工作时,使用Golang模仿sysbench实现的程序测试进行测试,但单线程一般会比sysbench低300个左右的事件数)每秒(得分)(8.8%误差)
2025-01-03 14:36:00 +08:00
spiritlhl
e55a18b3de 一些修复和优化
- 更新nt3依赖,增加自动重试机制
- 修改ctrl+c的终止命令时也支持自动上传测试结果并保存
- 优化安装命令,在无法识别系统/架构等情况下也尽量可使用默认的命令
2025-01-03 13:53:40 +08:00
spiritlhl
920054c844 v0.1.01 更新上传分享的地址 2025-01-02 14:04:11 +08:00
spiritlhl
3c5405dd07 v0.0.89 - 修复GooglePlayStore检测,增加Sora检测 2024-12-21 18:42:25 +08:00
spiritlhl
a33702f164 Update 2024-12-20 16:33:19 +08:00
spiritlhl
daf07945dc Update README_EN.md 2024-12-08 18:22:56 +08:00
spiritlhl
88b39c0ae3 Update README_EN.md 2024-12-08 18:22:39 +08:00
spiritlhl
65ddb32d74 Update README.md 2024-12-08 18:21:53 +08:00
spiritlhl
acf2f0e98c Add China check 2024-12-08 10:13:05 +00:00
spiritlhl
e63dc4d3f4 Sync to CNB 2024-12-08 09:41:23 +00:00
spiritlhl
7fb4e358e8 Update README.md 2024-12-08 17:32:15 +08:00
spiritlhl
15ba7fb00f Update build_docker.yaml 2024-12-08 17:22:58 +08:00
spiritlhl
916f21a72f Update 2024-12-08 09:10:43 +00:00
spiritlhl
f00d5db69c Update 2024-12-08 09:08:31 +00:00
spiritlhl
6dbb171d3b Use Docker Push 2024-12-08 08:58:15 +00:00
spiritlhl
0921aef041 Change main to master 2024-12-08 08:54:52 +00:00
spiritlhl
dd4a4e317b Push to CNB Repository 2024-12-08 08:54:17 +00:00
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
14 changed files with 991 additions and 558 deletions

View File

@@ -24,7 +24,14 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
- name: Login to CNB Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.CNB_DOCKER_REGISTRY }}
username: ${{ secrets.CNB_USERNAME }}
password: ${{ secrets.CNB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: .
@@ -32,4 +39,6 @@ jobs:
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/riscv64
# linux/mips,linux/mipsle 暂不支持 alpine, linux/s390x 编译卡死
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/goecs:latest
tags: |
${{ secrets.DOCKER_USERNAME }}/goecs:latest
${{ secrets.CNB_DOCKER_REGISTRY }}/oneclickvirt/ecs:latest

View File

@@ -10,7 +10,7 @@ jobs:
- name: set up
uses: actions/setup-go@v3
with:
go-version: 1.22.4
go-version: 1.23.4
id: go
- name: check out
uses: actions/checkout@v3

View File

@@ -22,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.4
go-version: 1.23.4
- name: Configure Git for Private Modules
run: |

56
.github/workflows/sync.yaml vendored Normal file
View File

@@ -0,0 +1,56 @@
name: Sync Latest Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
sync-release:
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest release
id: get_release
run: |
echo "RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Create temporary directory
run: |
mkdir -p temp_repo
cd temp_repo
git init
git config --local user.name "GitHub Action"
git config --local user.email "action@github.com"
- name: Copy repository files
run: |
cp goecs.sh temp_repo/
cp README_EN.md temp_repo/
cp README.md temp_repo/
cp LICENSE temp_repo/
- name: Download release assets
run: |
cd temp_repo
gh release download ${{ env.RELEASE_TAG }} --repo ${{ github.repository }} --dir .
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push to target repository
run: |
cd temp_repo
git add .
git commit -m "Sync release ${{ env.RELEASE_TAG }} from ${{ github.repository }}"
git branch -M main
git remote add target https://cnb.cool/oneclickvirt/ecs.git
echo "machine cnb.cool login ${{ secrets.CNB_USERNAME }} password ${{ secrets.CNB_TOKEN }}" > ~/.netrc
chmod 600 ~/.netrc
git push -f target main
env:
CNB_USERNAME: ${{ secrets.CNB_USERNAME }}
CNB_TOKEN: ${{ secrets.CNB_TOKEN }}

View File

@@ -6,7 +6,7 @@ builds:
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
goos:
- linux
- windows
@@ -33,7 +33,7 @@ builds:
- CC=o64-clang
- CXX=o64-clang++
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
goos:
- darwin
goarch:
@@ -46,7 +46,7 @@ builds:
- CC=oa64-clang
- CXX=oa64-clang++
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} -checklinkname=0
goos:
- darwin
goarch:
@@ -75,4 +75,4 @@ changelog:
- Merge pull request
- Merge branch
- go mod tidy
- New translations
- New translations

View File

@@ -4,9 +4,9 @@ FROM alpine:latest
# 安装必要的工具
RUN apk add --no-cache wget curl bash
RUN apk add --no-cache bind-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
RUN apk add --no-cache bind-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
RUN apk add --no-cache grep openssl ca-certificates uuidgen
RUN export noninteractive=true
# 下载并执行 goecs.sh 脚本
RUN curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && \
chmod +x goecs.sh && \

266
README.md
View File

@@ -1,137 +1,173 @@
# ecs
# ECS
[![release](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml/badge.svg)](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fecs&count_bg=%2357DEFF&title_bg=%23000000&icon=cliqz.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://www.spiritlhl.net/)
[![release](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml/badge.svg)](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml)
融合怪测评脚本 - GO重构版本 - 由于未正式发版如有问题请issues反馈
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fecs&count_bg=%2357DEFF&title_bg=%23000000&icon=cliqz.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://www.spiritlhl.net/)
Shell版本 https://github.com/spiritLHLS/ecs
[<img src="https://api.gitsponsors.com/api/badge/img?id=819808844" height="20">](https://api.gitsponsors.com/api/badge/link?p=3sgKiCtfJJbBT6XMAb1xeTadeXZcXeRXLsRG9HW+cFAZcmACmclN+HNM72KLMvwZdHrl7sjG6in68CwoQ7CNh4hoIz2s4ksTxcCIWoH9M3OsR/kHv31sS+0ZqR3O04BD3SqFX8B7ayuM9JCC4zKblg==)
## 语言
融合怪测评项目 - GO 重构版本
如有问题请 [issues](https://github.com/oneclickvirt/ecs/issues) 反馈。
Go 版本:[https://github.com/oneclickvirt/ecs](https://github.com/oneclickvirt/ecs)
Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS/ecs)
---
## **语言**
[中文文档](README.md) | [English Docs](README_EN.md)
## 适配系统和架构
---
编译支持的架构: amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
## **适配系统和架构**
测试支持的架构: amd64、arm64
### **编译支持的架构**
更多架构请自行测试
- amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
编译支持的系统: Linux、Windows、MacOS、FreeBSD、OpenBSD
### **测试支持的架构**
测试支持的系统: Linux、Windows
- amd64、arm64
更多系统请自行测试
> 更多架构请自行测试
待支持的系统(存在硬件测试BUG未修复): MacOS、FreeBSD、OpenBSD
### **编译支持的系统**
## 功能
- Linux、Windows、MacOS、FreeBSD、OpenBSD
- [x] 系统基础信息查询[自研[basics](https://github.com/oneclickvirt/basics)、[gostun](https://github.com/oneclickvirt/gostun)]
- [x] IP基础信息并发查询[自研[basics](https://github.com/oneclickvirt/basics)]
- [x] CPU测试[自研[cputest](https://github.com/oneclickvirt/cputest)支持sysbench、geekbench、winsat]
- [x] 内存测试[自研[memorytest](https://github.com/oneclickvirt/memorytest)支持sysbench、dd]
- [x] 硬盘测试[自研[disktest](https://github.com/oneclickvirt/disktest)支持dd、fio、winsat]
- [x] 御三家流媒体解锁信息并发查询[借鉴[netflix-verify](https://github.com/sjlleo/netflix-verify)、[VerifyDisneyPlus](https://github.com/sjlleo/VerifyDisneyPlus)、[TubeCheck](https://github.com/sjlleo/TubeCheck)逻辑开发至于[CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)]
- [x] 常见流媒体测试并发查询[自研至于[UnlockTests](https://github.com/oneclickvirt/UnlockTests),逻辑借鉴[RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck)、[MediaUnlockTest](https://github.com/HsukqiLee/MediaUnlockTest)]
- [x] IP质量/安全信息并发查询[自研,由于测试含密钥信息,故而私有化开发,但二进制文件编译至于[securityCheck](https://github.com/oneclickvirt/securityCheck)]
- [x] 邮件端口测试[自研[portchecker](https://github.com/oneclickvirt/portchecker)]
- [x] 三网回程测试[借鉴[zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace)二次开发至于[oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)]
- [x] 三网路由测试[借鉴[NTrace-core](https://github.com/nxtrace/NTrace-core)二次开发至于[nt3](https://github.com/oneclickvirt/nt3)]
- [x] 测试网速[基于[speedtest.net-爬虫](https://github.com/spiritLHLS/speedtest.net-CN-ID)、[speedtest.cn-爬虫](https://github.com/spiritLHLS/speedtest.cn-CN-ID)的数据,使用[speedtest-go](https://github.com/showwin/speedtest-go)开发至于[oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)]
- [x] 测试三网Ping值[借鉴[ecsspeed](https://github.com/spiritLHLS/ecsspeed)的逻辑二次开发至于[pingtest](https://github.com/oneclickvirt/pingtest)]
### **测试支持的系统**
## Linux/FreeBSD/MacOS上使用的说明
- Linux、Windows
### 一键命令
> 更多系统请自行测试。
```
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
```
### **待支持的系统**
- MacOS、FreeBSD、OpenBSD存在硬件测试 BUG 未修复)
```
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
```
---
### 详细说明
## **功能**
下载脚本
- 系统基础信息查询:
自研 [basics](https://github.com/oneclickvirt/basics)、[gostun](https://github.com/oneclickvirt/gostun)
- IP 基础信息并发查询:
自研 [basics](https://github.com/oneclickvirt/basics)
- CPU 测试:
自研 [cputest](https://github.com/oneclickvirt/cputest),支持 sysbench、geekbench、winsat
- 内存测试:
自研 [memorytest](https://github.com/oneclickvirt/memorytest),支持 sysbench、dd
- 硬盘测试:
自研 [disktest](https://github.com/oneclickvirt/disktest),支持 dd、fio、winsat
- 流媒体解锁信息并发查询:
借鉴 [netflix-verify](https://github.com/sjlleo/netflix-verify) 等逻辑,开发至 [CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)
- 常见流媒体测试并发查询:
自研至 [UnlockTests](https://github.com/oneclickvirt/UnlockTests),逻辑借鉴 [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck) 等
- IP 质量/安全信息并发查询:
自研,二进制文件编译至 [securityCheck](https://github.com/oneclickvirt/securityCheck)
- 邮件端口测试:
自研 [portchecker](https://github.com/oneclickvirt/portchecker)
- 三网回程测试:
借鉴 [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace),二次开发至 [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)
- 三网路由测试:
借鉴 [NTrace-core](https://github.com/nxtrace/NTrace-core),二次开发至 [nt3](https://github.com/oneclickvirt/nt3)
- 网速测试:
基于 [speedtest.net](https://github.com/spiritLHLS/speedtest.net-CN-ID) 和 [speedtest.cn](https://github.com/spiritLHLS/speedtest.cn-CN-ID) 数据,开发至 [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
- 三网 Ping 值测试:
借鉴 [ecsspeed](https://github.com/spiritLHLS/ecsspeed),二次开发至 [pingtest](https://github.com/oneclickvirt/pingtest)
```
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
---
## **使用说明**
```
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
### **Linux/FreeBSD/MacOS**
安装环境
#### **一键命令**
```
./goecs.sh env
```
将默认安装依赖,默认更新包管理器,默认非互动模式,下面的非一键命令版本可控制是否安装依赖/是否更新包管理器/默认互动模式
安装goecs
- **国际用户无加速:**
```
./goecs.sh install
```
```bash
export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
```
升级goecs
- **国际/国内使用 CDN 加速:**
```
./goecs.sh upgrade
```
```bash
export noninteractive=true && curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
```
卸载goecs
- **国内用户使用 CNB 加速:**
```
./goecs.sh uninstall
```
```bash
export noninteractive=true && curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
```
shell脚本的说明
#### **详细说明**
```
可用命令:
1. **下载脚本**
./goecs.sh env 检查并安装的包:
sudo (几乎所有类 Unix 系统都有。)
tar (几乎所有类 Unix 系统都有。)
unzip (几乎所有类 Unix 系统都有。)
dd (几乎所有类 Unix 系统都有。)
fio (几乎所有类 Unix 系统可以通过系统的包管理器安装。)
sysbench (几乎所有类 Unix 系统可以通过系统的包管理器安装。)
geekbench (geekbench5) (仅支持 IPV4 环境,且内存大于 1GB 并需要持续联网,仅支持 amd64 和 arm64 架构。)
speedtest (使用官方提供的二进制文件以获得更准确的测试结果。)
ping (使用官方提供的二进制文件以获得更准确的测试结果。)
systemd-detect-virt 或 dmidecode (几乎所有类 Unix 系统都有,安装以获得更准确的测试结果。)
事实上sysbench/geekbench 是上述依赖项中唯一必须安装的,没有它们无法测试 CPU 分数。
./goecs.sh install 安装 goecs 命令
./goecs.sh upgrade 升级 goecs 命令
./goecs.sh uninstall 卸载 goecs 命令
./goecs.sh help 显示此消息
```
**国际用户无加速:**
goecs唤起菜单
```bash
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
```
goecs
```
**国际/国内使用 CDN 加速:**
```bash
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
```
./goecs
```
**国内用户使用 CNB 加速:**
goecs命令参数化
```bash
curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
```
2. **更新包管理器(可选择)并安装环境**
```bash
./goecs.sh env
```
**非互动模式:**
```bash
export noninteractive=true && ./goecs.sh env
```
3. **安装 `goecs`**
```bash
./goecs.sh install
```
4. **升级 `goecs`**
```bash
./goecs.sh upgrade
```
5. **卸载 `goecs`**
```bash
./goecs.sh uninstall
```
6. **唤起菜单**
```bash
goecs
```
#### **命令参数化**
```bash
Usage: goecs [options]
-backtrace
Enable/Disable backtrace test (in 'en' language or on windows it always false) (default true)
@@ -185,21 +221,18 @@ Usage: goecs [options]
-v Display version information
```
## Windows上使用的说明
---
下载带exe文件的压缩文件
### **Windows**
https://github.com/oneclickvirt/ecs/releases
1. 下载带 exe 文件的压缩包:[Releases](https://github.com/oneclickvirt/ecs/releases)
2. 解压后,右键以管理员模式运行。
找其中最新的版本,按照对应架构下载对应的 .zip 文件解压后文件夹内有一个exe文件
---
选择该exe文件右键点击选择管理员模式运行(非管理员模式运行无法进行硬件测试),唤起菜单自选
### **Docker**
windows测试无需进行环境安装
## 在Docker中使用的说明
地址https://hub.docker.com/r/spiritlhl/goecs
国际镜像地址https://hub.docker.com/r/spiritlhl/goecs
请确保执行下述命令前本机已安装Docker
@@ -217,6 +250,22 @@ docker run --rm spiritlhl/goecs:latest -menu=false -l zh
使用Docker执行测试硬件测试会有一些偏差和虚拟化架构判断失效还是推荐直接测试而不使用Docker测试。
国内镜像地址https://cnb.cool/oneclickvirt/ecs/-/packages/docker/ecs
请确保执行下述命令前本机已安装Docker
特权模式+host网络
```shell
docker run --rm --privileged --network host docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l zh
```
非特权模式+非host网络
```shell
docker run --rm docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l zh
```
## QA
#### Q: 为什么默认使用sysbench而不是geekbench
@@ -225,10 +274,10 @@ docker run --rm spiritlhl/goecs:latest -menu=false -l zh
```
sysbench geekbench
轻量几乎所有服务器都能跑 重型小机器跑不动
测试无联网需求,无硬件需求 测试必须联网且必须IPV4环境,且有内存大小1G的最低需求
LUA编写且开源各架构系统可自行编译 仅官方二进制文件且不开源,无对应架构时无法自行编译
核心测试组件十多年不变 每次大版本更新对标的CPU不同版本间得分互相之间难转化你只能以对标的CPU为准
轻量几乎所有服务器都能跑 重型小机器跑不动
测试无联网需求,无硬件需求 测试必须联网且必须IPV4环境有内存大小1G的最低需求
LUA编写且开源各架构系统可自行编译 仅官方二进制文件且不开源,无对应架构时无法自行编译
核心测试组件十多年不变 每次大版本更新对标的CPU不同版本间得分互相之间难转化你只能以对标的CPU为准
测试仅测试计算性能 测试涵盖多种性能测试,得分以权重计算,但实际很多测试项目实际是用不到的
适合快速测试 适合全面测试
```
@@ -247,3 +296,10 @@ LUA编写且开源各架构系统可自行编译 仅官方二进制文件且
#### A: 每个测试项目有对应的维护仓库,自行点击查看仓库说明
#### Q: 测试进行到一半如何手动终止?
#### A: 按ctrl键和c键终止程序终止后依然会在当前目录下生成goecs.txt文件和分享链接里面是已经测试到的信息。
#### Q: 非Root环境如何进行测试
#### A: 手动执行安装命令实在装不上也没问题直接在release中下载对应架构的压缩包解压后执行即可只要你能执行的了文件。或者你能使用docker的话用docker执行。

View File

@@ -2,9 +2,13 @@
[![release](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml/badge.svg)](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fecs&count_bg=%2357DEFF&title_bg=%23000000&icon=cliqz.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://www.spiritlhl.net/)
Fusion Monster Evaluation Script - GO Refactored Version - Since it has not been officially released, please report any issues via issues.
Fusion Monster Evaluation Script - GO Refactored Version
Shell version: https://github.com/spiritLHLS/ecs/blob/main/README_EN.md
Please report any issues via issues.
Go version[https://github.com/oneclickvirt/ecs](https://github.com/oneclickvirt/ecs)
Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https://github.com/spiritLHLS/ecs/blob/main/README_EN.md)
## Language
@@ -47,7 +51,7 @@ Systems to be supported (hardware testing bugs not yet fixed): MacOS、FreeBSD
### 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 -l en
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
@@ -64,6 +68,8 @@ Install environment
./goecs.sh env
```
If you don't want interaction, use ```export noninteractive=true``` and then execute the ```env``` command
Install goecs
```
@@ -87,18 +93,28 @@ Explanation of the shell script
```
Available commands:
./goecs.sh env Check and Install package:
sudo (Almost all unix-like systems have it.)
tar (Almost all unix-like systems have it.)
unzip (Almost all unix-like systems have it.)
dd (Almost all unix-like systems have it.)
fio (Almost all unix-like systems can be installed through the system's package manager.)
sysbench (Almost all unix-like systems can be installed through the system's package manager.)
geekbench (geekbench5)(Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.)
speedtest (Use the officially provided binaries for more accurate test results.)
ping (Use the officially provided binaries for more accurate test results.)
systemd-detect-virt OR dmidecode (Almost all unix-like systems have it, for more accurate test results.)
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested.
./goecs.sh env Check and Install dependencies
Warning: This command performs system update(optional), which may:
1. Take considerable time
2. Cause temporary network interruptions
3. Impact system stability
4. Affect subsequent system startups
For systems with less than 1GB RAM, additional risks:
1. System freeze
2. SSH connection loss
3. Critical service failures
Recommended:
Hanging execution during environment dependency installation
Required components:
sysbench/geekbench (Required for CPU testing)
Optional components:
sudo, tar, unzip, dd, fio
speedtest (Network testing)
ping (Network connectivity)
systemd-detect-virt/dmidecode (System info detection)
./goecs.sh install Install goecs command
./goecs.sh upgrade Upgrade goecs command
./goecs.sh uninstall Uninstall goecs command
@@ -205,4 +221,4 @@ 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.
Recommended direct testing without using Docker testing.

View File

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

80
go.mod
View File

@@ -1,41 +1,41 @@
module github.com/oneclickvirt/ecs
go 1.22.4
go 1.23.4
require (
github.com/imroc/req/v3 v3.43.7
github.com/imroc/req/v3 v3.49.0
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502
github.com/oneclickvirt/UnlockTests v0.0.16-20240823051211
github.com/oneclickvirt/UnlockTests v0.0.25-20250204100855
github.com/oneclickvirt/backtrace v0.0.4-20240702140722
github.com/oneclickvirt/basics v0.0.7-20240821160408
github.com/oneclickvirt/cputest v0.0.8-20240702070215
github.com/oneclickvirt/basics v0.0.9-20250205131258
github.com/oneclickvirt/cputest v0.0.9-20250103063414
github.com/oneclickvirt/defaultset v0.0.2-20240624082446
github.com/oneclickvirt/disktest v0.0.4-20240809053456
github.com/oneclickvirt/gostun v0.0.3-20240702054621
github.com/oneclickvirt/memorytest v0.0.4-20240820095126
github.com/oneclickvirt/nt3 v0.0.3-20240809100110
github.com/oneclickvirt/pingtest v0.0.5-20240804134050
github.com/oneclickvirt/portchecker v0.0.2-20240803151204
github.com/oneclickvirt/nt3 v0.0.4-20250118032755
github.com/oneclickvirt/pingtest v0.0.5-20241006123443
github.com/oneclickvirt/portchecker v0.0.3-20250118031146
github.com/oneclickvirt/security v0.0.4-20240729065854
github.com/oneclickvirt/speedtest v0.0.7-20240704023701
github.com/oneclickvirt/speedtest v0.0.8-20241005164804
)
require (
github.com/PuerkitoBio/goquery v1.9.2 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/cloudflare/circl v1.5.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gofrs/uuid/v5 v5.2.0 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 // indirect
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.2 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
@@ -44,26 +44,26 @@ require (
github.com/jaypipes/ghw v0.12.0 // indirect
github.com/jaypipes/pcidb v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/libp2p/go-nat v0.2.0 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/lionsoul2014/ip2region v2.11.2+incompatible // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/magiconair/properties v1.8.9 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/miekg/dns v1.1.61 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxtrace/NTrace-core v1.3.2 // indirect
github.com/onsi/ginkgo/v2 v2.19.0 // indirect
github.com/nxtrace/NTrace-core v1.3.7 // indirect
github.com/onsi/ginkgo/v2 v2.22.1 // indirect
github.com/oschwald/maxminddb-golang v1.13.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pion/dtls/v2 v2.2.7 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/stun/v2 v2.0.0 // indirect
@@ -72,12 +72,12 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus-community/pro-bing v0.4.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.45.1 // indirect
github.com/refraction-networking/utls v1.6.6 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.48.2 // indirect
github.com/refraction-networking/utls v1.6.7 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rodaine/table v1.2.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/rodaine/table v1.3.0 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/schollz/progressbar/v3 v3.14.4 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
@@ -85,30 +85,30 @@ require (
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/showwin/speedtest-go v1.7.7 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/gjson v1.17.1 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.8.0 // indirect
github.com/tsosunchia/powclient v0.1.5 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/mock v0.5.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.29.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect

179
go.sum
View File

@@ -2,26 +2,26 @@ github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/cloudflare/circl v1.3.9 h1:QFrlgFYf2Qpi8bSpVPK1HBvWpx16v/1TZivyo7pGuBE=
github.com/cloudflare/circl v1.3.9/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
github.com/cloudflare/circl v1.5.0 h1:hxIWksrX6XN5a1L2TI/h53AGPhNHoUBo+TD1ms9+pys=
github.com/cloudflare/circl v1.5.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
@@ -35,12 +35,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 h1:e+8XbKB6IMn8A4OAyZccO4pYfB3s7bt6azNIPE7AnPg=
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.2 h1:qoW6V1GT3aZxybsbC6oLnailWnB+qTMVwMreOso9XUw=
github.com/gorilla/websocket v1.5.2/go.mod h1:0n9H61RBAcf5/38py2MCYbxzPIY9rOkpvvMT24Rqs30=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -50,8 +50,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY=
github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
github.com/imroc/req/v3 v3.43.7 h1:dOcNb9n0X83N5/5/AOkiU+cLhzx8QFXjv5MhikazzQA=
github.com/imroc/req/v3 v3.43.7/go.mod h1:SQIz5iYop16MJxbo8ib+4LnostGCok8NQf8ToyQc2xA=
github.com/imroc/req/v3 v3.49.0 h1:5Rac2qvz7Dq0E3PeBo/c2szV3hagPQIGLoHtfBmYhu4=
github.com/imroc/req/v3 v3.49.0/go.mod h1:XZf4t94DNJzcA0UOBlA68hmSrWsAyvN407ADdH4mzCA=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jaypipes/ghw v0.12.0 h1:xU2/MDJfWmBhJnujHY9qwXQLs3DBsf0/Xa9vECY0Tho=
@@ -62,8 +62,8 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0=
github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -78,15 +78,14 @@ github.com/lionsoul2014/ip2region v2.11.2+incompatible h1:+VRsGcrHz8ewXI/2UzTptJ
github.com/lionsoul2014/ip2region v2.11.2+incompatible/go.mod h1:+ZBN7PBoh5gG6/y0ZQ85vJDBe21WnfbRrQQwTfliJJI=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
@@ -100,18 +99,18 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nxtrace/NTrace-core v1.3.2 h1:8aU/IQFmPnwbaWGVBIJHwwVIWk+roo+9+lG+U0OFZ+o=
github.com/nxtrace/NTrace-core v1.3.2/go.mod h1:qCVsgSs982jw02BVjTtN8mjSg5OIXW9TaUdISQrMnTw=
github.com/nxtrace/NTrace-core v1.3.7 h1:ZnTbPrPqpyeraCvUyNbQTNyl4Gz3NRQDh06WdIIHh90=
github.com/nxtrace/NTrace-core v1.3.7/go.mod h1:aW2owz9I+W5i+gJEDmnWli75mB+fuO4UTwdOPMcQHpE=
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502 h1:hRIYJ2uEp2N3AH5bP5X6bwfdwWfZQO/2WoqpUJ8+WsY=
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
github.com/oneclickvirt/UnlockTests v0.0.16-20240823051211 h1:oDYlAXbUSt6JYTC+wcFDVWTacGuyBtWNfJhpKkrqNkU=
github.com/oneclickvirt/UnlockTests v0.0.16-20240823051211/go.mod h1:UELwZDDiddSxe38boYOPl1FlrL0ptEZYSQwdE3MYvUM=
github.com/oneclickvirt/UnlockTests v0.0.25-20250204100855 h1:ZJQJ2fz4vzTE4aiHcvCRFKMb7RwRmaDWk6MZNRtJKg0=
github.com/oneclickvirt/UnlockTests v0.0.25-20250204100855/go.mod h1:yXWIZB6iLS88pEd9m4QJi1GENn+7I91zA72y5ONz2Oc=
github.com/oneclickvirt/backtrace v0.0.4-20240702140722 h1:UJ/VWf+ZbhGarc9HcHMIyenpmX+b2LxkXu0hlLk3Gxs=
github.com/oneclickvirt/backtrace v0.0.4-20240702140722/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8=
github.com/oneclickvirt/basics v0.0.7-20240821160408 h1:IOqa7bBAkjhfru6arDsOTKB7qZ36ojfOP73kE+cDaqc=
github.com/oneclickvirt/basics v0.0.7-20240821160408/go.mod h1:fUdVpU8gdjaZsTCyqnQBAbHc9BbbN8Fxr3sGPKooUpU=
github.com/oneclickvirt/cputest v0.0.8-20240702070215 h1:CcFpyVPlQkJ6vjFP17BRuJhh/afiJhOhZ0BW+TtfVDg=
github.com/oneclickvirt/cputest v0.0.8-20240702070215/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
github.com/oneclickvirt/basics v0.0.9-20250205131258 h1:LytqWIVlzT1ZS/thB8ZXk7tEpoaj+i6pBQBtACziBjc=
github.com/oneclickvirt/basics v0.0.9-20250205131258/go.mod h1:fUdVpU8gdjaZsTCyqnQBAbHc9BbbN8Fxr3sGPKooUpU=
github.com/oneclickvirt/cputest v0.0.9-20250103063414 h1:G69wbgHs3oDL1PraQ+8k0Gtefpj5eMTfCQGhz2dcfA8=
github.com/oneclickvirt/cputest v0.0.9-20250103063414/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
github.com/oneclickvirt/defaultset v0.0.2-20240624082446 h1:5Pg3mK/u/vQvSz7anu0nxzrNdELi/AcDAU1mMsmPzyc=
github.com/oneclickvirt/defaultset v0.0.2-20240624082446/go.mod h1:e9Jt4tf2sbemCtc84/XgKcHy9EZ2jkc5x2sW1NiJS+E=
github.com/oneclickvirt/disktest v0.0.4-20240809053456 h1:g6fKzvImIV8YQZKKEJ2FdvooL+EUf9NndAU8c4aGCX4=
@@ -120,24 +119,24 @@ github.com/oneclickvirt/gostun v0.0.3-20240702054621 h1:IE89eEYV9TJbF94SakQDAxTL
github.com/oneclickvirt/gostun v0.0.3-20240702054621/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
github.com/oneclickvirt/memorytest v0.0.4-20240820095126 h1:Il3rvWkrZy/6B2iO3HRe9039/qRllA4CzcZ/dI8aG2A=
github.com/oneclickvirt/memorytest v0.0.4-20240820095126/go.mod h1:+YNzy+NeVg61d0kNwSyVDqHyVtKzjuRe1NvMzsDLg0I=
github.com/oneclickvirt/nt3 v0.0.3-20240809100110 h1:UyF0jBDP0xpxSV9L/GYG83SKUMPSjHPru+3iPZHYG7U=
github.com/oneclickvirt/nt3 v0.0.3-20240809100110/go.mod h1:4SDl5o83wbixk9YJqvG0eNo2w8aWt/QgntfPBi9wEpY=
github.com/oneclickvirt/pingtest v0.0.5-20240804134050 h1:ASiYr+IgWIPDhTiXEN1dbm1AEcxRkPnKi3NNn4mCkDE=
github.com/oneclickvirt/pingtest v0.0.5-20240804134050/go.mod h1:d3Ntx5m9lMll3a/k3+2B+5emj//vgDh4/NHTxs2qQE8=
github.com/oneclickvirt/portchecker v0.0.2-20240803151204 h1:ZruxRgyIv3d6Y8n0Ney5FHhQtcQLxCvs+xJmGsh9/7E=
github.com/oneclickvirt/portchecker v0.0.2-20240803151204/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
github.com/oneclickvirt/nt3 v0.0.4-20250118032755 h1:phF5kngqoPnS6onIbKII9ndw/N5l3ciIgR7fK5mfSBk=
github.com/oneclickvirt/nt3 v0.0.4-20250118032755/go.mod h1:lDpHmjWwLZd6pO8cZCwzrc5rwd8dK+TIYk+DGmRpSGg=
github.com/oneclickvirt/pingtest v0.0.5-20241006123443 h1:Ywrh0Yd/PYXOKGE8VaNiKGWlIqdgLLgsthAzxy0t7s8=
github.com/oneclickvirt/pingtest v0.0.5-20241006123443/go.mod h1:d3Ntx5m9lMll3a/k3+2B+5emj//vgDh4/NHTxs2qQE8=
github.com/oneclickvirt/portchecker v0.0.3-20250118031146 h1:tXTcpq8P3KgQupEZhPcAwdiyXYy//jXGb28bp4bSt4g=
github.com/oneclickvirt/portchecker v0.0.3-20250118031146/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
github.com/oneclickvirt/security v0.0.4-20240729065854 h1:I27XtMUEHmXw1RN0jNDQmFqNdu6vL4v1g8UZtXiCuBY=
github.com/oneclickvirt/security v0.0.4-20240729065854/go.mod h1:384ZpNE3H6T6rtl0QhA4eQn8xGw7tc0rLD8ZH47qNGc=
github.com/oneclickvirt/speedtest v0.0.7-20240704023701 h1:F8ChZXf3U1/bUk+dCFt0Gc01LSPLhbBhCeHjkEJ6K88=
github.com/oneclickvirt/speedtest v0.0.7-20240704023701/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
github.com/oneclickvirt/speedtest v0.0.8-20241005164804 h1:qguczGucxyRCRaeI2Av7+QpgYb6o8lTJJmOjPkmGiSg=
github.com/oneclickvirt/speedtest v0.0.8-20241005164804/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
github.com/onsi/ginkgo/v2 v2.22.1 h1:QW7tbJAUDyVDVOM5dFa7qaybo+CRfR7bemlQUN6Z8aM=
github.com/onsi/ginkgo/v2 v2.22.1/go.mod h1:S6aTpoRsSq2cZOd+pssHAlKW/Q/jZt6cPrPlnj4a1xM=
github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw=
github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE=
github.com/oschwald/maxminddb-golang v1.13.1/go.mod h1:K4pgV9N/GcK694KSTmVSDTODk4IsCNThNdTmnaBZ/F8=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8=
github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
@@ -157,21 +156,21 @@ github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/prometheus-community/pro-bing v0.4.1 h1:aMaJwyifHZO0y+h8+icUz0xbToHbia0wdmzdVZ+Kl3w=
github.com/prometheus-community/pro-bing v0.4.1/go.mod h1:aLsw+zqCaDoa2RLVVSX3+UiCkBBXTMtZC3c7EkfWnAE=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/quic-go v0.45.1 h1:tPfeYCk+uZHjmDRwHHQmvHRYL2t44ROTujLeFVBmjCA=
github.com/quic-go/quic-go v0.45.1/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI=
github.com/refraction-networking/utls v1.6.6 h1:igFsYBUJPYM8Rno9xUuDoM5GQrVEqY4llzEXOkL43Ig=
github.com/refraction-networking/utls v1.6.6/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
github.com/quic-go/quic-go v0.48.2 h1:wsKXZPeGWpMpCGSWqOcqpW2wZYic/8T3aqiOID0/KWE=
github.com/quic-go/quic-go v0.48.2/go.mod h1:yBgs3rWBOADpga7F+jJsb6Ybg1LSYiQvwWlLX+/6HMs=
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rodaine/table v1.2.0 h1:38HEnwK4mKSHQJIkavVj+bst1TEY7j9zhLMWu4QJrMA=
github.com/rodaine/table v1.2.0/go.mod h1:wejb/q/Yd4T/SVmBSRMr7GCq3KlcZp3gyNYdLSBhkaE=
github.com/rodaine/table v1.3.0 h1:4/3S3SVkHnVZX91EHFvAMV7K42AnJ0XuymRR2C5HlGE=
github.com/rodaine/table v1.3.0/go.mod h1:47zRsHar4zw0jgxGxL9YtFfs7EGN6B/TaS+/Dmk4WxU=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk=
github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0=
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74=
@@ -188,10 +187,10 @@ github.com/showwin/speedtest-go v1.7.7 h1:VmK75SZOTKiuWjIVrs+mo7ZoKEw0utiGCvpnur
github.com/showwin/speedtest-go v1.7.7/go.mod h1:uLgdWCNarXxlYsL2E5TOZpCIwpgSWnEANZp7gfHXHu0=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
@@ -205,12 +204,13 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U=
github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
@@ -222,13 +222,15 @@ github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYg
github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE=
github.com/tsosunchia/powclient v0.1.5 h1:hpixFWoPbWSEC0zc9osSltyjtr1+SnhCueZVLkEpyyU=
github.com/tsosunchia/powclient v0.1.5/go.mod h1:yNlzyq+w9llYZV+0q7nrX83ULy4ghq2mCjpTLJFJ2pg=
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
@@ -238,16 +240,16 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
@@ -256,14 +258,14 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -272,15 +274,14 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -288,30 +289,30 @@ golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=
golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

108
goecs.go
View File

@@ -39,7 +39,7 @@ import (
)
var (
ecsVersion = "v0.0.76"
ecsVersion = "v0.1.12"
menuMode bool
onlyChinaTest bool
input, choice string
@@ -61,23 +61,21 @@ var (
enabelUpload = true
help bool
goecsFlag = flag.NewFlagSet("goecs", flag.ContinueOnError)
finish bool
)
func getMenuChoice(language string) string {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
defer signal.Stop(sigChan)
inputChan := make(chan string, 1)
go func() {
select {
case <-sigChan:
fmt.Println("\n程序在选择过程中被用户中断")
os.Exit(1)
os.Exit(0)
case <-ctx.Done():
return
}
@@ -96,15 +94,14 @@ func getMenuChoice(language string) string {
return
}
}()
select {
case input := <-inputChan:
re := regexp.MustCompile(`^\d+$`) // 正则表达式匹配纯数字
if re.MatchString(input) {
choice := input
switch choice {
inChoice := input
switch inChoice {
case "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
return choice
return inChoice
default:
if language == "zh" {
fmt.Println("无效的选项")
@@ -210,7 +207,7 @@ func main() {
}
Loop:
for {
choice := getMenuChoice(language)
choice = getMenuChoice(language)
switch choice {
case "1":
basicStatus = true
@@ -311,27 +308,64 @@ func main() {
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
output, tempOutput string
)
// 设置主程序的信号处理
// 信号处理部分
uploadDone := make(chan bool, 1)
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
// 启动一个goroutine来等待信号,内置计时器
// 启动一个goroutine来等待信号
go func() {
startTime = time.Now()
// 等待信号
<-sig
endTime := time.Now()
duration := endTime.Sub(startTime)
minutes := int(duration.Minutes())
seconds := int(duration.Seconds()) % 60
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
output = utils.PrintAndCapture(func() {
utils.PrintCenteredTitle("", width)
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
fmt.Printf("Current Time : %s\n", currentTime)
utils.PrintCenteredTitle("", width)
}, tempOutput, output)
utils.ProcessAndUpload(output, filePath, enabelUpload)
os.Exit(1) // 使用非零状态码退出,表示意外退出
select {
case <-sig:
if !finish {
endTime := time.Now()
duration := endTime.Sub(startTime)
minutes := int(duration.Minutes())
seconds := int(duration.Seconds()) % 60
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
var mu sync.Mutex
mu.Lock()
output = utils.PrintAndCapture(func() {
utils.PrintCenteredTitle("", width)
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
fmt.Printf("Current Time : %s\n", currentTime)
utils.PrintCenteredTitle("", width)
}, tempOutput, output)
mu.Unlock()
// 创建一个通道来传递上传结果
resultChan := make(chan struct {
httpURL string
httpsURL string
}, 1) // 使用带缓冲的通道,避免可能的阻塞
// 启动上传
go func() {
httpURL, httpsURL := utils.ProcessAndUpload(output, filePath, enabelUpload)
resultChan <- struct {
httpURL string
httpsURL string
}{httpURL, httpsURL}
uploadDone <- true
}()
// 等待上传完成或超时
select {
case result := <-resultChan:
if result.httpURL != "" || result.httpsURL != "" {
if language == "en" {
fmt.Printf("Upload successfully!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL)
} else {
fmt.Printf("上传成功!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL)
}
}
// 给打印操作一些时间完成
time.Sleep(100 * time.Millisecond)
os.Exit(0)
case <-time.After(30 * time.Second):
fmt.Println("上传超时,程序退出")
os.Exit(1)
}
}
os.Exit(0)
}
}()
switch language {
case "zh":
@@ -341,7 +375,7 @@ func main() {
if basicStatus {
utils.PrintCenteredTitle("系统基础信息", width)
}
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
basicInfo, securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus)
if basicStatus {
fmt.Printf(basicInfo)
} else if (input == "6" || input == "9") && securityTestStatus {
@@ -451,14 +485,16 @@ func main() {
if speedTestStatus {
utils.PrintCenteredTitle("就近节点测速", width)
speedtest.ShowHead(language)
if (menuMode && choice == "1") || !menuMode {
if choice == "1" || !menuMode {
speedtest.NearbySP()
speedtest.CustomSP("net", "global", 2, language)
speedtest.CustomSP("net", "cu", spNum, language)
speedtest.CustomSP("net", "ct", spNum, language)
speedtest.CustomSP("net", "cmcc", spNum, language)
} else if menuMode && choice == "2" || choice == "3" || choice == "4" || choice == "5" {
} else if choice == "2" || choice == "3" || choice == "4" || choice == "5" {
speedtest.CustomSP("net", "global", 4, language)
} else if choice == "6" {
speedtest.CustomSP("net", "global", 11, language)
}
}
}, tempOutput, output)
@@ -480,7 +516,7 @@ func main() {
if basicStatus {
utils.PrintCenteredTitle("System-Basic-Information", width)
}
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
basicInfo, securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus)
if basicStatus {
fmt.Printf(basicInfo)
} else if (input == "6" || input == "9") && securityTestStatus {
@@ -573,7 +609,15 @@ func main() {
default:
fmt.Println("Unsupported language")
}
utils.ProcessAndUpload(output, filePath, enabelUpload)
httpURL, httpsURL := utils.ProcessAndUpload(output, filePath, enabelUpload)
if httpURL != "" || httpsURL != "" {
if language == "en" {
fmt.Printf("Upload successfully!\nHttp URL: %s\nHttps URL: %s\n", httpURL, httpsURL)
} else {
fmt.Printf("上传成功!\nHttp URL: %s\nHttps URL: %s\n", httpURL, httpsURL)
}
}
finish = true
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
fmt.Println("Press Enter to exit...")
fmt.Scanln()

649
goecs.sh
View File

@@ -1,8 +1,10 @@
#!/bin/bash
#From https://github.com/oneclickvirt/ecs
#2024.07.21
# From https://github.com/oneclickvirt/ecs
# 2024.12.08
# curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
# 或
# curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh
cat <<"EOF"
GGGGGGGG OOOOOOO EEEEEEEE CCCCCCCCC SSSSSSSSSS
@@ -24,6 +26,7 @@ _red() { echo -e "\033[31m\033[01m$@\033[0m"; }
_green() { echo -e "\033[32m\033[01m$@\033[0m"; }
_yellow() { echo -e "\033[33m\033[01m$@\033[0m"; }
_blue() { echo -e "\033[36m\033[01m$@\033[0m"; }
reading() { read -rp "$(_green "$1")" "$2"; }
check_cdn() {
local o_url=$1
@@ -59,135 +62,244 @@ download_file() {
return 0
}
check_china() {
_yellow "正在检测IP所在区域......"
if [[ -z "${CN}" ]]; then
# 首先尝试通过 ipapi.co 检测
if curl -m 6 -s https://ipapi.co/json | grep -q 'China'; then
_yellow "根据ipapi.co提供的信息当前IP可能在中国"
if [ "$noninteractive" != "true" ]; then
reading "是否使用中国镜像完成安装? ([y]/n) " input
case $input in
[yY][eE][sS] | [yY] | "")
_green "已选择使用中国镜像"
CN=true
;;
[nN][oO] | [nN])
_yellow "已选择不使用中国镜像"
CN=false
;;
*)
_green "已选择使用中国镜像"
CN=true
;;
esac
else
# 在非交互模式下默认使用中国镜像
CN=true
fi
else
# 如果 ipapi.co 检测失败,尝试使用 cip.cc
if ! curl -m 6 -s https://ipapi.co/json >/dev/null 2>&1; then
if curl -m 6 -s cip.cc | grep -q "中国"; then
_yellow "根据cip.cc提供的信息当前IP可能在中国"
if [ "$noninteractive" != "true" ]; then
reading "是否使用中国镜像完成安装? ([y]/n) " input
case $input in
[yY][eE][sS] | [yY] | "")
_green "已选择使用中国镜像"
CN=true
;;
[nN][oO] | [nN])
_yellow "已选择不使用中国镜像"
CN=false
;;
*)
_green "已选择使用中国镜像"
CN=true
;;
esac
else
# 在非交互模式下默认使用中国镜像
CN=true
fi
else
CN=false
fi
else
CN=false
fi
fi
fi
}
get_memory_size() {
if [ -f /proc/meminfo ]; then
local mem_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
echo $((mem_kb / 1024)) # Convert to MB
return
fi
if command -v free >/dev/null 2>&1; then
local mem_kb=$(free -m | awk '/^Mem:/ {print $2}')
echo "$mem_kb" # Already in MB
return
fi
if command -v sysctl >/dev/null 2>&1; then
local mem_bytes=$(sysctl -n hw.memsize 2>/dev/null || sysctl -n hw.physmem 2>/dev/null)
if [ -n "$mem_bytes" ]; then
echo $((mem_bytes / 1024 / 1024)) # Convert to MB
return
fi
fi
}
cleanup_epel() {
_yellow "Cleaning up EPEL repositories..."
rm -f /etc/yum.repos.d/*epel*
yum clean all
}
goecs_check() {
os=$(uname -s)
arch=$(uname -m)
ECS_VERSION=$(curl -m 6 -sSL "https://api.github.com/repos/oneclickvirt/ecs/releases/latest" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
# 如果 https://api.github.com/ 请求失败,则使用 https://githubapi.spiritlhl.workers.dev/ 此时可能宿主机无IPV4网络
# Get system and architecture info with error handling
os=$(uname -s 2>/dev/null || echo "Unknown")
arch=$(uname -m 2>/dev/null || echo "Unknown")
# First check for China IP
check_china
# Get latest version number with multiple backup sources
ECS_VERSION=""
for api in \
"https://api.github.com/repos/oneclickvirt/ecs/releases/latest" \
"https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" \
"https://githubapi.spiritlhl.top/repos/oneclickvirt/ecs/releases/latest"; do
ECS_VERSION=$(curl -m 6 -sSL "$api" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
if [ -n "$ECS_VERSION" ]; then
break
fi
sleep 1
done
if [ -z "$ECS_VERSION" ]; then
ECS_VERSION=$(curl -m 6 -sSL "https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
_yellow "Unable to get version info, using default version 0.1.8"
ECS_VERSION="0.1.8"
fi
# 如果 https://githubapi.spiritlhl.workers.dev/ 请求失败,则使用 https://githubapi.spiritlhl.top/ ,此时可能宿主机在国内
if [ -z "$ECS_VERSION" ]; then
ECS_VERSION=$(curl -m 6 -sSL "https://githubapi.spiritlhl.top/repos/oneclickvirt/ecs/releases/latest" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
fi
# 检测原始goecs命令是否存在若存在则升级不存在则安装
version_output=$(goecs -v command 2>/dev/null || ./goecs -v command 2>/dev/null)
if [ $? -eq 0 ]; then
# Check if original goecs command exists
version_output=""
for cmd_path in "goecs" "./goecs" "/usr/bin/goecs" "/usr/local/bin/goecs"; do
if [ -x "$(command -v $cmd_path 2>/dev/null)" ]; then
version_output=$($cmd_path -v command 2>/dev/null)
break
fi
done
if [ -n "$version_output" ]; then
extracted_version=${version_output//v/}
if [ -n "$extracted_version" ]; then
ecs_version=$ECS_VERSION
if [[ "$(echo -e "$extracted_version\n$ecs_version" | sort -V | tail -n 1)" == "$extracted_version" ]]; then
_green "goecs version ($extracted_version) is latest, no need to upgrade."
_green "goecs version ($extracted_version) is up to date, no upgrade needed"
return
else
_yellow "goecs version ($extracted_version) < $ecs_version, need to upgrade, 5 seconds later will start to upgrade"
rm -rf /usr/bin/goecs
rm -rf goecs
_yellow "goecs version ($extracted_version) < $ecs_version, upgrade needed, starting in 5 seconds"
rm -rf /usr/bin/goecs /usr/local/bin/goecs ./goecs
fi
fi
else
_green "Can not find goecs, need to download and install, 5 seconds later will start to install"
_green "goecs not found, installation needed, starting in 5 seconds"
fi
sleep 5
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
check_cdn_file
# Download corresponding version with error handling
if [[ "$CN" == true ]]; then
_yellow "Using China mirror for download..."
base_url="https://cnb.cool/oneclickvirt/ecs/-/git/raw/main"
else
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
check_cdn_file
if [ -n "$cdn_success_url" ]; then
base_url="${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}"
else
base_url="https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}"
fi
fi
# Build download URL with architecture support
local zip_file=""
case $os in
Linux)
Linux|linux|LINUX)
case $arch in
"x86_64" | "x86" | "amd64" | "x64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_amd64.zip" "goecs.zip"
;;
"i386" | "i686")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_386.zip" "goecs.zip"
;;
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_arm64.zip" "goecs.zip"
;;
"mips")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mips.zip" "goecs.zip"
;;
"mipsle")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mipsle.zip" "goecs.zip"
;;
"s390x")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_s390x.zip" "goecs.zip"
;;
"riscv64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_riscv64.zip" "goecs.zip"
;;
*)
_red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
exit 1
;;
x86_64|amd64|x64) zip_file="goecs_linux_amd64.zip" ;;
i386|i686) zip_file="goecs_linux_386.zip" ;;
aarch64|arm64|armv8|armv8l) zip_file="goecs_linux_arm64.zip" ;;
arm|armv7l) zip_file="goecs_linux_arm.zip" ;;
mips) zip_file="goecs_linux_mips.zip" ;;
mipsle) zip_file="goecs_linux_mipsle.zip" ;;
s390x) zip_file="goecs_linux_s390x.zip" ;;
riscv64) zip_file="goecs_linux_riscv64.zip" ;;
*) zip_file="goecs_linux_amd64.zip" ;;
esac
;;
FreeBSD)
FreeBSD|freebsd)
case $arch in
"x86_64" | "x86" | "amd64" | "x64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_amd64.zip" "goecs.zip"
;;
"i386" | "i686")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_386.zip" "goecs.zip"
;;
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_arm64.zip" "goecs.zip"
;;
*)
_red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
exit 1
;;
x86_64|amd64) zip_file="goecs_freebsd_amd64.zip" ;;
i386|i686) zip_file="goecs_freebsd_386.zip" ;;
arm64|aarch64) zip_file="goecs_freebsd_arm64.zip" ;;
*) zip_file="goecs_freebsd_amd64.zip" ;;
esac
;;
Darwin)
Darwin|darwin)
case $arch in
"x86_64" | "x86" | "amd64" | "x64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_amd64.zip" "goecs.zip"
;;
"armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64")
download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_arm64.zip" "goecs.zip"
;;
*)
_red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
exit 1
;;
x86_64|amd64) zip_file="goecs_darwin_amd64.zip" ;;
arm64|aarch64) zip_file="goecs_darwin_arm64.zip" ;;
*) zip_file="goecs_darwin_amd64.zip" ;;
esac
;;
*)
_red "Unsupported operating system: $os , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing."
exit 1
_yellow "Unknown system $os, trying amd64 version"
zip_file="goecs_linux_amd64.zip"
;;
esac
unzip goecs.zip
rm -rf goecs.zip
rm -rf README.md
rm -rf LICENSE
sleep 1
chmod 777 goecs
rm -rf /usr/bin/goecs
sleep 1
cp goecs /usr/bin/goecs
rm -rf README_EN.md
rm -rf README.md
PARAM="net.ipv4.ping_group_range"
NEW_VALUE="0 2147483647"
CURRENT_VALUE=$(sysctl -n "$PARAM" 2>/dev/null)
if [ -f /etc/sysctl.conf ] && [ "$CURRENT_VALUE" != "$NEW_VALUE" ]; then
if grep -q "^$PARAM" /etc/sysctl.conf; then
sudo sed -i "s/^$PARAM.*/$PARAM = $NEW_VALUE/" /etc/sysctl.conf
else
echo "$PARAM = $NEW_VALUE" | sudo tee -a /etc/sysctl.conf
download_url="${base_url}/${zip_file}"
_green "Downloading $download_url"
# Download file with retry mechanism
local max_retries=3
local retry_count=0
while [ $retry_count -lt $max_retries ]; do
if download_file "$download_url" "goecs.zip"; then
break
fi
sudo sysctl -p
_yellow "Download failed, retrying (${retry_count}/${max_retries})..."
retry_count=$((retry_count + 1))
sleep 2
done
if [ $retry_count -eq $max_retries ]; then
_red "Download failed, please check your network connection or download manually"
return 1
fi
setcap cap_net_raw=+ep goecs
setcap cap_net_raw=+ep /usr/bin/goecs
echo "goecs version:"
# Extract and install with error handling
if ! unzip -o goecs.zip >/dev/null 2>&1; then
_red "Extraction failed"
return 1
fi
rm -f goecs.zip README.md LICENSE README_EN.md
# Set execution permissions and install
chmod 777 goecs
for install_path in "/usr/bin" "/usr/local/bin"; do
if [ -d "$install_path" ]; then
cp -f goecs "$install_path/"
break
fi
done
# Set system parameters
if [ "$os" != "Darwin" ]; then
PARAM="net.ipv4.ping_group_range"
NEW_VALUE="0 2147483647"
if [ -f /etc/sysctl.conf ]; then
if grep -q "^$PARAM" /etc/sysctl.conf; then
sed -i "s/^$PARAM.*/$PARAM = $NEW_VALUE/" /etc/sysctl.conf
else
echo "$PARAM = $NEW_VALUE" >> /etc/sysctl.conf
fi
sysctl -p >/dev/null 2>&1
fi
fi
# Set special permissions
setcap cap_net_raw=+ep goecs 2>/dev/null
setcap cap_net_raw=+ep /usr/bin/goecs 2>/dev/null
setcap cap_net_raw=+ep /usr/local/bin/goecs 2>/dev/null
_green "goecs installation complete, current version:"
goecs -v || ./goecs -v
}
InstallSysbench() {
if [ -f "/etc/centos-release" ]; then # CentOS
if [ -f "/etc/opencloudos-release" ]; then # OpenCloudOS
Var_OSRelease="opencloudos"
elif [ -f "/etc/centos-release" ]; then # CentOS
Var_OSRelease="centos"
elif [ -f "/etc/fedora-release" ]; then # Fedora
Var_OSRelease="fedora"
@@ -203,7 +315,6 @@ InstallSysbench() {
Var_OSRelease="alpinelinux"
elif [ -f "/etc/almalinux-release" ]; then # almalinux
Var_OSRelease="almalinux"
# rockylinux
elif [ -f "/etc/arch-release" ]; then # archlinux
Var_OSRelease="arch"
elif [ -f "/etc/freebsd-update.conf" ]; then # freebsd
@@ -211,15 +322,70 @@ InstallSysbench() {
else
Var_OSRelease="unknown" # 未知系统分支
fi
case "$Var_OSRelease" in
ubuntu | debian | astra) ! apt-get install -y sysbench && apt-get --fix-broken install -y && apt-get install --no-install-recommends -y sysbench ;;
centos | rhel | almalinux | redhat) (yum -y install epel-release && yum -y install sysbench) || (dnf install epel-release -y && dnf install sysbench -y) ;;
fedora) dnf -y install sysbench ;;
arch) pacman -S --needed --noconfirm sysbench && pacman -S --needed --noconfirm libaio && ldconfig ;;
freebsd) pkg install -y sysbench ;;
alpinelinux) echo -e "${Msg_Warning}Sysbench Module not found, installing ..." && echo -e "${Msg_Warning}SysBench Current not support Alpine Linux, Skipping..." && Var_Skip_SysBench="1" ;;
*) _red "Sysbench Install Error: Unknown OS release: $os_release" ;;
esac
local mem_size=$(get_memory_size)
if [ -z "$mem_size" ] || [ "$mem_size" -eq 0 ]; then
echo "Error: Unable to determine memory size or memory size is zero."
elif [ $mem_size -lt 1024 ]; then
_red "Warning: Your system has less than 1GB RAM (${mem_size}MB)"
if [ "$noninteractive" != "true" ]; then
reading "Do you want to continue with EPEL installation? (y/N): " confirm
if [[ ! $confirm =~ ^[Yy]$ ]]; then
_yellow "Skipping EPEL installation"
return 1
fi
fi
case "$Var_OSRelease" in
ubuntu | debian | astra)
! apt-get install -y sysbench && apt-get --fix-broken install -y && apt-get install --no-install-recommends -y sysbench ;;
centos | rhel | almalinux | redhat | opencloudos)
(yum -y install epel-release && yum -y install sysbench) || (dnf install epel-release -y && dnf install sysbench -y) ;;
fedora)
dnf -y install sysbench ;;
arch)
pacman -S --needed --noconfirm sysbench && pacman -S --needed --noconfirm libaio && ldconfig ;;
freebsd)
pkg install -y sysbench ;;
alpinelinux)
if [ "$noninteractive" != "true" ]; then
reading "Do you want to continue with sysbench installation? (y/N): " confirm
if [[ ! $confirm =~ ^[Yy]$ ]]; then
_yellow "Skipping sysbench installation"
return 1
fi
fi
ALPINE_VERSION=$(grep -o '^[0-9]\+\.[0-9]\+' /etc/alpine-release)
COMMUNITY_REPO="http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community"
if grep -q "^${COMMUNITY_REPO}" /etc/apk/repositories; then
echo "Community repository is already enabled."
else
echo "Enabling community repository..."
echo "${COMMUNITY_REPO}" >> /etc/apk/repositories
echo "Community repository has been added."
echo "Updating apk package index..."
apk update && echo "Package index updated successfully."
fi
if apk info sysbench >/dev/null 2>&1; then
echo -e "${Msg_Info}Sysbench already installed."
else
apk add --no-cache sysbench
if [ $? -ne 0 ]; then
echo -e "${Msg_Warning}Sysbench Module not found, installing ..." && echo -e "${Msg_Warning}SysBench Current not support Alpine Linux, Skipping..." && Var_Skip_SysBench="1"
else
echo -e "${Msg_Success}Sysbench installed successfully."
fi
fi ;;
*)
_red "Sysbench Install Error: Unknown OS release: $Var_OSRelease" ;;
esac
if [[ $SYSTEM =~ ^(CentOS|RHEL|AlmaLinux)$ ]]; then
_yellow "Installing EPEL repository..."
if ! yum -y install epel-release; then
_red "EPEL installation failed!"
cleanup_epel
_yellow "Attempting to continue without EPEL..."
fi
fi
fi
}
Check_SysBench() {
@@ -248,6 +414,9 @@ Check_Sysbench_InstantBuild() {
if [ "$os_sysbench" = "astra" ]; then
os_sysbench="debian"
fi
if [ "$os_sysbench" = "opencloudos" ]; then
os_sysbench="centos"
fi
echo -e "${Msg_Info}Release Detected: ${os_sysbench}"
echo -e "${Msg_Info}Preparing compile enviorment ..."
prepare_compile_env "${os_sysbench}"
@@ -282,15 +451,15 @@ prepare_compile_env() {
}
env_check() {
REGEX=("debian|astra" "ubuntu" "centos|red hat|kernel|oracle linux|alma|rocky" "'amazon linux'" "fedora" "arch" "freebsd" "alpine" "openbsd")
RELEASE=("Debian" "Ubuntu" "CentOS" "CentOS" "Fedora" "Arch" "FreeBSD" "Alpine" "OpenBSD")
PACKAGE_UPDATE=("apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update" "pacman -Sy" "pkg update" "apk update" "pkg_add -u")
PACKAGE_INSTALL=("apt-get -y install" "apt-get -y install" "yum -y install" "yum -y install" "yum -y install" "pacman -Sy --noconfirm --needed" "pkg install -y" "apk add")
PACKAGE_REMOVE=("apt-get -y remove" "apt-get -y remove" "yum -y remove" "yum -y remove" "yum -y remove" "pacman -Rsc --noconfirm" "pkg delete" "apk del")
PACKAGE_UNINSTALL=("apt-get -y autoremove" "apt-get -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove" "" "pkg autoremove" "apk autoremove")
# 检查系统信息
if [ -f /etc/alpine-release ]; then
SYS="alpine"
REGEX=("debian|astra" "ubuntu" "centos|red hat|kernel|oracle linux|alma|rocky" "'amazon linux'" "fedora" "arch" "freebsd" "alpine" "openbsd" "opencloudos")
RELEASE=("Debian" "Ubuntu" "CentOS" "CentOS" "Fedora" "Arch" "FreeBSD" "Alpine" "OpenBSD" "OpenCloudOS")
PACKAGE_UPDATE=("apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update" "pacman -Sy" "pkg update" "apk update" "pkg_add -qu" "yum -y update")
PACKAGE_INSTALL=("apt-get -y install" "apt-get -y install" "yum -y install" "yum -y install" "yum -y install" "pacman -Sy --noconfirm --needed" "pkg install -y" "apk add --no-cache" "pkg_add -I" "yum -y install")
PACKAGE_REMOVE=("apt-get -y remove" "apt-get -y remove" "yum -y remove" "yum -y remove" "yum -y remove" "pacman -Rsc --noconfirm" "pkg delete" "apk del" "pkg_delete -I" "yum -y remove")
PACKAGE_UNINSTALL=("apt-get -y autoremove" "apt-get -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove" "pacman -Rns --noconfirm" "pkg autoremove" "apk autoremove" "pkg_delete -a" "yum -y autoremove")
# Check system information
if [ -f /etc/opencloudos-release ]; then
SYS="opencloudos"
elif [ -s /etc/os-release ]; then
SYS="$(grep -i pretty_name /etc/os-release | cut -d \" -f2)"
elif [ -x "$(type -p hostnamectl)" ]; then
@@ -306,76 +475,104 @@ env_check() {
else
SYS="$(uname -s)"
fi
[[ -n $SYS ]] || exit 1
# 匹配操作系统
# Match operating system
SYSTEM=""
for ((int = 0; int < ${#REGEX[@]}; int++)); do
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
SYSTEM="${RELEASE[int]}"
[[ -n $SYSTEM ]] && break
UPDATE_CMD=${PACKAGE_UPDATE[int]}
INSTALL_CMD=${PACKAGE_INSTALL[int]}
REMOVE_CMD=${PACKAGE_REMOVE[int]}
UNINSTALL_CMD=${PACKAGE_UNINSTALL[int]}
break
fi
done
# 检查是否成功匹配
[[ -n $SYSTEM ]] || exit 1
# 根据 SYSTEM 设置相应的包管理命令
UPDATE_CMD=${PACKAGE_UPDATE[int]}
INSTALL_CMD=${PACKAGE_INSTALL[int]}
REMOVE_CMD=${PACKAGE_REMOVE[int]}
UNINSTALL_CMD=${PACKAGE_UNINSTALL[int]}
echo "System: $SYSTEM"
echo "Update command: $UPDATE_CMD"
echo "Install command: $INSTALL_CMD"
echo "Remove command: $REMOVE_CMD"
echo "Uninstall command: $UNINSTALL_CMD"
# If system is unrecognized, try common package managers
if [ -z "$SYSTEM" ]; then
_yellow "Unable to recognize system, trying common package managers..."
# Try apt
if command -v apt-get >/dev/null 2>&1; then
SYSTEM="Unknown-Debian"
UPDATE_CMD="apt-get update"
INSTALL_CMD="apt-get -y install"
REMOVE_CMD="apt-get -y remove"
UNINSTALL_CMD="apt-get -y autoremove"
# Try yum
elif command -v yum >/dev/null 2>&1; then
SYSTEM="Unknown-RHEL"
UPDATE_CMD="yum -y update"
INSTALL_CMD="yum -y install"
REMOVE_CMD="yum -y remove"
UNINSTALL_CMD="yum -y autoremove"
# Try dnf
elif command -v dnf >/dev/null 2>&1; then
SYSTEM="Unknown-Fedora"
UPDATE_CMD="dnf -y update"
INSTALL_CMD="dnf -y install"
REMOVE_CMD="dnf -y remove"
UNINSTALL_CMD="dnf -y autoremove"
# Try pacman
elif command -v pacman >/dev/null 2>&1; then
SYSTEM="Unknown-Arch"
UPDATE_CMD="pacman -Sy"
INSTALL_CMD="pacman -S --noconfirm"
REMOVE_CMD="pacman -R --noconfirm"
UNINSTALL_CMD="pacman -Rns --noconfirm"
# Try apk
elif command -v apk >/dev/null 2>&1; then
SYSTEM="Unknown-Alpine"
UPDATE_CMD="apk update"
INSTALL_CMD="apk add"
REMOVE_CMD="apk del"
UNINSTALL_CMD="apk del"
elif command -v zypper >/dev/null 2>&1; then
SYSTEM="Unknown-SLES"
UPDATE_CMD="zypper refresh"
INSTALL_CMD="zypper install -y"
REMOVE_CMD="zypper remove -y"
UNINSTALL_CMD="zypper remove -y"
else
_red "Unable to recognize package manager, exiting installation"
exit 1
fi
fi
_green "System information: $SYSTEM"
_green "Update command: $UPDATE_CMD"
_green "Install command: $INSTALL_CMD"
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
check_cdn_file
_green "Update system manager."
${PACKAGE_UPDATE[int]} 2>/dev/null
if ! command -v sudo >/dev/null 2>&1; then
_green "Installing sudo"
${PACKAGE_INSTALL[int]} sudo
fi
if ! command -v wget >/dev/null 2>&1; then
_green "Installing wget"
${PACKAGE_INSTALL[int]} wget
fi
if ! command -v tar >/dev/null 2>&1; then
_green "Installing tar"
${PACKAGE_INSTALL[int]} tar
fi
if ! command -v unzip >/dev/null 2>&1; then
_green "Installing unzip"
${PACKAGE_INSTALL[int]} unzip
fi
if ! command -v systemd-detect-virt >/dev/null 2>&1; then
_green "Installing systemd-detect-virt"
${PACKAGE_INSTALL[int]} systemd-detect-virt
if [ $? -ne 0 ]; then
if ! command -v dmidecode >/dev/null 2>&1; then
_green "Installing dmidecode"
${PACKAGE_INSTALL[int]} dmidecode
_yellow "Warning: System update will be performed"
_yellow "This operation may:"
_yellow "1. Take considerable time"
_yellow "2. Cause temporary network interruptions"
_yellow "3. Impact system stability"
_yellow "4. Affect subsequent system startups"
if [ "$noninteractive" != "true" ]; then
reading "Continue with system update? (y/N): " update_confirm
if [[ ! $update_confirm =~ ^[Yy]$ ]]; then
_yellow "Skipping system update"
_yellow "Note: Some packages may fail to install"
else
_green "Updating system package manager..."
if ! ${UPDATE_CMD} 2>/dev/null; then
_red "System update failed!"
fi
fi
fi
if ! command -v dd >/dev/null 2>&1; then
_green "Installing dd"
${PACKAGE_INSTALL[int]} coreutils
if [ $? -ne 0 ]; then
${PACKAGE_INSTALL[int]} man
# Install necessary commands
for cmd in sudo wget tar unzip iproute2 systemd-detect-virt dd fio; do
if ! command -v "$cmd" >/dev/null 2>&1; then
_green "Installing $cmd"
${INSTALL_CMD} "$cmd"
fi
fi
if ! command -v fio >/dev/null 2>&1; then
_green "Installing fio"
${PACKAGE_INSTALL[int]} fio
fi
if ! command -v sysbench >/dev/null 2>&1 && [ "${REGEX[int]}" != "freebsd" ]; then
done
# sysbench installation
if ! command -v sysbench >/dev/null 2>&1; then
_green "Installing sysbench"
${PACKAGE_INSTALL[int]} sysbench
${INSTALL_CMD} sysbench
if [ $? -ne 0 ]; then
echo "Unable to download sysbench through the system's package manager, speak to try compiling and installing it..."
if ! wget -O /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"; then
echo "wget failed, trying with curl"
curl -Lk -o /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"
fi
echo "Unable to download sysbench through package manager, attempting compilation..."
wget -O /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip" || curl -Lk -o /tmp/sysbench.zip "${cdn_success_url}https://github.com/akopytov/sysbench/archive/1.0.20.zip"
if [ ! -f /tmp/sysbench.zip ]; then
wget -q -O /tmp/sysbench.zip "https://hub.fgit.cf/akopytov/sysbench/archive/1.0.20.zip"
fi
@@ -384,89 +581,102 @@ env_check() {
Check_SysBench
fi
fi
# geekbench and speedtest installation
if ! command -v geekbench >/dev/null 2>&1; then
_green "Installing geekbench"
curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/cputest/main/dgb.sh" -o dgb.sh && chmod +x dgb.sh
bash dgb.sh -v gb5
_blue "If you not want to use geekbench5, you can use"
echo "bash dgb.sh -v gb6"
echo "bash dgb.sh -v gb4"
_blue "to change version, or use"
echo "rm -rf /usr/bin/geekbench*"
_blue "to uninstall geekbench"
rm -rf dgb.sh
fi
if ! command -v speedtest >/dev/null 2>&1; then
_green "Installing geekbench"
_green "Installing speedtest"
curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/speedtest/main/dspt.sh" -o dspt.sh && chmod +x dspt.sh
bash dspt.sh
rm -rf dspt.sh
rm -rf speedtest.tar.gz
_blue "if you want to use golang origin speedtest, you can use"
echo "rm -rf /usr/bin/speedtest"
echo "rm -rf /usr/bin/speedtest-go"
_blue "to uninstall speedtest and speedtest-go"
fi
if ! command -v ping >/dev/null 2>&1; then
_green "Installing ping"
${PACKAGE_INSTALL[int]} iputils-ping >/dev/null 2>&1
${PACKAGE_INSTALL[int]} ping >/dev/null 2>&1
${INSTALL_CMD} iputils-ping >/dev/null 2>&1
${INSTALL_CMD} ping >/dev/null 2>&1
fi
# MacOS support
if [ "$(uname -s)" = "Darwin" ]; then
echo "Detected MacOS. Installing sysbench and fio..."
brew install --force sysbench fio dd
# 有问题需要修复root环境不能brewbrew安装完毕后可能路径不在环境变量中
echo "Detected MacOS, installing sysbench iproute2mac fio..."
brew install --force sysbench iproute2mac fio
else
if ! grep -q "^net.ipv4.ping_group_range = 0 2147483647$" /etc/sysctl.conf; then
echo "net.ipv4.ping_group_range = 0 2147483647" >> /etc/sysctl.conf
sysctl -p
fi
fi
_green "The environment is ready."
_green "The next command is: ./goecs.sh install"
_green "Environment preparation complete."
_green "Next command is: ./goecs.sh install"
}
uninstall_goecs() {
rm -rf /root/goecs
rm -rf /usr/bin/goecs
_green "The command (goecs) has been uninstalled."
rm -rf /root/goecs
rm -rf /usr/bin/goecs
_green "The command (goecs) has been uninstalled."
}
show_help() {
cat <<"EOF"
可用命令:
./goecs.sh env 检查并安装的包:
sudo (几乎所有类 Unix 系统都有。)
tar (几乎所有类 Unix 系统都有。)
unzip (几乎所有类 Unix 系统都有。)
dd (几乎所有类 Unix 系统都有。)
fio (几乎所有类 Unix 系统可以通过系统的包管理器安装。)
sysbench (几乎所有类 Unix 系统可以通过系统的包管理器安装。)
geekbench (geekbench5) (仅支持 IPV4 环境,且内存大于 1GB 并需要持续联网,仅支持 amd64 和 arm64 架构。)
speedtest (使用官方提供的二进制文件以获得更准确的测试结果。)
ping (使用官方提供的二进制文件以获得更准确的测试结果。)
systemd-detect-virt 或 dmidecode (几乎所有类 Unix 系统都有,安装以获得更准确的测试结果。)
事实上sysbench/geekbench 是上述依赖项中唯一必须安装的,没有它们无法测试 CPU 分数。
./goecs.sh env 检查并安装依赖包
警告: 此命令会执行系统更新(可选择),可能:
1. 耗时较长
2. 导致网络短暂中断
3. 影响系统稳定性
4. 影响后续系统启动
对于内存小于1GB的系统还可能导致:
1. 系统卡死
2. SSH连接中断
3. 关键服务失败
推荐:
环境依赖安装过程中挂起执行
必需组件:
sysbench/geekbench (CPU性能测试必需)
可选组件:
sudo, tar, unzip, dd, fio
speedtest (网络测试)
ping (网络连通性测试)
systemd-detect-virt/dmidecode (系统信息检测)
./goecs.sh install 安装 goecs 命令
./goecs.sh upgrade 升级 goecs 命令
./goecs.sh uninstall 卸载 goecs 命令
./goecs.sh help 显示此消息
[English version follows...]
Available commands:
./goecs.sh env Check and Install package:
sudo (Almost all unix-like systems have it.)
tar (Almost all unix-like systems have it.)
unzip (Almost all unix-like systems have it.)
dd (Almost all unix-like systems have it.)
fio (Almost all unix-like systems can be installed through the system's package manager.)
sysbench (Almost all unix-like systems can be installed through the system's package manager.)
geekbench (geekbench5)(Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.)
speedtest (Use the officially provided binaries for more accurate test results.)
ping (Use the officially provided binaries for more accurate test results.)
systemd-detect-virt OR dmidecode (Almost all unix-like systems have it, for more accurate test results.)
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested.
./goecs.sh env Check and Install dependencies
Warning: This command performs system update(optional), which may:
1. Take considerable time
2. Cause temporary network interruptions
3. Impact system stability
4. Affect subsequent system startups
For systems with less than 1GB RAM, additional risks:
1. System freeze
2. SSH connection loss
3. Critical service failures
Recommended:
Hanging execution during environment dependency installation
Required components:
sysbench/geekbench (Required for CPU testing)
Optional components:
sudo, tar, unzip, dd, fio
speedtest (Network testing)
ping (Network connectivity)
systemd-detect-virt/dmidecode (System info detection)
./goecs.sh install Install goecs command
./goecs.sh upgrade Upgrade goecs command
./goecs.sh uninstall Uninstall goecs command
@@ -493,3 +703,4 @@ case "$1" in
show_help
;;
esac

View File

@@ -1,10 +1,12 @@
package utils
import (
"bufio"
"bytes"
"fmt"
"github.com/imroc/req/v3"
"github.com/oneclickvirt/UnlockTests/uts"
"github.com/oneclickvirt/basics/ipv6"
"github.com/oneclickvirt/basics/system"
. "github.com/oneclickvirt/defaultset"
"github.com/oneclickvirt/security/network"
@@ -128,12 +130,12 @@ func CheckChina(enableLogger bool) bool {
return selectChina
}
// SecurityCheck 执行安全检查
func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) {
// BasicsAndSecurityCheck 执行安全检查
func BasicsAndSecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) {
var wgt sync.WaitGroup
var ipInfo, securityInfo, systemInfo string
var err error
wgt.Add(2)
wgt.Add(1)
go func() {
defer wgt.Done()
ipInfo, securityInfo, err = network.NetworkCheck("both", securtyCheckStatus, language)
@@ -141,12 +143,18 @@ func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (stri
fmt.Println(err.Error())
}
}()
wgt.Add(1)
go func() {
defer wgt.Done()
systemInfo = system.CheckSystemInfo(language)
}()
wgt.Wait()
ipv6Info, errv6 := ipv6.GetIPv6Mask(language)
basicInfo := systemInfo + ipInfo
if errv6 == nil && ipv6Info != "" {
basicInfo += ipv6Info
basicInfo += "\n"
}
if strings.Contains(ipInfo, "IPV4") && strings.Contains(ipInfo, "IPV6") {
uts.IPV4 = true
uts.IPV6 = true
@@ -239,95 +247,127 @@ func PrintAndCapture(f func(), tempOutput, output string) string {
// UploadText 上传文本内容到指定URL
func UploadText(absPath string) (string, string, error) {
primaryURL := "http://hpaste.spiritlhl.net/api/upload"
backupURL := "https://paste.spiritlhl.net/api/upload"
primaryURL := "http://hpaste.spiritlhl.net/api/UL/upload"
backupURL := "https://paste.spiritlhl.net/api/UL/upload"
token := network.SecurityUploadToken
client := req.DefaultClient()
client.SetTimeout(6 * time.Second)
client := req.C().SetTimeout(6 * time.Second)
client.R().
SetRetryCount(2).
SetRetryBackoffInterval(1*time.Second, 5*time.Second).
SetRetryFixedInterval(2 * time.Second)
// 打开文件
file, err := os.Open(absPath)
if err != nil {
return "", "", err
return "", "", fmt.Errorf("failed to open file: %w", err)
}
defer file.Close()
// 获取文件信息并检查大小
fileInfo, err := file.Stat()
if err != nil {
return "", "", fmt.Errorf("failed to get file info: %w", err)
}
if fileInfo.Size() > 25*1024 { // 25KB
return "", "", fmt.Errorf("file size exceeds 25KB limit")
}
// 上传逻辑
upload := func(url string) (string, string, error) {
file, err := os.Open(absPath)
if err != nil {
return "", "", fmt.Errorf("failed to re-open file for %s: %w", url, err)
}
defer file.Close()
content, err := io.ReadAll(file)
if err != nil {
return "", "", fmt.Errorf("failed to read file content for %s: %w", url, err)
}
resp, err := client.R().
SetHeader("Authorization", token).
SetHeader("Format", "RANDOM").
SetHeader("Max-Views", "0").
SetHeader("UploadText", "true").
SetHeader("Content-Type", "multipart/form-data").
SetHeader("No-JSON", "true").
SetFileReader("file", "goecs.txt", file).
SetFileBytes("file", filepath.Base(absPath), content).
Post(url)
if err != nil {
return "", "", err
return "", "", fmt.Errorf("failed to make request to %s: %w", url, err)
}
if resp.StatusCode >= 200 && resp.StatusCode <= 299 {
return strings.ReplaceAll(resp.String(), "https://paste.spiritlhl.net/", "http://hpaste.spiritlhl.net/"),
strings.ReplaceAll(resp.String(), "http://hpaste.spiritlhl.net/", "https://paste.spiritlhl.net/"), nil
} else {
return "", "", fmt.Errorf("upload failed with status code: %d", resp.StatusCode)
if resp.StatusCode >= 200 && resp.StatusCode <= 299 && resp.String() != "" {
fileID := strings.TrimSpace(resp.String())
if strings.Contains(fileID, "show") {
fileID = fileID[strings.LastIndex(fileID, "/")+1:]
}
httpURL := fmt.Sprintf("http://hpaste.spiritlhl.net/#/show/%s", fileID)
httpsURL := fmt.Sprintf("https://paste.spiritlhl.net/#/show/%s", fileID)
return httpURL, httpsURL, nil
}
return "", "", fmt.Errorf("upload failed for %s with status code: %d", url, resp.StatusCode)
}
http_url, https_url, err := upload(primaryURL)
// 尝试上传到主URL
httpURL, httpsURL, err := upload(primaryURL)
if err == nil {
return http_url, https_url, nil
return httpURL, httpsURL, nil
}
http_url, https_url, err = upload(backupURL)
// 尝试上传到备份URL
httpURL, httpsURL, err = upload(backupURL)
if err != nil {
return "", "", err
return "", "", fmt.Errorf("failed to upload to both primary and backup URLs: %w", err)
}
return http_url, https_url, nil
return httpURL, httpsURL, nil
}
// ProcessAndUpload 创建结果文件并上传文件
func ProcessAndUpload(output string, filePath string, enableUplaod bool) {
func ProcessAndUpload(output string, filePath string, enableUplaod bool) (string, string) {
// 使用 defer 来处理 panic
defer func() {
if r := recover(); r != nil {
fmt.Printf("处理上传时发生错误: %v\n", r)
}
}()
// 检查文件是否存在
if _, err := os.Stat(filePath); err == nil {
// 文件存在,删除文件
err = os.Remove(filePath)
if err != nil {
fmt.Println("Cannot delete file:", err)
return
fmt.Println("无法删除文件:", err)
return "", ""
}
}
// 创建文件
file, err := os.Create(filePath)
if err != nil {
fmt.Println("Cannot create file:", err)
return
fmt.Println("无法创建文件:", err)
return "", ""
}
defer file.Close()
// 匹配 ANSI 转义序列
ansiRegex := regexp.MustCompile("\x1B\\[[0-9;]+[a-zA-Z]")
// 移除 ANSI 转义序列
cleanedOutput := ansiRegex.ReplaceAllString(output, "")
// 写入文件
_, err = file.WriteString(cleanedOutput)
// 使用 bufio.Writer 提高写入效率
writer := bufio.NewWriter(file)
_, err = writer.WriteString(cleanedOutput)
if err != nil {
fmt.Println("Cannot write to file:", err)
return
} else {
fmt.Println("Write test result in ", filePath)
fmt.Println("无法写入文件:", err)
return "", ""
}
// 确保写入缓冲区的数据都刷新到文件中
err = writer.Flush()
if err != nil {
fmt.Println("无法刷新文件缓冲:", err)
return "", ""
}
fmt.Printf("测试结果已写入 %s\n", filePath)
if enableUplaod {
// 获取文件的绝对路径
absPath, err2 := filepath.Abs(filePath)
if err2 != nil {
fmt.Println("Failed to get absolute file path:", err2)
return
absPath, err := filepath.Abs(filePath)
if err != nil {
fmt.Println("无法获取文件绝对路径:", err)
return "", ""
}
// 上传文件并生成短链接
http_url, https_url, err3 := UploadText(absPath)
if err3 != nil {
fmt.Println("Upload failed, cannot generate short URL.")
fmt.Println(err3.Error())
return
http_url, https_url, err := UploadText(absPath)
if err != nil {
fmt.Println("上传失败,无法生成链接")
fmt.Println(err.Error())
return "", ""
}
fmt.Printf("Upload successful!\nHttp URL:%s\nHttps URL:%s\n", http_url, https_url)
return http_url, https_url
}
return "", ""
}