Compare commits

...

176 Commits

Author SHA1 Message Date
spiritlhl
d61a1879f5 fix: 修复macos上无权限时的测试路径选择 2025-07-01 08:33:30 +00:00
github-actions[bot]
29dd4ac57e chore: update ECS_VERSION to 0.1.46 in goecs.sh 2025-07-01 03:30:58 +00:00
spiritlhl
dc3eff1fe3 fix: 更新版本 2025-07-01 11:20:24 +08:00
spiritlhl
0a0f2199bc fix: 修复内存和硬盘测试的权限校验问题 2025-07-01 03:19:07 +00:00
github-actions[bot]
91004d87f5 chore: update ECS_VERSION to 0.1.45 in goecs.sh 2025-06-30 14:30:04 +00:00
spiritlhl
8f41c37203 fix: 修复windows下的Admin权限检测 2025-06-30 14:18:42 +00:00
github-actions[bot]
12b1ae0702 chore: update ECS_VERSION to 0.1.44 in goecs.sh 2025-06-30 13:43:29 +00:00
spiritlhl
653cd75a97 fix: 修复内存测试在无root环境下测试的权限问题,添加无权限的内存测试方法mbw 2025-06-30 13:32:20 +00:00
github-actions[bot]
ea36e88c9f chore: update ECS_VERSION to 0.1.43 in goecs.sh 2025-06-29 08:49:03 +00:00
spiritlhl
c81ebb3c7a fix: 异步函数传值需要指针传递,值传递可能会出现同步问题 2025-06-29 08:45:15 +00:00
github-actions[bot]
7896b3ead5 chore: update ECS_VERSION to 0.1.42 in goecs.sh 2025-06-29 08:33:10 +00:00
spiritlhl
eb98a7b857 fix: 更加严格的启动条件,同时避免死锁等待 2025-06-29 08:29:24 +00:00
github-actions[bot]
d4d86229de chore: update ECS_VERSION to 0.1.41 in goecs.sh 2025-06-29 07:59:30 +00:00
spiritlhl
651a183382 fix: 修复版本号 2025-06-29 15:55:56 +08:00
spiritlhl
afc313a2a8 fix: 同步流媒体检测的判断逻辑 2025-06-29 15:44:16 +08:00
github-actions[bot]
39ac8d198d chore: update ECS_VERSION to 0.1.40 in goecs.sh 2025-06-29 07:36:33 +00:00
spiritlhl
a70dc2bab1 fix: 更新版本号至 v0.1.40 2025-06-29 07:26:48 +00:00
spiritlhl
5041a16a9a fix: 修复同步机制问题,保护最终输出不出现数据竞争 2025-06-29 07:22:27 +00:00
github-actions[bot]
21deb3587e chore: update ECS_VERSION to 0.1.39 in goecs.sh 2025-06-29 07:07:10 +00:00
spiritlhl
3bac30edc2 fix: 修复协程部分等待位置错误的问题 2025-06-29 07:02:10 +00:00
github-actions[bot]
9ef2ec4a9e chore: update ECS_VERSION to 0.1.38 in goecs.sh 2025-06-29 06:39:24 +00:00
spiritlhl
ac33e00e0a fix: 拆分main函数,分函数方便后续维护,添加前置检测自动切换离线模式 2025-06-29 06:27:59 +00:00
spiritlhl
7a439f7095 fix: 优化编译文件的大小 2025-06-29 10:55:39 +08:00
spiritlhl
e3bfa65f66 Merge pull request #12 from fossabot/add-license-scan-badge
Add license scan report and status
2025-06-29 09:36:58 +08:00
fossabot
74e33a212c Add license scan report and status
Signed off by: fossabot <badges@fossa.com>
2025-06-28 21:22:21 -04:00
spiritlhl
bba8595033 fix: 统一致谢图标大小 2025-06-29 01:00:05 +00:00
spiritlhl
530181be87 feat: 添加zmto对本开源项目的支持 2025-06-29 00:57:46 +00:00
github-actions[bot]
7deb986209 chore: update ECS_VERSION to 0.1.37 in goecs.sh 2025-06-28 14:02:18 +00:00
spiritlhl
ea8e5efbd3 fix: 修复部分失效的流媒体检测,基础信息检测适配MACOS系统 2025-06-28 13:50:54 +00:00
spiritlhl
db88ee8479 fix: 添加sysbench的天梯图: https://sysbench.spiritlhl.net/ 2025-06-15 12:44:45 +00:00
spiritlhl
67a3bfdaad fix: 修复自动更新安装版本中的版本提取代码 2025-06-05 20:45:51 +08:00
spiritlhl
e57ce05c0c fix: 回退修改 2025-06-05 20:39:52 +08:00
spiritlhl
62137f0bb1 fix: 修复仅安装本体时,可能宿主机连curl/unzip都没有的问他 2025-06-05 20:38:56 +08:00
spiritlhl
f9d8c9ee4c fix: 修复step匹配规则 2025-06-03 23:19:46 +08:00
spiritlhl
913a1725c1 fix: 修复版本号问题 2025-06-03 22:17:12 +08:00
spiritlhl
f1acbd361b fix: 自动替换和更新goecs.sh脚本中的最新tag 2025-06-03 22:13:41 +08:00
spiritlhl
d6f62f8624 fix: 添加部分说明 2025-05-23 15:41:48 +08:00
spiritlhl
94da890522 fix: 修复可能的测速延迟显示异常和CPU频率显示异常的问题 2025-05-22 03:16:02 +00:00
spiritlhl
42b94260de fix: 修复IPV6子网掩码识别错误的问题,修复nexttrace的IPV6线路识别替换备用地址错误的问题 2025-05-19 02:25:52 +00:00
spiritsoul
16e2603176 fix: 修改在发布版本后自动进行public分支构建和docker镜像构建 2025-04-25 20:19:19 +08:00
spiritsoul
0ed9840038 fix: 修复磁盘IO测试,添加路径挂载盘大小检测自动缩放测试文件比例 2025-04-25 19:48:41 +08:00
spiritsoul
31b53e13b0 fix: 对接上游更新,nt3加入recover机制 2025-04-16 21:23:09 +08:00
spiritsoul
fb697fa25f fix: 更新版本号 2025-04-13 13:48:08 +08:00
spiritsoul
2510b3ead0 fix: 更新三网ICMP的ping值测试逻辑支持全国各省份 2025-04-13 13:45:18 +08:00
spiritsoul
b64b8a2d96 fix: 更新backtrace的json解析 2025-04-13 13:44:34 +08:00
spiritsoul
663614117d fix: 修复未打印的流媒体测试结果 2025-04-12 17:50:14 +08:00
spiritsoul
a96c9b6c7d feat: 三网路由路线检测支持IPV6路由检测,移动无实际使用的包至于back 2025-04-11 23:33:21 +08:00
spiritsoul
e8f73ba4b8 fix: 当默认不进行环境安装时,确保起码的unzip命令可用 2025-04-07 20:11:52 +08:00
spiritsoul
dd6fbff943 fix: 替换嵌入的静态依赖不指定CPU指令集优化以兼容新旧CPU型号 2025-04-06 14:38:46 +08:00
spiritsoul
e473851a02 fix: 添加无环境依赖说明 2025-04-05 00:13:01 +08:00
spiritsoul
86fc407ccb fix: 修复按Ctrl+C按钮退出程序时,Windows/Macos系统会闪退退出程序的问题 2025-04-04 23:33:18 +08:00
spiritsoul
8e6037c340 fix: 修复说明,去除所有可能的额外环境依赖,最极端环境下单二进制文件可所有项目进行测试 2025-04-04 23:26:15 +08:00
spiritsoul
be59af4411 fix: 即便已自带fio依赖,依然尝试环境安装,不保证自带依赖通用 2025-04-02 22:12:40 +08:00
spiritsoul
7ae753a4e2 feat: disktest添加原生包含fio的静态编译文件,不再需要额外安装fio依赖 2025-04-02 19:20:31 +08:00
spiritsoul
3956420ffe fix: 系统基础信息检测合并同功能函数避免重复 2025-04-01 20:40:25 +08:00
spiritsoul
6ebe25af2d fix: 解决说明歧义 2025-03-31 22:44:10 +08:00
spiritlhl
fe02bd295a fix: 非版本问题系源问题 2025-03-31 22:36:43 +08:00
spiritlhl
172b520702 fix: 回退alpine系统版本,最新版本不可用存在环境依赖缺失 2025-03-31 22:34:32 +08:00
spiritlhl
d460e2b167 fix: alpine系统依赖更新 2025-03-31 22:32:17 +08:00
spiritsoul
03f5fd9e48 fix: 修复IPV6的prefixNum检测,去除系统本身的修改,增加多系统适配 2025-03-31 22:01:29 +08:00
spiritsoul
0b0972cc3e feat: 更新主版本 2025-03-30 20:58:03 +08:00
spiritsoul
8273895def fix: 修复cidr识别 2025-03-30 20:56:54 +08:00
spiritsoul
3e31671502 fix: 修复硬盘的dd测试在fedora上只出现写测试没有读测试的数据,原因系/dev/null和/tmp不可用 2025-03-30 19:03:31 +08:00
spiritsoul
42b3ab3cff fix: 同步修改 2025-03-30 14:01:18 +08:00
spiritlhl
0bef8161e7 fix: 组件迁移 2025-03-29 21:31:00 +08:00
spiritsoul
4f7e37f37c fix: 升级所有关联仓库的依赖 2025-03-29 21:09:27 +08:00
spiritsoul
c0dcea53e3 fix: 更新SecurityCheck依赖 2025-03-29 20:55:37 +08:00
spiritsoul
02034da2d7 fix: 更新御三家检测依赖 2025-03-29 20:43:45 +08:00
spiritsoul
aa6c835aed fix: 更新御三家检测依赖 2025-03-29 20:43:07 +08:00
spiritsoul
2ebfdf7533 fix: 引入 he.net 和 bgp.tools 抓取CIDR 2025-03-29 20:36:17 +08:00
spiritsoul
28e21f0838 feat: 基础信息添加bgp邻居查询和CIDR显示,更新基础系统信息查询依赖 2025-03-29 20:08:20 +08:00
spiritsoul
23aae0b32b fix: 迁移主main暂不使用的组件 2025-03-29 18:45:07 +08:00
spiritlhl
abaf021e1c fix: 修复hits徽章失效的问题,使用项目 https://github.com/oneclickvirt/hitscounter 2025-03-29 08:06:09 +00:00
spiritsoul
be4e46ceba No additional shell file dependencies other than the environment installation shell 2025-03-24 22:01:59 +08:00
lihualong
4746ae14cf Merge branch 'master' of https://github.com/oneclickvirt/ecs 2025-03-24 21:59:05 +08:00
lihualong
eb702c4d97 fix: 修正错误md格式 2025-03-24 21:59:01 +08:00
spiritlhl
86bde156a4 fix: 修复错别字 2025-03-21 22:48:32 +08:00
lihualong
08be6238d2 fix: 更正说明链接地址 2025-03-21 22:22:50 +08:00
lihualong
c0472209b4 fix: 更新说明文档 2025-03-21 22:13:59 +08:00
lihualong
e751b76099 尝试修复BSD系统识别硬盘出错,添加KSM和气球驱动默认值 2025-03-19 18:32:10 +08:00
spiritlhl
bf653ab620 表格展示 2025-03-18 14:37:43 +08:00
spiritlhl
c4b7ba00a1 格式统一 2025-03-18 14:24:42 +08:00
lihualong
87a288907a 修复pingtest可能存在的CDN轮询问题 2025-03-17 21:43:25 +08:00
lihualong
c3aa62753b 修复BSD系统上CPU测试时sysbench出现数值溢出的问题 2025-03-16 19:38:50 +08:00
lihualong
83b8efd7ee 修复FreeBSD系统上IO测试失效的问题,优化日志输出 2025-03-16 18:56:44 +08:00
spiritlhl
2fa0270e4e Update Readme add IBM and Goland Support 2025-03-14 08:35:41 +00:00
lihualong
3bd1136683 v0.1.18 - 修复CDN轮换获取测速地址的逻辑问题 2025-03-08 22:34:15 +08:00
lihualong
d5837ed535 v0.1.17 2025-03-08 21:14:57 +08:00
lihualong
080c62cd93 Update 2025-03-08 21:09:05 +08:00
lihualong
ce690aab2d Merge branch 'master' of https://github.com/oneclickvirt/ecs 2025-03-08 13:32:49 +08:00
lihualong
05ec4d75b8 v0.1.16 修复ping的过程中可能的数组越界问题 2025-03-08 13:32:01 +08:00
spiritlhl
553e0ddef6 Update README_EN.md 2025-03-06 13:02:04 +08:00
spiritlhl
819d155fd5 Update README.md 2025-03-06 13:01:40 +08:00
spiritsoul
d7519801b0 v0.1.15 增加中文致谢以及更新修复部分流媒体检测 2025-03-01 22:56:04 +08:00
spiritsoul
d6302be4ae 修复纯IPV6环境下可能出现的空指针引用问题 2025-02-23 11:51:17 +08:00
spiritsoul
a8366005dc 新增 Apple 检测,修复 Instagram 检测,去除 cip.cc 依赖 2025-02-23 11:39:52 +08:00
spiritlhl
4e3249b590 update 2025-02-18 17:58:59 +08:00
spiritlhl
8a52f6df76 Add help command readme 2025-02-18 17:57:55 +08:00
spiritlhl
ebe85216bb Remove cip.cc 2025-02-18 17:54:23 +08:00
spiritlhl
7909d4ba78 修复speedtest获取测试服务器时可能出现的索引越界问题 2025-02-17 21:37:28 +08:00
spiritlhl
4939d155d8 Improve readme 2025-02-17 21:11:51 +08:00
spiritlhl
d69f85d0db Public test remove upload 2025-02-17 20:57:06 +08:00
spiritlhl
f4dea6ce6e Add after import 2025-02-17 20:47:44 +08:00
spiritlhl
bc596e8e48 Remove security token 2025-02-17 20:45:46 +08:00
spiritlhl
116ae33505 Update 2025-02-17 20:40:54 +08:00
spiritlhl
a32846638b Remove security 2025-02-17 20:39:48 +08:00
spiritlhl
d84fb21f82 Add public branch 2025-02-17 20:35:14 +08:00
spiritlhl
f199336cf0 重构QA 2025-02-05 14:03:26 +00:00
spiritsoul
a1196ab8d2 优化部分说明 2025-02-05 21:30:05 +08:00
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
spiritsoul
a85a06b440 v0.0.76
调整输出文本
2024-10-04 23:53:57 +08:00
spiritsoul
681da08f01 v0.0.75
修复终止命令在选项选择时不可用的问题
展示分享链接时同时展示http和https协议的链接
2024-10-04 23:30:06 +08:00
spiritsoul
bdd00d46f8 v0.0.74 2024-08-25 18:01:24 +08:00
spiritsoul
1f213bb788 update 2024-08-22 20:33:39 +08:00
spiritsoul
1dec7c323b update 2024-08-20 17:22:12 +08:00
spiritsoul
391cc351c4 update 2024-08-20 17:05:54 +08:00
spiritsoul
282a947156 update 2024-08-15 21:47:56 +08:00
38 changed files with 2734 additions and 1206 deletions

View File

@@ -1,6 +1,8 @@
name: Build and Push Docker Image
on:
release:
types: [ published ]
workflow_dispatch:
jobs:
@@ -24,7 +26,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 +41,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

@@ -1,66 +0,0 @@
name: go-ci
on:
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: set up
uses: actions/setup-go@v3
with:
go-version: 1.22.4
id: go
- name: check out
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v2.1.0
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Configure Git for Private Modules
run: |
git config --global url."https://${{ secrets.GHT }}@github.com/".insteadOf "https://github.com/"
git config --global url."git@github.com:".insteadOf "https://github.com/"
env:
GITHUB_TOKEN: ${{ secrets.GHT }}
env:
GOPRIVATE: github.com/oneclickvirt/security
GITHUB_TOKEN: ${{ secrets.GHT }}
build:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure Git for Private Modules
run: |
git config --global url."https://${{ secrets.GHT }}@github.com/".insteadOf "https://github.com/"
git config --global url."git@github.com:".insteadOf "https://github.com/"
env:
GITHUB_TOKEN: ${{ secrets.GHT }}
- name: build
run: go build ./...
env:
GOPRIVATE: github.com/oneclickvirt/security
GITHUB_TOKEN: ${{ secrets.GHT }}
# test:
# needs: setup
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Configure Git for Private Modules
# run: |
# git config --global url."https://${{ secrets.GHT }}@github.com/".insteadOf "https://github.com/"
# git config --global url."git@github.com:".insteadOf "https://github.com/"
# env:
# GITHUB_TOKEN: ${{ secrets.GHT }}
# - name: test
# run: go test ./goecs_test.go
# env:
# GOPRIVATE: github.com/oneclickvirt/security
# GITHUB_TOKEN: ${{ secrets.GHT }}

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: |
@@ -40,3 +40,34 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GHT }}
GOPRIVATE: github.com/oneclickvirt/security
- name: Update goecs.sh with new version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
else
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.1.37")
fi
echo "Using version: $VERSION"
FILE="goecs.sh"
BRANCH="master"
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --unset url."git@github.com:".insteadOf || true
git fetch origin $BRANCH
git checkout $BRANCH
if [ ! -f "$FILE" ]; then
echo "Error: $FILE not found"
exit 1
fi
sed -i "s/\(_yellow \"Unable to get version info, using default version \).*\(\".*\)/\1$VERSION\2/" "$FILE"
sed -i "s/\(ECS_VERSION=\"\).*\(\"\)/\1$VERSION\2/" "$FILE"
if git diff --quiet "$FILE"; then
echo "No changes detected in $FILE"
exit 0
fi
git add "$FILE"
git commit -m "chore: update ECS_VERSION to $VERSION in goecs.sh"
git push origin $BRANCH
env:
GITHUB_TOKEN: ${{ secrets.GHT }}

81
.github/workflows/public-build.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
name: Public Build
on:
release:
types: [ published ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.4'
- name: Create public branch
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git checkout -b public || git checkout public
git merge ${{ github.ref_name }} --no-edit || true
- name: Remove security package references
run: |
# 移除 network 包中对 security 的引用
find . -type f -name "*.go" -exec sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' {} +
# 修改 back/network/network.go
cat > back/network/network.go << 'EOF'
package network1
import "github.com/oneclickvirt/basics/network"
func NetworkCheck(checkType string, enableSecurityCheck bool, language string) (string, string, error) {
ipInfo, _, err := network.NetworkCheck(checkType, false, language)
return ipInfo, "", err
}
EOF
# 修改 utils/utils.go 中的 BasicsAndSecurityCheck 函数
sed -i '/SecurityUploadToken/d' utils/utils.go
sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' utils/utils.go
# 在 utils/utils.go 中添加 token 常量(在 import 语句之后)
sed -i '/^import/,/^)/{/^)/a\'$'\n''const token = "OvwKx5qgJtf7PZgCKbtyojSU.MTcwMTUxNzY1MTgwMw"'$'\n''}' utils/utils.go
# 修改 go.mod移除私有仓库依赖
sed -i '/github.com\/oneclickvirt\/security/d' go.mod
# 修改 goecs.go禁用 security 检测
sed -i 's|var securityFlag = flag.Bool("security", true,|var securityFlag = flag.Bool("security", false,|g' goecs.go
# 更新依赖
go mod tidy
# 修改 README.md 和 README_EN.md 中的敏感信息
sed -i 's|但二进制文件编译至 \[securityCheck\].*)|但已开源|g' README.md
sed -i 's|but binary files compiled in \[securityCheck\].*)|but open sourced|g' README_EN.md
# 修改命令行帮助信息
sed -i 's|security.*Enable/Disable security test (default true)|security Enable/Disable security test (default false)|g' README.md
sed -i 's|security.*Enable/Disable security test (default true)|security Enable/Disable security test (default false)|g' README_EN.md
- name: Build and Test
run: |
# 构建二进制文件
go build -o maintest
# 测试无菜单模式是否正常运行(禁用 security 检测)
./maintest -menu=false -l en -security=false -upload=false || exit 1
rm -rf maintest
- name: Commit and push changes
run: |
git add .
git commit -m "Auto update public version (no security package)" || echo "No changes to commit"
git push -f origin public

56
.github/workflows/sync.yaml vendored Normal file
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 }}

1
.gitignore vendored
View File

@@ -1 +1,2 @@
vendor/
.idea/

View File

@@ -6,7 +6,9 @@ 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 -extldflags=-static
flags:
- -trimpath
goos:
- linux
- windows
@@ -33,7 +35,9 @@ 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
flags:
- -trimpath
goos:
- darwin
goarch:
@@ -46,7 +50,9 @@ 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
flags:
- -trimpath
goos:
- darwin
goarch:

8
.idea/.gitignore generated vendored
View File

@@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

9
.idea/ecs.iml generated
View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ecs.iml" filepath="$PROJECT_DIR$/.idea/ecs.iml" />
</modules>
</component>
</project>

8
.idea/sshConfigs.xml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SshConfigs">
<configs>
<sshConfig authType="PASSWORD" host="49.234.158.14" id="950b8219-3ab3-47e7-ad76-6b6a5d0857b0" port="22" nameFormat="DESCRIPTIVE" username="root" useOpenSSHConfig="true" />
</configs>
</component>
</project>

6
.idea/vcs.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

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

340
README.md
View File

@@ -1,137 +1,184 @@
# 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反馈
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs?ref=badge_shield)
Shell版本 https://github.com/spiritLHLS/ecs
[![Hits](https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net)
## 语言
融合怪测评项目 - GO版本
(环境安装[非必须]使用shell外无额外shell文件依赖环境安装只是为了测的更准极端情况下无环境依赖安装也可全测项目)
如有问题请 [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 | amd64 | Linux | Linux |
| arm | arm | Windows | Windows |
| arm64 | arm64 | FreeBSD | FreeBSD |
| 386 | 386 | OpenBSD | |
| mips | | MacOS | |
| mipsle | | | |
| s390x | s390x | | |
| riscv64 | | | |
更多架构请自行测试
编译支持的系统: Linux、Windows、MacOS、FreeBSD、OpenBSD
> 更多架构与系统请自行测试,如有问题请开 issues。
测试支持的系统: Linux、Windows
### **待支持的系统**
| 系统 | 说明 |
|-----|---------------------------|
| MacOS | 存在硬件测试 BUG 未修复,存在环境依赖未修复 |
| Android(arm64) | 存在权限问题未修复非安卓系统的ARM架构无问题 |
更多系统请自行测试
---
待支持的系统(存在硬件测试BUG未修复): MacOS、FreeBSD、OpenBSD
## **功能**
## 功能
- 系统基础信息查询IP基础信息并发查询[basics](https://github.com/oneclickvirt/basics)、[gostun](https://github.com/oneclickvirt/gostun)
- CPU 测试:[cputest](https://github.com/oneclickvirt/cputest),支持 sysbench(lua/golang版本)、geekbench、winsat
- 内存测试:[memorytest](https://github.com/oneclickvirt/memorytest),支持 sysbench、dd
- 硬盘测试:[disktest](https://github.com/oneclickvirt/disktest),支持 dd、fio、winsat
- 流媒体解锁信息并发查询:[netflix-verify](https://github.com/sjlleo/netflix-verify) 等逻辑,开发至 [CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)
- 常见流媒体测试并发查询:[UnlockTests](https://github.com/oneclickvirt/UnlockTests),逻辑借鉴 [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck) 等
- IP 质量/安全信息并发查询:二进制文件编译至 [securityCheck](https://github.com/oneclickvirt/securityCheck)
- 邮件端口测试:[portchecker](https://github.com/oneclickvirt/portchecker)
- 三网回程测试:借鉴 [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace),二次开发至 [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)
- 三网路由测试:基于 [NTrace-core](https://github.com/nxtrace/NTrace-core),二次开发至 [nt3](https://github.com/oneclickvirt/nt3)
- 网速测试:基于 [speedtest.net](https://github.com/spiritLHLS/speedtest.net-CN-ID) 和 [speedtest.cn](https://github.com/spiritLHLS/speedtest.cn-CN-ID) 数据,开发至 [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
- 三网 Ping 值测试:借鉴 [ecsspeed](https://github.com/spiritLHLS/ecsspeed),二次开发至 [pingtest](https://github.com/oneclickvirt/pingtest)
- [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)]
**本项目初次使用建议查看说明:[跳转](https://github.com/oneclickvirt/ecs/blob/master/README_NEW_USER.md)**
## Linux/FreeBSD/MacOS上使用的说明
---
### 一键命令
## **使用说明**
```
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
### **Linux/FreeBSD/OpenBSD/MacOS**
#### **一键命令**
**一键命令**将**默认安装依赖****默认更新包管理器****默认非互动模式**
- **国际用户无加速:**
```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
```
- **国际/国内使用 CDN 加速:**
```
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
```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
```
### 详细说明
下载脚本
- **国内用户使用 CNB 加速:**
```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
```
- **短链接:**
```bash
export noninteractive=true && curl -L https://bash.spiritlhl.net/goecs -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
```
#### **详细说明**
**详细说明**中的命令**可控制是否安装依赖****是否更新包管理器****默认互动模式可进行选择**
<details>
<summary>展开查看详细说明</summary>
1. **下载脚本**
**国际用户无加速:**
```bash
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
**国际/国内使用 CDN 加速:**
```
```bash
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
安装环境
**国内用户使用 CNB 加速:**
```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
```
安装goecs
**非互动模式:**
```bash
export noninteractive=true && ./goecs.sh env
```
3. **安装 `goecs` 本体(仅下载二进制文件无依赖安装)**
```bash
./goecs.sh install
```
升级goecs
4. **升级 `goecs` 本体**
```
```bash
./goecs.sh upgrade
```
卸载goecs
5. **卸载 `goecs` 本体**
```
```bash
./goecs.sh uninstall
```
shell脚本的说明
6. **帮助命令**
```
可用命令:
./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 显示此消息
```bash
./goecs.sh -h
```
goecs唤起菜单
7. **唤起菜单**
```
```bash
goecs
```
</details>
```
./goecs
```
---
goecs命令参数化
#### **命令参数化**
```
<details>
<summary>展开查看各参数说明</summary>
```bash
Usage: goecs [options]
-backtrace
Enable/Disable backtrace test (in 'en' language or on windows it always false) (default true)
@@ -163,7 +210,7 @@ Usage: goecs [options]
-memory
Enable/Disable memory test (default true)
-memorym string
Set memory test method (supported: sysbench, dd, winsat) (default "dd")
Set memory test method (supported: sysbench, dd, winsat) (default "sysbench")
-menu
Enable/Disable menu mode, disable example: -menu=false (default true)
-nt3
@@ -184,54 +231,119 @@ Usage: goecs [options]
Enable/Disable unlock media test (default true)
-v Display version information
```
</details>
## Windows上使用的说明
---
下载带exe文件的压缩文件
### **Windows**
https://github.com/oneclickvirt/ecs/releases
1. 下载带 exe 文件的压缩包:[Releases](https://github.com/oneclickvirt/ecs/releases)
2. 解压后,右键以管理员模式运行。
找其中最新的版本,按照对应架构下载对应的 .zip 文件解压后文件夹内有一个exe文件
---
选择该exe文件右键点击选择管理员模式运行(非管理员模式运行无法进行硬件测试),唤起菜单自选
### **Docker**
windows测试无需进行环境安装
<details>
<summary>展开查看使用说明</summary>
## 在Docker中使用的说明
地址https://hub.docker.com/r/spiritlhl/goecs
国际镜像地址https://hub.docker.com/r/spiritlhl/goecs
请确保执行下述命令前本机已安装Docker
特权模式+host网络
```shell
docker run --rm --privileged --network host spiritlhl/goecs:latest -menu=false -l zh -memorym sysbench
docker run --rm --privileged --network host spiritlhl/goecs:latest -menu=false -l zh
```
非特权模式+非host网络
```shell
docker run --rm spiritlhl/goecs:latest -menu=false -l zh -memorym sysbench
docker run --rm spiritlhl/goecs:latest -menu=false -l zh
```
使用Docker执行测试硬件测试会有一些偏差和虚拟化架构判断失效还是推荐直接测试而不使用Docker测试。
国内镜像地址https://cnb.cool/oneclickvirt/ecs/-/packages/docker/ecs
请确保执行下述命令前本机已安装Docker
特权模式+host网络
```shell
docker run --rm --privileged --network host docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l zh
```
非特权模式+非host网络
```shell
docker run --rm docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l zh
```
</details>
---
### 从源码进行编译
<details>
<summary>展开查看编译说明</summary>
1. 克隆仓库的 public 分支(不含私有依赖)
```bash
git clone -b public https://github.com/oneclickvirt/ecs.git
cd ecs
```
2. 安装 Go 环境(如已安装可跳过)
```bash
# 下载并安装 Go
wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
```
3. 编译
```bash
go build -o goecs
```
4. 运行测试
```bash
./goecs -menu=false -l zh
```
支持的编译参数:
- GOOS支持 linux、windows、darwin、freebsd、openbsd
- GOARCH支持 amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
跨平台编译示例:
```bash
# 编译 Windows 版本
GOOS=windows GOARCH=amd64 go build -o goecs.exe
# 编译 MacOS 版本
GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
```
</details>
---
## QA
#### Q: 为什么默认使用sysbench而不是geekbench
#### A: 比较二者特点
```
sysbench geekbench
轻量几乎所有服务器都能跑 重型小机器跑不动
测试无联网需求,无硬件需求 测试必须联网且必须IPV4环境且有内存大小1G的最低需求
LUA编写且开源各架构系统可自行编译 仅官方二进制文件且不开源,无对应架构时无法自行编译
核心测试组件十多年不变 大版本更新对标的CPU不同版本间得分互相之间难转化你只能以对标的CPU为准
测试仅测试计算性能 测试涵盖多种性能测试,得分以权重计算,但实际很多测试项目实际是用不到的
适合快速测试 适合全面测试
```
| 比较项 | sysbench | geekbench |
|------------------|----------|-----------|
| 适用范围 | 轻量级,几乎可在任何服务器上运行 | 重量级,小型机器无法运行 |
| 测试要求 | 无需网络,无特殊硬件需求 | 需联网IPV4环境至少1G内存 |
| 开源情况 | 基于LUA开源可自行编译各架构版本 | 官方二进制闭源代码,不支持自行编译 |
| 测试稳定性 | 核心测试组件10年以上未变 |大版本更新测试项,分数不同版本间难以对比(每个版本对标当前最好的CPU) |
| 测试内容 | 仅测试计算性能 | 覆盖多种性能测试,分数加权计算,但部分测试实际不常用 |
| 适用场景 | 适合快速测试,仅测试计算性能 | 适合综合全面测试 |
| 排行榜 | [sysbench.spiritlhl.net](https://sysbench.spiritlhl.net/) | [browser.geekbench.com](https://browser.geekbench.com/) |
且```goecs```测试使用何种CPU测试方式可使用参数指定默认只是为了更多用户快速测试的需求
@@ -247,3 +359,43 @@ LUA编写且开源各架构系统可自行编译 仅官方二进制文件且
#### A: 每个测试项目有对应的维护仓库,自行点击查看仓库说明
#### Q: 测试进行到一半如何手动终止?
#### A: 按ctrl键和c键终止程序终止后依然会在当前目录下生成goecs.txt文件和分享链接里面是已经测试到的信息。
#### Q: 非Root环境如何进行测试
#### A: 手动执行安装命令实在装不上也没问题直接在release中下载对应架构的压缩包解压后执行即可只要你能执行的了文件。或者你能使用docker的话用docker执行。
## 致谢
感谢 [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [ip.sb](https://ip.sb) [cheervision.co](https://cheervision.co) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [virustotal.com](https://www.virustotal.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) 等网站提供的API进行检测感谢互联网各网站提供的查询资源
感谢
<a href="https://h501.io/?from=69" target="_blank">
<img src="https://github.com/spiritLHLS/ecs/assets/103393591/dfd47230-2747-4112-be69-b5636b34f07f" alt="h501" style="height: 50px;">
</a>
提供的免费托管支持本开源项目的共享测试结果存储
同时感谢以下平台提供编辑和测试支持
<a href="https://www.jetbrains.com/go/" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/GoLand.png" alt="goland" style="height: 50px;">
</a>
<a href="https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/" target="_blank">
<img src="https://linuxone.cloud.marist.edu/oss/resources/images/linuxonelogo03.png" alt="ibm" style="height: 50px;">
</a>
<a href="https://console.zmto.com/?affid=1524" target="_blank">
<img src="https://console.zmto.com/templates/2019/dist/images/logo_dark.svg" alt="zmto" style="height: 50px;">
</a>
## Stargazers over time
[![Stargazers over time](https://starchart.cc/oneclickvirt/ecs.svg?variant=adaptive)](https://www.spiritlhl.net)
## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs?ref=badge_large)

View File

@@ -1,125 +1,179 @@
# 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)
Fusion Monster Evaluation Script - GO Refactored Version - Since it has not been officially released, please report any issues via issues.
[![Hits](https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net)
Shell version: https://github.com/spiritLHLS/ecs/blob/main/README_EN.md
Fusion Monster Evaluation Project - GO Version
## Language
(No additional shell file dependencies unless necessary to install the environment using the shell, the environment is installed just to measure more accurately, in extreme cases no environment dependencies can also be fully measured project)
Please report any issues via [issues](https://github.com/oneclickvirt/ecs/issues).
Go version: [https://github.com/oneclickvirt/ecs](https://github.com/oneclickvirt/ecs)
Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https://github.com/spiritLHLS/ecs/blob/main/README_EN.md)
---
## **Language**
[中文文档](README.md) | [English Docs](README_EN.md)
## Supported Systems and Architectures
---
Architectures supported for compilation: amd64、arm、arm64、386、mips、mipsle、s390x、riscv64
## **Supported Systems and Architectures**
Tested architectures: amd64, arm64
### **Compilation and Testing Support**
| Supported for Compilation | Tested on | Supported OS for Compilation | Tested OS |
|---------------------------|-----------|------------------------------|-----------|
| amd64 | amd64 | Linux | Linux |
| arm | arm | Windows | Windows |
| arm64 | arm64 | FreeBSD | FreeBSD |
| 386 | 386 | OpenBSD | |
| mips | | MacOS | |
| mipsle | | | |
| s390x | s390x | | |
| riscv64 | | | |
More architectures please test by yourself
> Please test additional architectures and systems yourself. If you encounter any issues, please open an issue.
Compilation support: Linux, Windows、MacOS、FreeBSD、OpenBSD
### **Systems Pending Support**
| OS | Notes |
|--------|-------------------------------------------------------------------------------------------------|
| MacOS | Hardware testing bugs and environment dependencies unresolved |
| Android(arm64) | Permission issues that are not fixed, no problems with ARM architecture for non-Android systems |
---
Tested on: Linux, Windows
## **Features**
More systems to be tested
- System basic information query and concurrent IP basic information query: Self-developed [basics](https://github.com/oneclickvirt/basics), [gostun](https://github.com/oneclickvirt/gostun)
- CPU test: Self-developed [cputest](https://github.com/oneclickvirt/cputest) supporting sysbench(lua/golang version), geekbench, winsat
- Memory test: Self-developed [memorytest](https://github.com/oneclickvirt/memorytest) supporting sysbench, dd
- Disk test: Self-developed [disktest](https://github.com/oneclickvirt/disktest) supporting dd, fio, winsat
- Streaming media unlock information concurrent query: Modified from [netflix-verify](https://github.com/sjlleo/netflix-verify) and more to [CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)
- Common streaming media tests concurrent query: Self-developed to [UnlockTests](https://github.com/oneclickvirt/UnlockTests), logic modified from [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck) and others
- IP quality/security information concurrent query: Self-developed, binary files compiled in [securityCheck](https://github.com/oneclickvirt/securityCheck)
- Email port test: Self-developed [portchecker](https://github.com/oneclickvirt/portchecker)
- Three-network return path test: Modified from [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace) to [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)
- Three-network route test: Modified from [NTrace-core](https://github.com/nxtrace/NTrace-core) to [nt3](https://github.com/oneclickvirt/nt3)
- Speed test: Based on data from [speedtest.net](https://github.com/spiritLHLS/speedtest.net-CN-ID) and [speedtest.cn](https://github.com/spiritLHLS/speedtest.cn-CN-ID), developed to [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
- Three-network Ping test: Modified from [ecsspeed](https://github.com/spiritLHLS/ecsspeed) to [pingtest](https://github.com/oneclickvirt/pingtest)
Systems to be supported (hardware testing bugs not yet fixed): MacOS、FreeBSD、OpenBSD
**For first-time users of this project, it is recommended to check the instructions: [Jump to](https://github.com/oneclickvirt/ecs/blob/master/README_NEW_USER.md)**
## Features
---
- [x] System basic information query [Self-developed [basics](https://github.com/oneclickvirt/basics), [gostun](https://github.com/oneclickvirt/gostun)]
- [x] Concurrent IP basic information query [Self-developed [basics](https://github.com/oneclickvirt/basics)]
- [x] CPU test [Self-developed [cputest](https://github.com/oneclickvirt/cputest) supporting sysbench, geekbench, winsat]
- [x] Memory test [Self-developed [memorytest](https://github.com/oneclickvirt/memorytest) supporting sysbench, dd]
- [x] Disk test [Self-developed [disktest](https://github.com/oneclickvirt/disktest) supporting dd, fio, winsat]
- [x] Concurrent streaming media unlock information query for three major platforms [Modified from [netflix-verify](https://github.com/sjlleo/netflix-verify), [VerifyDisneyPlus](https://github.com/sjlleo/VerifyDisneyPlus), [TubeCheck](https://github.com/sjlleo/TubeCheck) to [CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)]
- [x] Concurrent common streaming media tests [Self-developed code, logic modified from [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck), [MediaUnlockTest](https://github.com/HsukqiLee/MediaUnlockTest) to [UnlockTests](https://github.com/oneclickvirt/UnlockTests)]
- [x] Concurrent IP quality/security information query [Self-developed, due to testing with key information, privately developed, but binary files compiled in [securityCheck](https://github.com/oneclickvirt/securityCheck)]
- [x] Email port test [Self-developed [portchecker](https://github.com/oneclickvirt/portchecker)]
- [x] Three-network return path test [Modified from [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace) to [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)]
- [x] Three-network route test [Modified from [NTrace-core](https://github.com/nxtrace/NTrace-core) to [nt3](https://github.com/oneclickvirt/nt3)]
- [x] Speed test [Based on data from [speedtest.net-crawler](https://github.com/spiritLHLS/speedtest.net-CN-ID), [speedtest.cn-crawler](https://github.com/spiritLHLS/speedtest.cn-CN-ID), modified from [speedtest-go](https://github.com/showwin/speedtest-go) to [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)]
- [x] Three-network Ping test [Modified from [ecsspeed](https://github.com/spiritLHLS/ecsspeed) logic to [pingtest](https://github.com/oneclickvirt/pingtest)]
## **Instructions for Use**
## Instructions for Use on Linux/FreeBSD/MacOS
### **Linux/FreeBSD/OpenBSD/MacOS**
### one-click command
#### **One-click command**
```
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
**One-Click Command** will **Install Dependencies by Default**, **Update Package Manager by Default**, **Default Non-Interactive Mode***
- **International users without acceleration:**
```bash
export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
```
### explain in detail
Download the script
- **International/domestic users with CDN acceleration:**
```bash
export noninteractive=true && curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
```
- **Domestic users with CNB acceleration:**
```bash
export noninteractive=true && curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -l en
```
- **Short Link:**
```bash
export noninteractive=true && curl -L https://bash.spiritlhl.net/goecs -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
``
#### **Detailed instructions**
**Detailed description** of the commands in **Command **Controls whether to install dependencies**, **Whether to update the package manager**, **Default interaction mode can be selected***
<details>
<summary>Expand to view detailed instructions</summary>
1. **Download the script**
**International users without acceleration:**
```bash
curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
Install environment
**International/domestic users with CDN acceleration:**
```bash
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
**Domestic users with CNB acceleration:**
```bash
curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh
```
2. **Update package manager (optional) and install environment**
```bash
./goecs.sh env
```
Install goecs
**Non-interactive mode:**
```bash
export noninteractive=true && ./goecs.sh env
```
3. **Install `goecs`**
```bash
./goecs.sh install
```
Upgrade goecs
4. **Upgrade `goecs`**
```
```bash
./goecs.sh upgrade
```
Uninstall goecs
5. **Uninstall `goecs`**
```
```bash
./goecs.sh uninstall
6. **help command**
```bash
./goecs.sh -h
```
Explanation of the shell script
7. **Invoke the menu**
```
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 install Install goecs command
./goecs.sh upgrade Upgrade goecs command
./goecs.sh uninstall Uninstall goecs command
./goecs.sh help Show this message
```
Invoke the goecs menu
```
```bash
goecs -l en
```
or
</details>
```
./goecs -l en
```
---
Parameterized goecs command
#### **Command parameterization**
```
<details>
<summary>Expand to view parameter descriptions</summary>
```bash
Usage: goecs [options]
-backtrace
Enable/Disable backtrace test (in 'en' language or on windows it always false) (default true)
@@ -151,7 +205,7 @@ Usage: goecs [options]
-memory
Enable/Disable memory test (default true)
-memorym string
Set memory test method (supported: sysbench, dd, winsat) (default "dd")
Set memory test method (supported: sysbench, dd, winsat) (default "sysbench")
-menu
Enable/Disable menu mode, disable example: -menu=false (default true)
-nt3
@@ -172,37 +226,167 @@ Usage: goecs [options]
Enable/Disable unlock media test (default true)
-v Display version information
```
</details>
## Instructions for Use on Windows
---
Download the compressed file with the exe file
### **Windows**
https://github.com/oneclickvirt/ecs/releases
1. Download the compressed file with the .exe file: [Releases](https://github.com/oneclickvirt/ecs/releases)
2. After unzipping, right-click and run as administrator.
Find the latest version, download the .zip file corresponding to your architecture, and unzip it to get an exe file.
---
Right-click the exe file and select Run as administrator (running without administrator mode will not allow hardware testing), and invoke the menu to choose.
### **Docker**
No environment installation is required for Windows testing.
<details>
<summary>Expand to view how to use it</summary>
## Instructions for Use in Docker
International image: https://hub.docker.com/r/spiritlhl/goecs
Link: https://hub.docker.com/r/spiritlhl/goecs
Please ensure Docker is installed on your machine before executing the following commands
Please make sure that Docker is installed on your machine before executing the following commands
Privileged Mode + host network
Privileged mode + host network
```shell
docker run --rm --privileged --network host spiritlhl/goecs:latest -menu=false -l en -memorym sysbench
docker run --rm --privileged --network host spiritlhl/goecs:latest -menu=false -l en
```
Unprivileged mode + non-host network
```shell
docker run --rm spiritlhl/goecs:latest -memorym sysbench
docker run --rm spiritlhl/goecs:latest -menu=false -l en
```
Using Docker to execute tests, hardware testing will have some bias and virtualization architecture to determine the failure.
Using Docker to execute tests will result in some hardware testing bias and virtualization architecture detection failure. Direct testing is recommended over Docker testing.
Recommended direct testing without using Docker testing.
Mirror image: https://cnb.cool/oneclickvirt/ecs/-/packages/docker/ecs
Please ensure Docker is installed on your machine before executing the following commands
Privileged mode + host network
```shell
docker run --rm --privileged --network host docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l en
```
Unprivileged mode + non-host network
```shell
docker run --rm docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l en
```
</details>
---
### Compiling from source code
<details>
<summary>Expand to view compilation instructions</summary>
1. Clone the public branch of the repository (without private dependencies)
```bash
git clone -b public https://github.com/oneclickvirt/ecs.git
cd ecs
```
2. Install Go environment (skip if already installed)
```bash
# Download and install Go
wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
```
3. Compile
```bash
go build -o goecs
```
4. Run test
```bash
./goecs -menu=false -l en
```
Supported compilation parameters:
- GOOS: supports linux, windows, darwin, freebsd, openbsd
- GOARCH: supports amd64, arm, arm64, 386, mips, mipsle, s390x, riscv64
Cross-platform compilation examples:
```bash
# Compile Windows version
GOOS=windows GOARCH=amd64 go build -o goecs.exe
# Compile MacOS version
GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
```
</details>
---
## QA
#### Q: Why is sysbench used by default instead of geekbench?
#### A: Comparing the characteristics of both:
| Comparison | sysbench | geekbench |
|------------|----------|-----------|
| Application scope | Lightweight, runs on almost any server | Heavyweight, won't run on small machines |
| Test requirements | No network needed, no special hardware requirements | Requires internet, IPv4 environment, minimum 1GB memory |
| Open source status | Based on LUA, open source, can compile for various architectures | Official binaries are closed source, cannot compile your own version |
| Test stability | Core test components unchanged for 10+ years | Each major version updates test items, making scores hard to compare between versions (each version benchmarks against current best CPUs) |
| Test content | Only tests computing performance | Covers multiple performance aspects with weighted scores, though some tests aren't commonly used |
| Suitable scenarios | Good for quick tests, focuses on computing performance | Good for comprehensive testing |
Note that `goecs` allows you to specify CPU test method via parameters. The default is chosen for faster testing across more systems.
#### Q: Why use Golang instead of Rust for refactoring?
#### A: Because network-related projects currently trend toward Golang, with many components maintained by open source communities. Many Rust components would require building from scratch, ~~I'm too lazy~~ I don't have that technical capability.
#### Q: Why not continue developing the Shell version instead of refactoring?
#### A: Because there were too many varied environment issues. Pre-compiled binary files are easier for solving environment problems (better generalization).
#### Q: Are there explanations for each test item?
#### A: Each test project has its own maintenance repository. Click through to view the repository description.
#### Q: How do I manually terminate a test halfway through?
#### A: Press Ctrl+C to terminate the program. After termination, a goecs.txt file and share link will still be generated in the current directory containing information tested so far.
#### Q: How do I test in a non-Root environment?
#### A: Execute the installation command manually. If you can't install it, simply download the appropriate architecture package from releases, extract it, and run the file if you have execution permissions. Alternatively, use Docker if you can.
## Thanks
Thank [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [ip.sb](https://ip.sb) [cheervision.co](https://cheervision.co) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [virustotal.com](https://www.virustotal.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) and others for providing APIs for testing, and thanks to various websites on the Internet for providing query resources.
Thank
<a href="https://h501.io/?from=69" target="_blank">
<img src="https://github.com/spiritLHLS/ecs/assets/103393591/dfd47230-2747-4112-be69-b5636b34f07f" alt="h501" style="height: 50px;">
</a>
provided free hosting support for this open source project's shared test results storage
Thanks also to the following platforms for editorial and testing support
<a href="https://www.jetbrains.com/go/" target="_blank">
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/GoLand.png" alt="goland" style="height: 50px;">
</a>
<a href="https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/" target="_blank">
<img src="https://linuxone.cloud.marist.edu/oss/resources/images/linuxonelogo03.png" alt="ibm" style="height: 50px;">
</a>
<a href="https://console.zmto.com/?affid=1524" target="_blank">
<img src="https://console.zmto.com/templates/2019/dist/images/logo_dark.svg" alt="zmto" style="height: 50px;">
</a>
## Stargazers over time
[![Stargazers over time](https://starchart.cc/oneclickvirt/ecs.svg?variant=adaptive)](https://www.spiritlhl.net)

507
README_NEW_USER.md Normal file
View File

@@ -0,0 +1,507 @@
## 目录 / Table of Contents / 目次
[![Hits](https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net)
## 语言 / Languages / 言語
- [中文](#中文)
- [English](#English)
- [日本語](#日本語)
## 中文
- [系统基础信息](#系统基础信息)
- [CPU测试](#CPU测试)
- [内存测试](#内存测试)
- [硬盘测试](#硬盘测试)
- [流媒体解锁](#流媒体解锁)
- [IP质量检测](#IP质量检测)
- [邮件端口检测](#邮件端口检测)
- [三网回城线路检测](#三网回城线路检测)
- [三网回程路由检测](#三网回程路由检测)
- [就近测速](#就近测速)
## English
- [Basic System Information](#Basic-System-Information)
- [CPU Testing](#CPU-Testing)
- [Memory Testing](#Memory-Testing)
- [Disk Testing](#Disk-Testing)
- [Streaming Media Unlocking](#Streaming-Media-Unlocking)
- [IP Quality Detection](#IP-Quality-Detection)
- [Email Port Detection](#Email-Port-Detection)
## 日本語
- [システム基本情報](#システム基本情報)
- [CPUテスト](#CPUテスト)
- [メモリテスト](#メモリテスト)
- [ディスクテスト](#ディスクテスト)
- [ストリーミングメディアロック解除](#ストリーミングメディアロック解除)
- [IP品質検出](#IP品質検出)
- [メールポート検出](#メールポート検出)
---
## 中文
### **系统基础信息**
CPU型号: 不必多说大概的说按CPU的发布时间都是新款则AMD好于Intel都是旧款则Intel好于AMD。
CPU数量: 会检测是物理核心还是逻辑核心,优先展示物理核心,查不到物理核心才去展示逻辑核心。在服务器实际使用过程中,程序一般是按逻辑核心分配执行的,非视频转码和科学计算,物理核心一般都是开超线程成逻辑核心用,横向比较的时候,对应类型的核心数量才有比较的意义。
CPU缓存显示的宿主机的CPU三级缓存信息。
AES-NI: 指令集是加密解密加速用的,有的话常规网络请求会更快一些,性能更高一些,没有的话会影响网络请求(含代理用途)。
VM-x/AMD-V/Hyper-V: 是当前测试宿主机是否支持嵌套虚拟化的指标如果测试环境是套在docker里测或者没有root权限那么这个默认就是检测不到显示不支持嵌套虚拟化。这个指标在你需要在宿主机上开设虚拟机(如 KVM、VirtualBox、VMware)的时候有用,其他用途该指标用处不大。
内存: 显示内存 正在使用的大小/总大小 ,不含虚拟内存。
气球驱动: 显示宿主机是否使用了气球驱动,使用了证明母机有共享内存使用,需要结合下面的内存读写测试查看是否有超售/严格的限制。
内核页合并显示宿主机是否使用了KSM内存融合使用了证明母机有共享内存使用需要结合下面的内存读写测试查看是否有超售/严格的限制。
虚拟内存: 显示 SWAP虚拟内存
硬盘空间: 显示硬盘 正在使用的大小/总大小
启动盘路径:显示启动盘的路径
系统: 显示系统名字和架构
内核: 显示系统内核版本
系统在线时间: 显示宿主机自从开机到测试时已在线时长
时区: 显示宿主机系统时区
负载: 显示系统负载
虚拟化架构: 显示宿主机来自什么虚拟化架构,一般来说推荐```Dedicated > KVM > Xen```虚拟化,其他虚拟化都会存在性能损耗,导致使用的时候存在性能共享/损耗,但这个也说不准,独立服务器才拥有完全独立的资源占用,其他虚拟化基本都会有资源共享,取决于宿主机的售卖者是否有良心,具体性能优劣还是得看后面的专项测试。
NAT类型: 显示NAT类型具体推荐```Full Cone > Restricted Cone > Port Restricted Cone > Symmetric```,测不出来时会显示```Inconclusive```,一般来说不拿来做特殊用途(有关于特殊的代理和实时通讯需求的),都不用关注本指标。
TCP加速方式一般是```cubic/bbr```拥塞控制协议一般来说做代理服务器用bbr可以改善网速普通用途不必关注此指标。
IPV4/IPV6 ASN: 显示宿主机IP所属的ASN组织ID和名字同一个IDC可能会有多个ASNASN下可能有多个商家售卖不同段的IP的服务器具体的上下游关系错综复杂可使用 bgp.tool 进一步查看。
IPV4/IPV6 Location: 显示对应协议的IP在数据库中的地理位置。
IPV4 Active IPs: 根据 bgp.tools 信息查询当前CIDR分块中 活跃邻居数量/总邻居数量
IPV6 子网掩码根据宿主机信息查询的本机IPV6子网大小
### **CPU测试**
支持通过命令行参数选择```GeekBench```和```Sysbench```进行测试:
| 比较项 | sysbench | geekbench |
|------------------|----------|-----------|
| 适用范围 | 轻量级,几乎可在任何服务器上运行 | 重量级,小型机器无法运行 |
| 测试要求 | 无需网络,无特殊硬件需求 | 需联网IPV4环境至少1G内存 |
| 开源情况 | 基于LUA开源可自行编译各架构版本(本项目有重构为Go版本内置) | 官方二进制闭源代码,不支持自行编译 |
| 测试稳定性 | 核心测试组件10年以上未变 | 每个大版本更新测试项,分数不同版本间难以对比(每个版本对标当前最好的CPU) |
| 测试内容 | 仅测试计算性能,基于素数计算 | 覆盖多种性能测试,分数加权计算,但部分测试实际不常用 |
| 适用场景 | 适合快速测试,仅测试计算性能 | 适合综合全面的测试 |
默认使用```Sysbench```进行测试,基准大致如下:
CPU测试单核```Sysbench```得分在5000以上的可以算第一梯队4000到5000分算第二梯队每1000分大致算一档。
AMD的7950x单核满血性能得分在6500左右AMD的5950x单核满血性能得分5700左右Intel普通的CPU(E5之类的)在1000~800左右低于500的单核CPU可以说是性能比较差的了。
有时候多核得分和单核得分一样证明商家在限制程序并发使用CPU典型例子腾讯云。
```Sysbench```的基准可见 [CPU Performance Ladder For Sysbench](https://sysbench.spiritlhl.net/) 天梯图具体得分不分测试的sysbench的版本。
```GeekBench```的基准可见 [官方网站](https://browser.geekbench.com/processor-benchmarks/) 天梯图,具体得分每个```GeekBench```版本都不一样,注意使用时测试的```GeekBench```版本是什么。
多说一句,```GeekBench```测的很多内容,实际在服务器使用过程中根本用不到,测试仅供参考。当然```Sysbench```非常不全面但它基于最基础的计算性能可以大致比较CPU的性能。
实际上CPU性能测试够用就行除非是科学计算以及视频转码一般不需要特别追求高性能CPU。
### **内存测试**
一般来说只需要判断IO速度是否低于```10240MB/s```,如果低于这个值那么证明内存性能不佳,极大概率存在超售超卖问题。
至于超开的原因可能是开了虚拟内存(硬盘当内存用)、可能是开了ZRAM(牺牲CPU性能)、可能是开了气球驱动、可能是开了KSM内存融合原因多种多样。
### **硬盘测试**
```dd```测试可能误差偏大但测试速度快无硬盘大小限制,```fio```测试真实一些但测试速度慢有硬盘以及内存大小的最低需求。
同时服务器可能有不同的文件系统某些文件系统的IO引擎在同样的硬件条件下测试的读写速度更快这是正常的。项目默认使用```fio```进行测试测试使用的IO引擎优先级为```libaio > posixaio > psync```,备选项```dd```测试在```fio```测试不可用时自动替换。
以```fio```测试结果为例基准如下:
| 操作系统类型 | 主要指标 | 次要指标 |
|---------|-------------------|---------------------|
| Windows/Mac | 4K读 → 64K读 → 写入测试 | 图形界面系统优先考虑读取性能 |
| Linux (无图形界面) | 4K读 + 4K写 + 1M读写| 读/写值通常相似 |
以下硬盘类型对于指标值指 常规~满血 性能状态,指```libaio```作为IO测试引擎指在```Linux```下进行测试
| 驱动类型 | 4K(IOPS)性能 | 1M(IOPS)性能 |
|------------|--------------------------|----------------------|
| NVMe SSD | ≥ 200 MB/s | 5-10 GB/s |
| 标准SSD | 50-100 MB/s | 2-3 GB/s |
| HDD (机械硬盘) | 10-40 MB/s | 500-600 MB/s |
| 性能不佳 | < 10 MB/s | < 200 MB/s |
快速评估:
1. **主要检查**: 4K读(IOPS) 4K写(IOPS)
- 几乎相同差别不大
- ≥ 200 MB/s = NVMe SSD
- 50-100 MB/s = 标准SSD
- 10-40 MB/s = HDD (机械硬盘)
- < 10 MB/s = 垃圾性能,超售/限制严重
2. **次要检查**: 1M总和(IOPS)
- 提供商设置的IO限制
- 资源超开超售情况
- 数值越高越好
- NVMe SSD通常达到4-6 GB/s
- 标准SSD通常达到1-2 GB/s
如果 NVMe SSD的1M(IOPS)值 < 1GB/s 表明存在严重的资源超开超售。
注意这里测试的是真实的IO仅限本项目非本项目测试的IO不保证基准通用因为他们测试的时候可能用的不是同样的参数可能未设置IO直接读写可能设置IO引擎不一致可能设置测试时间不一致都会导致基准有偏差。
### **流媒体解锁**
检索常见的流媒体平台解锁当然也不全是流媒体还有一些常见的别的平台的解锁也纳入了。一般来说IP解锁地区都是一致的不会到处乱飘如果发现多家平台解锁地区不一致那么IP大概率是租赁的IPXO等平台的各平台数据库识别缓慢IP质量一般来说也好不到哪里去。
### **IP质量检测**
检测14个数据库的IP相关信息一般来说看使用类型和公司类型还有安全信息的其他判别足矣安全得分真的图一乐。多个平台比较对应检测项目都为对应值证明当前IP确实如此不要仅相信一个数据库源的信息。
### **邮件端口检测**
- **SMTP25**:用于邮件服务器之间传输邮件(发送邮件)。
- **SMTPS465**:用于加密的 SMTP 发送邮件SSL/TLS 方式)。
- **SMTP587**:用于客户端向邮件服务器发送邮件,支持 STARTTLS 加密。
- **POP3110**:用于邮件客户端从服务器下载邮件,不加密。
- **POP3S995**:用于加密的 POP3安全地下载邮件SSL/TLS 方式)。
- **IMAP143**:用于邮件客户端在线管理邮件(查看、同步邮件),不加密。
- **IMAPS993**:用于加密的 IMAP安全地管理邮件SSL/TLS 方式)。
具体当前宿主机不做邮局或者不收电子邮件,那么该项目指标不用理会。
### **三网回程线路检测**
检测当前的宿主机的IP地址 到 四个主要POP点城市的三个主要运营商的接入点的IP地址 的线路,具体来说
电信163、联通4837、移动CMI 是常见的线路
电信CN2GIA > 电信CN2GT 移动CMIN2 联通9929 算优质的线路
用什么运营商连宿主机的IP就看哪个运营商的线路就行了具体线路的路由情况看在下一个检测项看到对应的ICMP检测路由信息。
### **三网回程路由检测**
默认检测广州为目的地,实际可使用命令行参数指定目的地,见对应的说明。
主要就是看是不是直连,是不是延迟低,是不是没有隐藏路由信息。如果路由全球跑,延迟起飞,那么线路自然不会好到哪里去。
### **就近测速**
先测的官方推荐的测速点然后测有代表性的国际测速点最后测国内三大运营商ping值最低的测速点。
境内使用为主就看境内测速即可,境外使用看境外测速,官方测速点可以代表受测的宿主机本地带宽基准。
一般来说境外的服务器的带宽100Mbps起步境内的服务器1Mbps带宽起步具体看线路优劣带宽特别大有时候未必用得上够用就行了。
---
## English
### **Basic System Information**
CPU Model: Simply put, generally speaking, based on CPU release dates, newer AMD models are better than Intel, while for older models, Intel is better than AMD.
CPU Count: It will detect whether these are physical cores or logical cores, prioritizing display of physical cores, only showing logical cores if physical core information is unavailable. In actual server usage, programs are generally allocated by logical cores. Except for video transcoding and scientific computing, physical cores are usually enabled with hyperthreading to function as logical cores. When making comparisons, only cores of the corresponding type have meaningful comparison value.
CPU Cache: Displays the host machine's three-level CPU cache information.
AES-NI: This instruction set is used for encryption/decryption acceleration. With it, normal network requests will be faster and performance will be higher. Without it, network requests (including proxy usage) will be affected.
VM-x/AMD-V/Hyper-V: This indicates whether the current host machine supports nested virtualization. If the test environment is running inside Docker or doesn't have root privileges, then by default this will be undetectable and will show as not supporting nested virtualization. This metric is useful when you need to set up virtual machines (such as KVM, VirtualBox, VMware) on the host machine; for other purposes, this metric is not very useful.
Memory: Displays memory size in format "currently used size/total size", not including virtual memory.
Balloon Driver: Shows whether the host machine is using a balloon driver. If used, it proves the parent machine has shared memory usage, which should be examined alongside the memory read/write test below to check for overselling/strict limitations.
Kernel Same-page Merging: Shows whether the host machine is using KSM memory fusion. If used, it proves the parent machine has shared memory usage, which should be examined alongside the memory read/write test below to check for overselling/strict limitations.
Virtual Memory: Displays SWAP virtual memory.
Disk Space: Displays disk usage in format "currently used size/total size".
Boot Disk Path: Shows the path of the boot disk.
System: Displays system name and architecture.
Kernel: Displays system kernel version.
System Uptime: Shows how long the host machine has been online since boot until testing time.
Timezone: Displays the host machine's system timezone.
Load: Displays system load.
Virtualization Architecture: Shows what virtualization architecture the host machine uses. Generally speaking, the recommended order is `Dedicated > KVM > Xen` virtualization. Other virtualization will have performance losses, leading to shared/degraded performance during use. However, this is not definitive. Only dedicated servers have completely independent resource usage; other virtualization methods basically all have resource sharing, depending on whether the host machine seller has a conscience. The specific performance merits still depend on the specialized tests that follow.
NAT Type: Displays NAT type. Specifically recommended in order: `Full Cone > Restricted Cone > Port Restricted Cone > Symmetric`. When not detectable, it will show `Inconclusive`. Generally speaking, if you're not using it for special purposes (related to special proxy and real-time communication needs), you don't need to pay attention to this metric.
TCP Acceleration Method: Generally this is the `cubic/bbr` congestion control protocol. Generally speaking, using bbr for proxy servers can improve network speed; for ordinary purposes, you don't need to pay attention to this indicator.
IPv4/IPv6 ASN: Displays the ASN organization ID and name that the host machine's IP belongs to. The same IDC may have multiple ASNs, and an ASN may have multiple vendors selling servers with different IP segments. The specific upstream and downstream relationships are complex and can be further viewed using bgp.tool.
IPv4/IPv6 Location: Shows the geographic location of the corresponding protocol's IP in the database.
IPV4 Active IPs: Query the number of active neighbours/total number of neighbours in the current CIDR chunk based on the bgp.tools information.
### **CPU Testing**
Supports selecting `GeekBench` and `Sysbench` for testing through command line parameters:
| Comparison Item | sysbench | geekbench |
|------------------|----------|-----------|
| Application Range | Lightweight, can run on almost any server | Heavyweight, cannot run on small machines |
| Test Requirements | No network needed, no special hardware requirements | Requires network, IPv4 environment, at least 1GB memory |
| Open Source Status | Based on LUA, open source, can compile versions for various architectures (this project has been rebuilt in Go version built-in) | Official binary closed source code, does not support self-compilation |
| Test Stability | Core test components unchanged for over 10 years | Test items updated with each major version, scores difficult to compare between different versions (each version benchmarks against current best CPUs) |
| Test Content | Only tests computational performance, based on prime number calculation | Covers multiple performance tests, weighted score calculation, but some tests are not commonly used in practice |
| Applicable Scenarios | Suitable for quick testing, only tests computational performance | Suitable for comprehensive testing |
By default, `Sysbench` is used for testing, with the baseline roughly as follows:
CPU test single-core `Sysbench` scores above 5000 can be considered first tier, 4000 to 5000 points second tier, with roughly one tier per 1000 points.
AMD's 7950x single-core full performance score is around 6500, AMD's 5950x single-core full performance score is around 5700, Intel's ordinary CPUs (E5 series, etc.) are around 1000~800, and single-core CPUs scoring below 500 can be said to have relatively poor performance.
Sometimes multi-core scores are the same as single-core scores, proving that the vendor is limiting program concurrent use of CPU, a typical example being Tencent Cloud.
Benchmarks for ```Sysbench`` can be found in the [CPU Performance Ladder For Sysbench](https://sysbench.spiritlhl.net/) ladder chart, with specific scores regardless of the version of sysbench tested.
For `GeekBench` baselines, see the [official website](https://browser.geekbench.com/processor-benchmarks/) ladder chart. Specific scores differ for each `GeekBench` version, so note which `GeekBench` version is being used when testing.
As an additional note, many things tested by `GeekBench` are not actually used in server usage processes, so the test is for reference only. Of course, `Sysbench` is very incomplete, but it can roughly compare CPU performance based on the most basic computational performance.
In practice, CPU performance just needs to be sufficient. Unless you're doing scientific computing or video transcoding, you generally don't need to pursue high-performance CPUs.
### **Memory Testing**
Generally speaking, you only need to determine whether the IO speed is below `10240MB/s`. If it's below this value, it proves that memory performance is poor, with an extremely high probability of overselling issues.
As for the reasons for oversubscription, it could be that virtual memory is enabled (using disk as memory), ZRAM might be enabled (sacrificing CPU performance), balloon drivers might be enabled, or KSM memory fusion might be enabled - there are various possible reasons.
### **Disk Testing**
The `dd` test may have larger errors but is faster to test with no disk size limitations. The `fio` test is more realistic but slower to test and has minimum requirements for disk and memory size.
At the same time, servers may have different file systems, and certain file systems' IO engines may test faster read/write speeds under the same hardware conditions, which is normal. The project uses `fio` for testing by default, with IO engine priority being `libaio > posixaio > psync`. The alternative `dd` test automatically replaces when `fio` testing is not available.
Using `fio` test results as an example, the baseline is as follows:
| OS Type | Primary Metrics | Secondary Metrics |
|---------|-------------------|---------------------|
| Windows/Mac | 4K read → 64K read → Write test | Graphical systems prioritize read performance |
| Linux (without GUI) | 4K read + 4K write + 1M read/write | Read/write values usually similar |
The following disk types refer to metric values indicating normal~full-power performance states, using `libaio` as the IO test engine, testing under `Linux`
| Drive Type | 4K(IOPS) Performance | 1M(IOPS) Performance |
|------------|--------------------------|----------------------|
| NVMe SSD | ≥ 200 MB/s | 5-10 GB/s |
| Standard SSD | 50-100 MB/s | 2-3 GB/s |
| HDD (Mechanical) | 10-40 MB/s | 500-600 MB/s |
| Poor Performance | < 10 MB/s | < 200 MB/s |
Quick assessment:
1. **Primary Check**: 4K read(IOPS) 4K write(IOPS)
- Almost identical with little difference
- ≥ 200 MB/s = NVMe SSD
- 50-100 MB/s = Standard SSD
- 10-40 MB/s = HDD (Mechanical)
- < 10 MB/s = Poor performance, severe overselling/restriction
2. **Secondary Check**: 1M total(IOPS)
- IO limit set by provider
- Resource overselling situation
- Higher value is better
- NVMe SSD typically reaches 4-6 GB/s
- Standard SSD typically reaches 1-2 GB/s
If NVMe SSD's 1M(IOPS) value < 1GB/s, it indicates severe resource overselling.
Note that this is testing real IO, limited to this project only. The baseline may not be universal for tests not from this project, because they might not use the same parameters when testing, might not set direct IO reading/writing, might use inconsistent IO engines, or might set inconsistent test times, all of which will cause baseline deviations.
### **Streaming Media Unlocking**
Checks common streaming media platform unlocking, though not all are streaming media - some other common platform unlocks are also included. Generally speaking, IP unlocking regions are consistent and don't randomly fluctuate. If you find that multiple platforms have inconsistent unlocking regions, then the IP is likely rented from platforms like IPXO, with slow recognition in various platform databases. Generally speaking, the IP quality won't be good either.
### **IP Quality Detection**
Checks IP-related information from 14 databases. Generally speaking, it's sufficient to look at usage type, company type, and other security information judgments. The security score is really just for amusement. When multiple platforms compare corresponding detection items to corresponding values, it proves that the current IP is indeed as such. Don't just trust information from a single database source.
### **Email Port Detection**
- **SMTP (25)**: Used for email transmission between mail servers (sending mail).
- **SMTPS (465)**: Used for encrypted SMTP mail sending (SSL/TLS method).
- **SMTP (587)**: Used for clients to send email to mail servers, supports STARTTLS encryption.
- **POP3 (110)**: Used for email clients to download mail from servers, unencrypted.
- **POP3S (995)**: Used for encrypted POP3, securely downloading mail (SSL/TLS method).
- **IMAP (143)**: Used for email clients to manage mail online (view, sync mail), unencrypted.
- **IMAPS (993)**: Used for encrypted IMAP, securely managing mail (SSL/TLS method).
Specifically, if the current host machine is not being used as a mail server or not receiving electronic mail, then this project metric can be disregarded.
---
## 日本語
### **システム基本情報**
CPU型番: 簡単に言えば、CPUの発売時期によって、新しいモデルならAMDがIntelより優れ、古いモデルならIntelがAMDより優れています。
CPUコア数: 物理コアか論理コアかを検出し、優先的に物理コアを表示します。物理コアが検出できない場合のみ論理コアを表示します。サーバーの実際の使用では、プログラムは通常、論理コアに基づいて実行されます。ビデオエンコードや科学計算以外では、物理コアは通常ハイパースレッディングを有効にして論理コアとして使用されます。比較する際は、同じタイプのコア数を比較することが意味を持ちます。
CPUキャッシュホストマシンのCPU L1/L2/L3キャッシュ情報を表示します。
AES-NI: 暗号化/復号化を高速化する命令セットです。これがあれば通常のネットワークリクエストがより速く、パフォーマンスが高くなります。ない場合はネットワークリクエスト(プロキシ用途を含む)に影響します。
VM-x/AMD-V/Hyper-V: 現在のテスト環境がネステッド仮想化をサポートしているかどうかを示す指標です。テスト環境がDockerコンテナ内にあるか、root権限がない場合、デフォルトでは検出できず、ネステッド仮想化をサポートしていないと表示されます。この指標は、ホストマシン上で仮想マシンKVM、VirtualBox、VMwareなどを設定する必要がある場合に役立ちますが、他の用途ではあまり重要ではありません。
メモリ: 使用中サイズ/総サイズ のメモリを表示します。仮想メモリは含まれません。
バルーンドライバ: ホストマシンがバルーンドライバを使用しているかどうかを表示します。使用している場合は、親マシンがメモリを共有していることを示し、以下のメモリ読み書きテストと合わせて、オーバーセリング/厳しい制限があるかどうかを確認する必要があります。
Kernel Same-page Merging: ホストマシンがKSMメモリマージを使用しているかどうかを表示します。使用している場合は、親マシンがメモリを共有していることを示し、以下のメモリ読み書きテストと合わせて、オーバーセリング/厳しい制限があるかどうかを確認する必要があります。
仮想メモリ: SWAP仮想メモリを表示します
ディスク容量: 使用中サイズ/総サイズ のディスク容量を表示します
ブートディスクパス:ブートディスクのパスを表示します
OS: システム名とアーキテクチャを表示します
カーネル: システムカーネルバージョンを表示します
システム稼働時間: ホストマシンが起動してからテスト時までの稼働時間を表示します
タイムゾーン: ホストマシンのシステムタイムゾーンを表示します
負荷: システム負荷を表示します
仮想化アーキテクチャ: ホストマシンがどの仮想化アーキテクチャから来ているかを表示します。一般的に ```Dedicated > KVM > Xen``` 仮想化が推奨されます。他の仮想化はパフォーマンス低下を引き起こし、使用時にパフォーマンス共有/損失が発生しますが、これも確実ではありません。専用サーバーのみが完全に独立したリソース占有を持ち、他の仮想化はほとんどリソース共有があります。これはホストマシンの販売者が良心的かどうかによって異なります。具体的なパフォーマンスの優劣は、後の専門テストを見る必要があります。
NAT種類: NAT種類を表示します。具体的には ```Full Cone > Restricted Cone > Port Restricted Cone > Symmetric``` が推奨されます。検出できない場合は ```Inconclusive``` と表示されます。一般的に特別な用途(特殊なプロキシとリアルタイム通信の要件に関連する)に使用しない限り、この指標を気にする必要はありません。
TCP加速方式一般的に ```cubic/bbr``` 輻輳制御プロトコルです。一般的にプロキシサーバーとして使用する場合、bbrを使用するとネットワーク速度が改善されますが、通常の用途ではこの指標に注目する必要はありません。
IPV4/IPV6 ASN: ホストマシンのIPが属するASN組織IDと名前を表示します。同じIDCに複数のASNがある可能性があり、1つのASNの下に異なるIPセグメントのサーバーを販売する複数の業者がいる可能性があります。具体的な上流/下流関係は複雑です。bgp.toolを使用してさらに詳しく調べることができます。
IPV4/IPV6 ロケーション: データベース内の対応するプロトコルのIPの地理的位置を表示します。
IPV4 アクティブIP: bgp.tools情報に基づいて、現在のCIDRチャンクのアクティブなネイバー数/総ネイバー数を照会する。
### **CPUテスト**
コマンドラインパラメータを通じて```GeekBench```と```Sysbench```のテストを選択できます:
| 比較項目 | sysbench | geekbench |
|------------------|----------|-----------|
| 適用範囲 | 軽量、ほぼすべてのサーバーで実行可能 | 重量級、小型マシンでは実行不可 |
| テスト要件 | ネットワーク不要、特別なハードウェア要件なし | ネットワーク必要、IPV4環境、最低1Gメモリ |
| オープンソース状況 | LUAベース、オープンソース、各アーキテクチャ版をコンパイル可能本プロジェクトではGoに再構築して内蔵 | 公式バイナリはクローズドソース、自己コンパイル不可 |
| テスト安定性 | コアテストコンポーネントは10年以上変更なし | 各メジャーバージョンでテスト項目更新、スコアはバージョン間で比較困難各バージョンは当時最高のCPUを基準 |
| テスト内容 | 計算性能のみテスト、素数計算ベース | 多様な性能テストカバー、スコアは重み付け計算、一部テストは実際にはあまり使用されない |
| 適用シーン | 迅速なテストに適合、計算性能のみテスト | 総合的な全面テストに適合 |
デフォルトでは```Sysbench```を使用してテストを行います。基準は概ね以下の通りです:
CPUテストのシングルコア```Sysbench```スコアが5000以上なら第一ティア、4000〜5000点なら第二ティア、1000点ごとに大体一ランクと考えられます。
AMDの7950xシングルコアのフルパフォーマンススコアは約6500、AMDの5950xシングルコアのフルパフォーマンススコアは約5700、Intelの通常のCPUE5などは約1000〜800、500未満のシングルコアCPUはパフォーマンスが比較的低いと言えます。
時々、マルチコアスコアとシングルコアスコアが同じ場合があります。これは販売者がプログラムの並列CPU使用を制限していることを示しています。典型的な例はTencent Cloudです。
Sysbenchのベンチマークは[CPU Performance Ladder For Sysbench](https://sysbench.spiritlhl.net/)のラダーチャートで見ることができる。
```GeekBench```の基準は[公式ウェブサイト](https://browser.geekbench.com/processor-benchmarks/)の階層チャートを参照してください。具体的なスコアは各```GeekBench```バージョンで異なるため、テスト時の```GeekBench```バージョンに注意してください。
補足ですが、```GeekBench```がテストする多くの内容は、サーバー使用過程で実際には必要ないことが多いです。テストは参考程度にしてください。もちろん```Sysbench```は非常に包括的ではありませんが、基本的な計算性能に基づいてCPUのパフォーマンスを大まかに比較できます。
実際にはCPUパフォーマンスは十分であれば良く、科学計算やビデオエンコード以外では、特に高性能CPUを追求する必要はありません。
### **メモリテスト**
一般的に、IO速度が```10240MB/s```未満かどうかを判断するだけで十分です。この値を下回る場合、メモリパフォーマンスが良くなく、オーバーセリング/オーバーコミットの問題がある可能性が非常に高いです。
オーバーコミットの原因は、仮想メモリの使用ディスクをメモリとして使用、ZRAMCPUパフォーマンスを犠牲、バルーンドライバの使用、KSMメモリマージの使用など、様々な可能性があります。
### **ディスクテスト**
```dd```テストは誤差が大きい可能性がありますが、テスト速度が速くディスクサイズ制限がありません。```fio```テストはより現実的ですが、テスト速度が遅く、ディスクおよびメモリサイズの最低要件があります。
同時に、サーバーには異なるファイルシステムがある可能性があり、特定のファイルシステムのIOエンジンは同じハードウェア条件下でも読み書き速度が速くなる場合があります。これは正常です。プロジェクトはデフォルトで```fio```を使用してテストを行います。テストに使用されるIOエンジンの優先順位は```libaio > posixaio > psync```です。代替オプションの```dd```テストは```fio```テストが利用できない場合に自動的に置き換えられます。
```fio```テスト結果を例に基準は以下の通りです:
| OSタイプ | 主要指標 | 副次指標 |
|---------|-------------------|---------------------|
| Windows/Mac | 4K読み → 64K読み → 書き込みテスト | グラフィカルインターフェースシステムは読み取りパフォーマンスを優先 |
| Linux (GUIなし) | 4K読み + 4K書き + 1M読み書き| 読み/書き値は通常類似 |
以下のディスクタイプの指標値は、通常〜フルパフォーマンス状態を示し、```libaio```をIOテストエンジンとして使用し、```Linux```でテストを実施した場合を指します:
| ドライブタイプ | 4K(IOPS)パフォーマンス | 1M(IOPS)パフォーマンス |
|------------|--------------------------|----------------------|
| NVMe SSD | ≥ 200 MB/s | 5-10 GB/s |
| 標準SSD | 50-100 MB/s | 2-3 GB/s |
| HDD (機械式ハードディスク) | 10-40 MB/s | 500-600 MB/s |
| 性能不良 | < 10 MB/s | < 200 MB/s |
迅速な評価
1. **主要チェック**: 4K読み(IOPS) 4K書き(IOPS)
- ほぼ同じで大きな差がない
- 200 MB/s = NVMe SSD
- 50-100 MB/s = 標準SSD
- 10-40 MB/s = HDD (機械式ハードディスク)
- < 10 MB/s = 性能不良、オーバーセリング/制限が深刻
2. **副次チェック**: 1M合計(IOPS)
- プロバイダが設定したIO制限
- リソースのオーバーコミット状況
- 値が高いほど良い
- NVMe SSDは通常4-6 GB/s達成
- 標準SSDは通常1-2 GB/s達成
NVMe SSDの1M(IOPS)値が< 1GB/sの場合深刻なリソースオーバーコミットが存在することを示します
注意ここでテストされるのは実際のIOであり本プロジェクトに限定されます本プロジェクト以外のテストによるIOは基準の普遍性を保証できません他のテストでは同じパラメータを使用していない可能性がありIO直接読み書きを設定していない可能性IOエンジンの設定が一致しない可能性テスト時間の設定が一致しない可能性がありこれらはすべて基準にズレを生じさせる原因となります
### **ストリーミングメディアロック解除**
一般的なストリーミングメディアプラットフォームのロック解除を検索しますもちろんすべてがストリーミングメディアというわけではなく他の一般的なプラットフォームのロック解除も含まれています一般的にIPのロック解除地域は一貫しておりあちこちに変動することはありません複数のプラットフォームでロック解除地域が一致しない場合そのIPはIPXOなどのプラットフォームからレンタルされている可能性が高く各プラットフォームのデータベース識別が遅いためIP品質も一般的に良くないと考えられます
### **IP品質検出**
14のデータベースのIP関連情報を検出します一般的に使用タイプ会社タイプおよびその他のセキュリティ情報の判別を見るだけで十分ですセキュリティスコアは参考程度です複数のプラットフォームで対応する検出項目が一致している場合現在のIPが確かにそうであることを証明しています単一のデータベースソースの情報だけを信頼しないでください
### **メールポート検出**
- **SMTP25**メールサーバー間でメールを転送するために使用されますメール送信)。
- **SMTPS465**暗号化されたSMTPメール送信SSL/TLS方式に使用されます
- **SMTP587**クライアントからメールサーバーへのメール送信に使用されSTARTTLS暗号化をサポートします
- **POP3110**メールクライアントがサーバーからメールをダウンロードするために使用され暗号化されていません
- **POP3S995**暗号化されたPOP3用で安全にメールをダウンロードしますSSL/TLS方式)。
- **IMAP143**メールクライアントがオンラインでメールを管理するために使用されますメールの閲覧同期)、暗号化されていません
- **IMAPS993**暗号化されたIMAP用で安全にメールを管理しますSSL/TLS方式)。
具体的に現在のホストマシンがメールサーバーとして使用されていないまたは電子メールを受信しない場合この項目の指標は気にする必要はありません
---

View File

@@ -4,6 +4,6 @@ import (
"github.com/oneclickvirt/backtrace/bk"
)
func BackTrace() {
backtrace.BackTrace()
func BackTrace(enableIpv6 bool) {
backtrace.BackTrace(enableIpv6)
}

View File

@@ -15,6 +15,7 @@ import (
// }
//}
// 本包仅测试,无实际使用
func TestBackTrace(t *testing.T) {
BackTrace()
BackTrace(false)
}

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)

View File

@@ -4,6 +4,7 @@ import (
"testing"
)
// 本包仅测试无实际使用
func TestMedia(t *testing.T) {
ComMediaTest("zh")
}

View File

@@ -3,6 +3,7 @@ package ntrace
import "testing"
// https://github.com/nxtrace/NTrace-core/blob/main/fast_trace/fast_trace.go
// 本包仅测试无实际使用
func TestTraceRoute(t *testing.T) {
TraceRoute3("en", "GZ", "ipv4")
}

View File

@@ -36,6 +36,6 @@ func DiskTest(language, testMethod, testPath string, isMultiCheck bool, autoChan
if !strings.Contains(res, "\n") && res != "" {
res += "\n"
}
fmt.Printf(res)
fmt.Printf("%s", res)
//fmt.Println("--------------------------------------------------")
}

View File

@@ -3,5 +3,5 @@ package disktest
import "testing"
func TestDiskIoTest(t *testing.T) {
DiskTest("zh", "sysbench", "", false)
DiskTest("zh", "sysbench", "", false, false)
}

105
go.mod
View File

@@ -1,69 +1,72 @@
module github.com/oneclickvirt/ecs
go 1.22.4
go 1.24.1
toolchain go1.24.2
require (
github.com/imroc/req/v3 v3.43.7
github.com/oneclickvirt/CommonMediaTests v0.0.4-20240704024502
github.com/oneclickvirt/UnlockTests v0.0.16-20240814122959
github.com/oneclickvirt/backtrace v0.0.4-20240702140722
github.com/oneclickvirt/basics v0.0.7-20240814092329
github.com/oneclickvirt/cputest v0.0.8-20240702070215
github.com/imroc/req/v3 v3.50.0
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841
github.com/oneclickvirt/UnlockTests v0.0.27-20250628125053
github.com/oneclickvirt/backtrace v0.0.5-20250629024536
github.com/oneclickvirt/basics v0.0.13-20250629023612
github.com/oneclickvirt/cputest v0.0.10-20250404151448
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-20240814081347
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/security v0.0.4-20240729065854
github.com/oneclickvirt/speedtest v0.0.7-20240704023701
github.com/oneclickvirt/disktest v0.0.8-20250701082736
github.com/oneclickvirt/gostun v0.0.3-20250329105202
github.com/oneclickvirt/memorytest v0.0.6-20250630141424.0.20250701022859-5967f9d8d3eb
github.com/oneclickvirt/nt3 v0.0.5-20250416131047
github.com/oneclickvirt/pingtest v0.0.7-20250413051539
github.com/oneclickvirt/portchecker v0.0.3-20250329125750
github.com/oneclickvirt/security v0.0.4-20250629033626
github.com/oneclickvirt/speedtest v0.0.9-20250521034111
)
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.9.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/go-viper/mapstructure/v2 v2.2.1 // 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
github.com/huin/goupnp v1.2.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
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/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.4.0 // indirect
github.com/oneclickvirt/dd v0.0.2-20250701030820 // indirect
github.com/oneclickvirt/fio v0.0.2-20250701074629 // indirect
github.com/oneclickvirt/mbw v0.0.1-20250630140849 // indirect
github.com/onsi/ginkgo/v2 v2.22.1 // indirect
github.com/oschwald/maxminddb-golang v1.13.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // 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,44 +75,42 @@ 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/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/rodaine/table v1.3.0 // indirect
github.com/sagikazarmark/locafero v0.9.0 // indirect
github.com/schollz/progressbar/v3 v3.14.4 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/shirou/gopsutil/v4 v4.24.5 // indirect
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/pflag v1.0.5 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/spf13/afero v1.14.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/spf13/viper v1.20.1 // 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
gopkg.in/ini.v1 v1.67.0 // indirect
golang.org/x/crypto v0.37.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.39.0 // indirect
golang.org/x/sync v0.13.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.31.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/tools v0.29.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
howett.net/plist v1.0.0 // indirect

221
go.sum
View File

@@ -2,31 +2,33 @@ 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.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.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=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/gofrs/uuid/v5 v5.2.0 h1:qw1GMx6/y8vhVsx626ImfKMuS5CvJmhIKKtuyvfajMM=
github.com/gofrs/uuid/v5 v5.2.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -35,23 +37,21 @@ 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=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
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.50.0 h1:n3BVnZiTRpvkN5T1IB79LC/THhFU9iXksNRMH4ZNVaY=
github.com/imroc/req/v3 v3.50.0/go.mod h1:tsOk8K7zI6cU4xu/VWCZVtq9Djw9IWm4MslKzme5woU=
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,66 +78,67 @@ 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/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=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
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/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-20240814122959 h1:JoWnw6sR9hFHQy7IesDc3VQftvosn17lKb45Ptqz5kQ=
github.com/oneclickvirt/UnlockTests v0.0.16-20240814122959/go.mod h1:UELwZDDiddSxe38boYOPl1FlrL0ptEZYSQwdE3MYvUM=
github.com/oneclickvirt/backtrace v0.0.4-20240702140722 h1:UJ/VWf+ZbhGarc9HcHMIyenpmX+b2LxkXu0hlLk3Gxs=
github.com/oneclickvirt/backtrace v0.0.4-20240702140722/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8=
github.com/oneclickvirt/basics v0.0.7-20240814092329 h1:0laE9aFd6dV8bnKgxeqYBCTsqAQTO/dKxdMSCMopAuk=
github.com/oneclickvirt/basics v0.0.7-20240814092329/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/nxtrace/NTrace-core v1.4.0 h1:pDN2BqxIYjedDKCDDOFBcDNOBnavGcx+4wbiG65Xqiw=
github.com/nxtrace/NTrace-core v1.4.0/go.mod h1:0AWqbqiIJbpbFG6W48vtJ6pWM8PPF+lQ1fi2371y+zA=
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841 h1:Zef93z9UiZQwRAKnnZYALmpBKvvuVaq34MEsuWwk6nc=
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
github.com/oneclickvirt/UnlockTests v0.0.27-20250628125053 h1:Ug8kySZR1weRUcsnGOv+f3HAl791AfkA7EWV3JmiMQA=
github.com/oneclickvirt/UnlockTests v0.0.27-20250628125053/go.mod h1:yXWIZB6iLS88pEd9m4QJi1GENn+7I91zA72y5ONz2Oc=
github.com/oneclickvirt/backtrace v0.0.5-20250629024536 h1:caHCa0DHmbYWBFN1bqKxpvPnN0wOxDEqJv1VDvDdLWs=
github.com/oneclickvirt/backtrace v0.0.5-20250629024536/go.mod h1:5AH00bo41hH3d2/JVuCTlBkZUs3AXX4nlKVXb6piZcI=
github.com/oneclickvirt/basics v0.0.13-20250629023612 h1:cQg+cGBt2NMRrjhJPH+CbevZrwtMU8pIZIY2Lp6zmt4=
github.com/oneclickvirt/basics v0.0.13-20250629023612/go.mod h1:yN1IEOXN6v/GJqJSA70Pooo6nXBI/6rq72vTY72wJMQ=
github.com/oneclickvirt/cputest v0.0.10-20250404151448 h1:ovGtCwFXG0qmpyNDRqcNDIiAmhrtemCjIUXTJ1fPH0o=
github.com/oneclickvirt/cputest v0.0.10-20250404151448/go.mod h1:MmaHN9+XMntI3rLycwj8Ne31fG18IfNoa8N2utDK1CY=
github.com/oneclickvirt/dd v0.0.2-20250701030820 h1:qezfANX8XbM9XodfF2/AikpsUfeOqbRuEn0gJWFtmeA=
github.com/oneclickvirt/dd v0.0.2-20250701030820/go.mod h1:tImu9sPTkLWo2tf1dEN1xQzrylWKauj9hbU8PHfyAeU=
github.com/oneclickvirt/defaultset v0.0.2-20240624082446 h1:5Pg3mK/u/vQvSz7anu0nxzrNdELi/AcDAU1mMsmPzyc=
github.com/oneclickvirt/defaultset v0.0.2-20240624082446/go.mod h1:e9Jt4tf2sbemCtc84/XgKcHy9EZ2jkc5x2sW1NiJS+E=
github.com/oneclickvirt/disktest v0.0.4-20240809053456 h1:g6fKzvImIV8YQZKKEJ2FdvooL+EUf9NndAU8c4aGCX4=
github.com/oneclickvirt/disktest v0.0.4-20240809053456/go.mod h1:wIZy8G6Mbcy8Op8tc0HmJNpbJQQ5A15fvnUqMJXIdO0=
github.com/oneclickvirt/gostun v0.0.3-20240702054621 h1:IE89eEYV9TJbF94SakQDAxTLIaqX+Tb6ZhJ/CCIP+90=
github.com/oneclickvirt/gostun v0.0.3-20240702054621/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
github.com/oneclickvirt/memorytest v0.0.4-20240814081347 h1:xOlCh8IpcI0YtP0IU/+IID8ri/Jz6mQ3gGg6zIQ0D6g=
github.com/oneclickvirt/memorytest v0.0.4-20240814081347/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/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/disktest v0.0.8-20250701082736 h1:i6Ueq1yvM2FHP4jxWyKStdEuH7KKD2IdKJZfM84khkE=
github.com/oneclickvirt/disktest v0.0.8-20250701082736/go.mod h1:rb5ZNPHmgkxPSSVPacRAF260nEy/yM/dKqpHgApICHA=
github.com/oneclickvirt/fio v0.0.2-20250701074629 h1:n74OY099F/3zMnO4gOZh2BDUQaYSSuuzyEVj0lXFz+k=
github.com/oneclickvirt/fio v0.0.2-20250701074629/go.mod h1:NIq+XYTey68KNERGIy/oRDlzpwLzBVoHOCiqX8didsE=
github.com/oneclickvirt/gostun v0.0.3-20250329105202 h1:aJ6E91Lp94lq8iWRcCaxpXTjqOOaWvufr5oras6cFtM=
github.com/oneclickvirt/gostun v0.0.3-20250329105202/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
github.com/oneclickvirt/mbw v0.0.1-20250630140849 h1:p6RMhOPBnQKAm9+VEQ2axAFsidrdSdrhXMyheIyv2a8=
github.com/oneclickvirt/mbw v0.0.1-20250630140849/go.mod h1:0Vq6NRpyLmGUdfHfL3uDcFsuZhi7KlG+OCs5ky2757Y=
github.com/oneclickvirt/memorytest v0.0.6-20250630141424.0.20250701022859-5967f9d8d3eb h1:EKYQWLw4um/C2xm6z8aDl+owWtvaIp0z7nlyMj62kkk=
github.com/oneclickvirt/memorytest v0.0.6-20250630141424.0.20250701022859-5967f9d8d3eb/go.mod h1:7xMacjQobvFAtODht2hxTsB9hM2IFS7vZk3gxx+bsjo=
github.com/oneclickvirt/nt3 v0.0.5-20250416131047 h1:KL0xowq19cW+FMBGMJxdqpRNoeyR+eEmb+jYSubmlTk=
github.com/oneclickvirt/nt3 v0.0.5-20250416131047/go.mod h1:CVsDJEaIdyyZHn3WKbhU8Wn6GOfmBNvJlC/dDLRqcSQ=
github.com/oneclickvirt/pingtest v0.0.7-20250413051539 h1:mYOsEmMtwKr40hwM2NimVLpnbR2cjwuOh1c/9fQr2Dw=
github.com/oneclickvirt/pingtest v0.0.7-20250413051539/go.mod h1:d3Ntx5m9lMll3a/k3+2B+5emj//vgDh4/NHTxs2qQE8=
github.com/oneclickvirt/portchecker v0.0.3-20250329125750 h1:TTNL0pnQlRsn046kW59I/9UWRpihttFHWnU7Ixycggk=
github.com/oneclickvirt/portchecker v0.0.3-20250329125750/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
github.com/oneclickvirt/security v0.0.4-20250629033626 h1:DEchQ7WKKz4CzQpMlweoqA993BGncvmp1rL1ICNDJ2g=
github.com/oneclickvirt/security v0.0.4-20250629033626/go.mod h1:/5eVnZLvP7RUjwhoI6d8iIMP7msbkHC5So3ZxM+A7Zg=
github.com/oneclickvirt/speedtest v0.0.9-20250521034111 h1:yygDk+s5qFhPMDRzdMfyopm1xU512peNqY6WYyvYcfY=
github.com/oneclickvirt/speedtest v0.0.9-20250521034111/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
github.com/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.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
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,23 +158,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/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/sagikazarmark/locafero v0.9.0 h1:GbgQGNtTrEmddYDSAH9QLRyfAHY12md+8YFTqyMTC9k=
github.com/sagikazarmark/locafero v0.9.0/go.mod h1:UBUyz37V+EdMS3hDF3QWIiVr/2dPrx49OMO0Bn0hJqk=
github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74=
github.com/schollz/progressbar/v3 v3.14.4/go.mod h1:aT3UQ7yGm+2ZjeXPqsjTenwL3ddUiuZ0kfQ/2tHlyNI=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
@@ -188,14 +187,14 @@ 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/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=
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
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.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4=
github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -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.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
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.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
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.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
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.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -288,16 +289,16 @@ 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.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o=
golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw=
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/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
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/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -305,18 +306,16 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
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.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.35.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=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

738
goecs.go
View File

@@ -2,30 +2,9 @@ package main
import (
"bufio"
"context"
"flag"
"fmt"
"github.com/oneclickvirt/CommonMediaTests/commediatests"
unlocktestmodel "github.com/oneclickvirt/UnlockTests/model"
backtraceori "github.com/oneclickvirt/backtrace/bk"
basicmodel "github.com/oneclickvirt/basics/model"
cputestmodel "github.com/oneclickvirt/cputest/model"
disktestmodel "github.com/oneclickvirt/disktest/disk"
"github.com/oneclickvirt/ecs/backtrace"
"github.com/oneclickvirt/ecs/commediatest"
"github.com/oneclickvirt/ecs/cputest"
"github.com/oneclickvirt/ecs/disktest"
"github.com/oneclickvirt/ecs/memorytest"
"github.com/oneclickvirt/ecs/ntrace"
"github.com/oneclickvirt/ecs/speedtest"
"github.com/oneclickvirt/ecs/unlocktest"
"github.com/oneclickvirt/ecs/utils"
gostunmodel "github.com/oneclickvirt/gostun/model"
memorytestmodel "github.com/oneclickvirt/memorytest/memory"
nt3model "github.com/oneclickvirt/nt3/model"
ptmodel "github.com/oneclickvirt/pingtest/model"
"github.com/oneclickvirt/pingtest/pt"
"github.com/oneclickvirt/portchecker/email"
speedtestmodel "github.com/oneclickvirt/speedtest/model"
"net/http"
"os"
"os/signal"
@@ -35,10 +14,32 @@ import (
"sync"
"syscall"
"time"
"github.com/oneclickvirt/CommonMediaTests/commediatests"
unlocktestmodel "github.com/oneclickvirt/UnlockTests/model"
backtrace "github.com/oneclickvirt/backtrace/bk"
backtracemodel "github.com/oneclickvirt/backtrace/model"
basicmodel "github.com/oneclickvirt/basics/model"
cputestmodel "github.com/oneclickvirt/cputest/model"
disktestmodel "github.com/oneclickvirt/disktest/disk"
"github.com/oneclickvirt/ecs/cputest"
"github.com/oneclickvirt/ecs/disktest"
"github.com/oneclickvirt/ecs/memorytest"
"github.com/oneclickvirt/ecs/speedtest"
"github.com/oneclickvirt/ecs/unlocktest"
"github.com/oneclickvirt/ecs/utils"
gostunmodel "github.com/oneclickvirt/gostun/model"
memorytestmodel "github.com/oneclickvirt/memorytest/memory"
nt3model "github.com/oneclickvirt/nt3/model"
"github.com/oneclickvirt/nt3/nt"
ptmodel "github.com/oneclickvirt/pingtest/model"
"github.com/oneclickvirt/pingtest/pt"
"github.com/oneclickvirt/portchecker/email"
speedtestmodel "github.com/oneclickvirt/speedtest/model"
)
var (
ecsVersion = "v0.0.72"
ecsVersion = "v0.1.47"
menuMode bool
onlyChinaTest bool
input, choice string
@@ -60,9 +61,67 @@ var (
enabelUpload = true
help bool
goecsFlag = flag.NewFlagSet("goecs", flag.ContinueOnError)
finish bool
)
func main() {
func getMenuChoice(language string) string {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
defer signal.Stop(sigChan)
inputChan := make(chan string, 1)
go func() {
select {
case <-sigChan:
fmt.Println("\n程序在选择过程中被用户中断")
os.Exit(0)
case <-ctx.Done():
return
}
}()
for {
go func() {
var input string
fmt.Print("请输入选项 / Please enter your choice: ")
fmt.Scanln(&input)
input = strings.TrimSpace(input)
input = strings.TrimRight(input, "\n")
select {
case inputChan <- input:
case <-ctx.Done():
return
}
}()
select {
case input := <-inputChan:
re := regexp.MustCompile(`^\d+$`)
if re.MatchString(input) {
inChoice := input
switch inChoice {
case "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
return inChoice
default:
if language == "zh" {
fmt.Println("无效的选项")
} else {
fmt.Println("Invalid choice")
}
}
} else {
if language == "zh" {
fmt.Println("输入错误,请输入一个纯数字")
} else {
fmt.Println("Invalid input, please enter a number")
}
}
case <-ctx.Done():
return ""
}
}
}
func parseFlags() {
goecsFlag.BoolVar(&help, "h", false, "Show help information")
goecsFlag.BoolVar(&showVersion, "v", false, "Display version information")
goecsFlag.BoolVar(&menuMode, "menu", true, "Enable/Disable menu mode, disable example: -menu=false") // true 默认启用菜单栏模式
@@ -80,7 +139,7 @@ func main() {
goecsFlag.BoolVar(&speedTestStatus, "speed", true, "Enable/Disable speed test")
goecsFlag.StringVar(&cpuTestMethod, "cpum", "sysbench", "Set CPU test method (supported: sysbench, geekbench, winsat)")
goecsFlag.StringVar(&cpuTestThreadMode, "cput", "multi", "Set CPU test thread mode (supported: single, multi)")
goecsFlag.StringVar(&memoryTestMethod, "memorym", "dd", "Set memory test method (supported: sysbench, dd, winsat)")
goecsFlag.StringVar(&memoryTestMethod, "memorym", "sysbench", "Set memory test method (supported: sysbench, dd, winsat)")
goecsFlag.StringVar(&diskTestMethod, "diskm", "fio", "Set disk test method (supported: fio, dd, winsat)")
goecsFlag.StringVar(&diskTestPath, "diskp", "", "Set disk test path, e.g., -diskp /root")
goecsFlag.BoolVar(&diskMultiCheck, "diskmc", false, "Enable/Disable multiple disk checks, e.g., -diskmc=false")
@@ -90,17 +149,22 @@ func main() {
goecsFlag.BoolVar(&enableLogger, "log", false, "Enable/Disable logging in the current path")
goecsFlag.BoolVar(&enabelUpload, "upload", true, "Enable/Disable upload the result")
goecsFlag.Parse(os.Args[1:])
}
func handleHelpAndVersion() bool {
if help {
fmt.Printf("Usage: %s [options]\n", os.Args[0])
goecsFlag.PrintDefaults()
return
return true
}
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
if showVersion {
fmt.Println(ecsVersion)
return
return true
}
return false
}
func initLogger() {
if enableLogger {
gostunmodel.EnableLoger = true
basicmodel.EnableLoger = true
@@ -110,18 +174,76 @@ func main() {
commediatests.EnableLoger = true
unlocktestmodel.EnableLoger = true
ptmodel.EnableLoger = true
backtraceori.EnableLoger = true
backtracemodel.EnableLoger = true
nt3model.EnableLoger = true
speedtestmodel.EnableLoger = true
}
go func() {
http.Get("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")
}()
if menuMode {
}
func handleMenuMode(preCheck utils.NetCheckResult) {
basicStatus, cpuTestStatus, memoryTestStatus, diskTestStatus = false, false, false, false
commTestStatus, utTestStatus, securityTestStatus, emailTestStatus = false, false, false, false
backtraceStatus, nt3Status, speedTestStatus = false, false, false
autoChangeDiskTestMethod = true
printMenuOptions()
Loop:
for {
choice = getMenuChoice(language)
switch choice {
case "1":
setFullTestStatus(preCheck)
onlyChinaTest = utils.CheckChina(enableLogger)
break Loop
case "2":
setMinimalTestStatus(preCheck)
break Loop
case "3":
setStandardTestStatus(preCheck)
break Loop
case "4":
setNetworkFocusedTestStatus(preCheck)
break Loop
case "5":
setUnlockFocusedTestStatus(preCheck)
break Loop
case "6":
if !preCheck.Connected {
fmt.Println("Can not test without network connection!")
return
}
setNetworkOnlyTestStatus()
break Loop
case "7":
if !preCheck.Connected {
fmt.Println("Can not test without network connection!")
return
}
setUnlockOnlyTestStatus()
break Loop
case "8":
setHardwareOnlyTestStatus(preCheck)
break Loop
case "9":
if !preCheck.Connected {
fmt.Println("Can not test without network connection!")
return
}
setIPQualityTestStatus()
break Loop
case "10":
if !preCheck.Connected {
fmt.Println("Can not test without network connection!")
return
}
setRouteTestStatus()
break Loop
default:
printInvalidChoice()
}
}
}
func printMenuOptions() {
switch language {
case "zh":
fmt.Println("VPS融合怪版本: ", ecsVersion)
@@ -147,21 +269,14 @@ func main() {
fmt.Println("8. Hardware-Only Test (System Info + CPU + Memory + dd Disk Test + fio Disk Test)")
fmt.Println("9. IP Quality Test (IP Test with 15 Databases + Email Port Test)")
}
Loop:
for {
fmt.Print("请输入选项 / Please enter your choice: ")
fmt.Scanln(&input)
input = strings.TrimSpace(input)
input = strings.TrimRight(input, "\n")
re := regexp.MustCompile(`^\d+$`) // 正则表达式匹配纯数字
if re.MatchString(input) {
choice = input
switch choice {
case "1":
}
func setFullTestStatus(preCheck utils.NetCheckResult) {
basicStatus = true
cpuTestStatus = true
memoryTestStatus = true
diskTestStatus = true
if preCheck.Connected {
commTestStatus = true
utTestStatus = true
securityTestStatus = true
@@ -169,87 +284,100 @@ func main() {
backtraceStatus = true
nt3Status = true
speedTestStatus = true
onlyChinaTest = utils.CheckChina(enableLogger)
break Loop
case "2":
}
}
func setMinimalTestStatus(preCheck utils.NetCheckResult) {
basicStatus = true
cpuTestStatus = true
memoryTestStatus = true
diskTestStatus = true
if preCheck.Connected {
speedTestStatus = true
break Loop
case "3":
}
}
func setStandardTestStatus(preCheck utils.NetCheckResult) {
basicStatus = true
cpuTestStatus = true
memoryTestStatus = true
diskTestStatus = true
if preCheck.Connected {
utTestStatus = true
nt3Status = true
speedTestStatus = true
break Loop
case "4":
}
}
func setNetworkFocusedTestStatus(preCheck utils.NetCheckResult) {
basicStatus = true
cpuTestStatus = true
memoryTestStatus = true
diskTestStatus = true
if preCheck.Connected {
backtraceStatus = true
nt3Status = true
speedTestStatus = true
break Loop
case "5":
}
}
func setUnlockFocusedTestStatus(preCheck utils.NetCheckResult) {
basicStatus = true
cpuTestStatus = true
memoryTestStatus = true
diskTestStatus = true
if preCheck.Connected {
commTestStatus = true
utTestStatus = true
speedTestStatus = true
break Loop
case "6":
}
}
func setNetworkOnlyTestStatus() {
securityTestStatus = true
speedTestStatus = true
backtraceStatus = true
nt3Status = true
break Loop
case "7":
}
func setUnlockOnlyTestStatus() {
commTestStatus = true
utTestStatus = true
enabelUpload = false
break Loop
case "8":
}
func setHardwareOnlyTestStatus(preCheck utils.NetCheckResult) {
basicStatus = true
cpuTestStatus = true
memoryTestStatus = true
diskTestStatus = true
if preCheck.Connected {
securityTestStatus = false
autoChangeDiskTestMethod = false
break Loop
case "9":
}
}
func setIPQualityTestStatus() {
securityTestStatus = true
emailTestStatus = true
break Loop
case "10":
}
func setRouteTestStatus() {
backtraceStatus = true
nt3Status = true
pingTestStatus = true
enabelUpload = false
break Loop
default:
}
func printInvalidChoice() {
if language == "zh" {
fmt.Println("无效的选项")
} else {
fmt.Println("Invalid choice")
}
}
} else {
if language == "zh" {
fmt.Println("输入错误,请输入一个纯数字")
} else {
fmt.Println("Invalid input, please enter a number")
}
}
}
}
func handleLanguageSpecificSettings() {
if language == "en" {
backtraceStatus = false
nt3Status = false
@@ -257,183 +385,165 @@ func main() {
if !enabelUpload {
securityTestStatus = false
}
var (
startTime time.Time
wg1, wg2, wg3 sync.WaitGroup
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
output, tempOutput string
)
// 启动一个goroutine来等待信号内置计时器
go func() {
startTime = time.Now()
// 等待信号
<-sig
}
func handleSignalInterrupt(sig chan os.Signal, startTime *time.Time, output *string, tempOutput string, uploadDone chan bool, outputMutex *sync.Mutex) {
select {
case <-sig:
if !finish {
endTime := time.Now()
duration := endTime.Sub(startTime)
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() {
outputMutex.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)
utils.ProcessAndUpload(output, filePath, enabelUpload)
os.Exit(1) // 使用非零状态码退出,表示意外退出
}, tempOutput, *output)
outputMutex.Unlock()
resultChan := make(chan struct {
httpURL string
httpsURL string
}, 1)
go func() {
outputMutex.Lock()
finalOutput := *output
outputMutex.Unlock()
httpURL, httpsURL := utils.ProcessAndUpload(finalOutput, filePath, enabelUpload)
resultChan <- struct {
httpURL string
httpsURL string
}{httpURL, httpsURL}
uploadDone <- true
}()
switch language {
case "zh":
output = utils.PrintAndCapture(func() {
utils.PrintHead(language, width, ecsVersion)
if basicStatus || securityTestStatus {
if basicStatus {
utils.PrintCenteredTitle("系统基础信息", width)
}
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
if basicStatus {
fmt.Printf(basicInfo)
} else if (input == "6" || input == "9") && securityTestStatus {
scanner := bufio.NewScanner(strings.NewReader(basicInfo))
for scanner.Scan() {
line := scanner.Text()
if strings.Contains(line, "IPV") {
fmt.Println(line)
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)
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
fmt.Println("Press Enter to exit...")
fmt.Scanln()
}
os.Exit(0)
case <-time.After(30 * time.Second):
if language == "en" {
fmt.Println("Upload timeout, program exit")
} else {
fmt.Println("上传超时,程序退出")
}
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
fmt.Println("Press Enter to exit...")
fmt.Scanln()
}
os.Exit(1)
}
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
if cpuTestStatus {
utils.PrintCenteredTitle(fmt.Sprintf("CPU测试-通过%s测试", cpuTestMethod), width)
cputest.CpuTest(language, cpuTestMethod, cpuTestThreadMode)
os.Exit(0)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
if memoryTestStatus {
utils.PrintCenteredTitle(fmt.Sprintf("内存测试-通过%s测试", memoryTestMethod), width)
memorytest.MemoryTest(language, memoryTestMethod)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
if diskTestStatus && autoChangeDiskTestMethod {
utils.PrintCenteredTitle(fmt.Sprintf("硬盘测试-通过%s测试", diskTestMethod), width)
disktest.DiskTest(language, diskTestMethod, diskTestPath, diskMultiCheck, autoChangeDiskTestMethod)
} else if diskTestStatus && !autoChangeDiskTestMethod {
utils.PrintCenteredTitle(fmt.Sprintf("硬盘测试-通过%s测试", "dd"), width)
disktest.DiskTest(language, "dd", diskTestPath, diskMultiCheck, autoChangeDiskTestMethod)
utils.PrintCenteredTitle(fmt.Sprintf("硬盘测试-通过%s测试", "fio"), width)
disktest.DiskTest(language, "fio", diskTestPath, diskMultiCheck, autoChangeDiskTestMethod)
}
}, tempOutput, output)
if onlyChinaTest || pingTestStatus {
func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo *string, output, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) string {
output = runBasicTests(preCheck, basicInfo, securityInfo, output, tempOutput, outputMutex)
output = runCPUTest(output, tempOutput, outputMutex)
output = runMemoryTest(output, tempOutput, outputMutex)
output = runDiskTest(output, tempOutput, outputMutex)
if (onlyChinaTest || pingTestStatus) && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
wg3.Add(1)
go func() {
defer wg3.Done()
ptInfo = pt.PingTest()
*ptInfo = pt.PingTest()
}()
}
if emailTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
wg2.Add(1)
go func() {
defer wg2.Done()
*emailInfo = email.EmailCheck()
}()
}
if utTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" && !onlyChinaTest {
wg1.Add(1)
go func() {
defer wg1.Done()
*mediaInfo = unlocktest.MediaTest(language)
}()
}
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
output = runStreamingTests(wg1, mediaInfo, output, tempOutput, outputMutex)
output = runSecurityTests(*securityInfo, output, tempOutput, outputMutex)
output = runEmailTests(wg2, emailInfo, output, tempOutput, outputMutex)
}
if runtime.GOOS != "windows" && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
output = runNetworkTests(wg3, ptInfo, output, tempOutput, outputMutex)
}
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
output = runSpeedTests(output, tempOutput, outputMutex)
}
return appendTimeInfo(output, tempOutput, startTime, outputMutex)
}
func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo *string, output, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) string {
output = runBasicTests(preCheck, basicInfo, securityInfo, output, tempOutput, outputMutex)
output = runCPUTest(output, tempOutput, outputMutex)
output = runMemoryTest(output, tempOutput, outputMutex)
output = runDiskTest(output, tempOutput, outputMutex)
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
if utTestStatus {
wg1.Add(1)
go func() {
defer wg1.Done()
*mediaInfo = unlocktest.MediaTest(language)
}()
}
if emailTestStatus {
wg2.Add(1)
go func() {
defer wg2.Done()
emailInfo = email.EmailCheck()
*emailInfo = email.EmailCheck()
}()
}
if utTestStatus && !onlyChinaTest {
wg1.Add(1)
go func() {
defer wg1.Done()
mediaInfo = unlocktest.MediaTest(language)
}()
output = runStreamingTests(wg1, mediaInfo, output, tempOutput, outputMutex) // 传递指针
output = runSecurityTests(*securityInfo, output, tempOutput, outputMutex)
output = runEmailTests(wg2, emailInfo, output, tempOutput, outputMutex)
output = runEnglishSpeedTests(output, tempOutput, outputMutex)
}
output = utils.PrintAndCapture(func() {
if commTestStatus && !onlyChinaTest {
utils.PrintCenteredTitle("御三家流媒体解锁", width)
commediatest.ComMediaTest(language)
return appendTimeInfo(output, tempOutput, startTime, outputMutex)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
if utTestStatus && !onlyChinaTest {
utils.PrintCenteredTitle("跨国流媒体解锁", width)
wg1.Wait()
fmt.Printf(mediaInfo)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
if securityTestStatus {
utils.PrintCenteredTitle("IP质量检测", width)
fmt.Printf(securityInfo)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
if emailTestStatus {
utils.PrintCenteredTitle("邮件端口检测", width)
wg2.Wait()
fmt.Println(emailInfo)
}
}, tempOutput, output)
if runtime.GOOS != "windows" {
output = utils.PrintAndCapture(func() {
if backtraceStatus && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程线路检测", width)
backtrace.BackTrace()
}
}, tempOutput, output)
// nexttrace 在win上不支持检测报错 bind: An invalid argument was supplied.
output = utils.PrintAndCapture(func() {
if nt3Status && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程路由检测", width)
ntrace.TraceRoute3(language, nt3Location, nt3CheckType)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
if onlyChinaTest || pingTestStatus {
utils.PrintCenteredTitle("三网ICMP的PING值检测", width)
wg3.Wait()
fmt.Println(ptInfo)
}
}, tempOutput, output)
}
output = utils.PrintAndCapture(func() {
if speedTestStatus {
utils.PrintCenteredTitle("就近节点测速", width)
speedtest.ShowHead(language)
if (menuMode && 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" {
speedtest.CustomSP("net", "global", 4, language)
}
}
}, tempOutput, output)
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("花费 : %d 分 %d 秒\n", minutes, seconds)
fmt.Printf("时间 : %s\n", currentTime)
utils.PrintCenteredTitle("", width)
}, tempOutput, output)
case "en":
output = utils.PrintAndCapture(func() {
func runBasicTests(preCheck utils.NetCheckResult, basicInfo, securityInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
return utils.PrintAndCapture(func() {
utils.PrintHead(language, width, ecsVersion)
if basicStatus || securityTestStatus {
if basicStatus {
if language == "zh" {
utils.PrintCenteredTitle("系统基础信息", width)
} else {
utils.PrintCenteredTitle("System-Basic-Information", width)
}
basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus)
}
if preCheck.Connected && preCheck.StackType == "DualStack" {
*basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus)
} else if preCheck.Connected && preCheck.StackType == "IPv4" {
*basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, "ipv4", securityTestStatus)
} else if preCheck.Connected && preCheck.StackType == "IPv6" {
*basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, "ipv6", securityTestStatus)
} else {
*basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, "", false)
securityTestStatus = false
}
if basicStatus {
fmt.Printf(basicInfo)
fmt.Printf("%s", *basicInfo)
} else if (input == "6" || input == "9") && securityTestStatus {
scanner := bufio.NewScanner(strings.NewReader(basicInfo))
scanner := bufio.NewScanner(strings.NewReader(*basicInfo))
for scanner.Scan() {
line := scanner.Text()
if strings.Contains(line, "IPV") {
@@ -443,64 +553,154 @@ func main() {
}
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
}
func runCPUTest(output, tempOutput string, outputMutex *sync.Mutex) string {
return utils.PrintAndCapture(func() {
if cpuTestStatus {
if language == "zh" {
utils.PrintCenteredTitle(fmt.Sprintf("CPU测试-通过%s测试", cpuTestMethod), width)
} else {
utils.PrintCenteredTitle(fmt.Sprintf("CPU-Test--%s-Method", cpuTestMethod), width)
}
cputest.CpuTest(language, cpuTestMethod, cpuTestThreadMode)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
}
func runMemoryTest(output, tempOutput string, outputMutex *sync.Mutex) string {
return utils.PrintAndCapture(func() {
if memoryTestStatus {
if language == "zh" {
utils.PrintCenteredTitle(fmt.Sprintf("内存测试-通过%s测试", memoryTestMethod), width)
} else {
utils.PrintCenteredTitle(fmt.Sprintf("Memory-Test--%s-Method", memoryTestMethod), width)
}
memorytest.MemoryTest(language, memoryTestMethod)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
}
func runDiskTest(output, tempOutput string, outputMutex *sync.Mutex) string {
return utils.PrintAndCapture(func() {
if diskTestStatus && autoChangeDiskTestMethod {
if language == "zh" {
utils.PrintCenteredTitle(fmt.Sprintf("硬盘测试-通过%s测试", diskTestMethod), width)
} else {
utils.PrintCenteredTitle(fmt.Sprintf("Disk-Test--%s-Method", diskTestMethod), width)
}
disktest.DiskTest(language, diskTestMethod, diskTestPath, diskMultiCheck, autoChangeDiskTestMethod)
} else if diskTestStatus && !autoChangeDiskTestMethod {
if language == "zh" {
utils.PrintCenteredTitle(fmt.Sprintf("硬盘测试-通过%s测试", "dd"), width)
disktest.DiskTest(language, "dd", diskTestPath, diskMultiCheck, autoChangeDiskTestMethod)
utils.PrintCenteredTitle(fmt.Sprintf("硬盘测试-通过%s测试", "fio"), width)
disktest.DiskTest(language, "fio", diskTestPath, diskMultiCheck, autoChangeDiskTestMethod)
} else {
utils.PrintCenteredTitle(fmt.Sprintf("Disk-Test--%s-Method", "dd"), width)
disktest.DiskTest(language, "dd", diskTestPath, diskMultiCheck, autoChangeDiskTestMethod)
utils.PrintCenteredTitle(fmt.Sprintf("Disk-Test--%s-Method", "fio"), width)
disktest.DiskTest(language, "fio", diskTestPath, diskMultiCheck, autoChangeDiskTestMethod)
}
}
}, tempOutput, output)
if utTestStatus {
wg1.Add(1)
go func() {
defer wg1.Done()
mediaInfo = unlocktest.MediaTest(language)
}()
}
if emailTestStatus {
wg2.Add(1)
go func() {
defer wg2.Done()
emailInfo = email.EmailCheck()
}()
func runStreamingTests(wg1 *sync.WaitGroup, mediaInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
return utils.PrintAndCapture(func() {
if language == "zh" {
if commTestStatus && !onlyChinaTest {
utils.PrintCenteredTitle("御三家流媒体解锁", width)
fmt.Printf("%s", commediatests.MediaTests(language))
}
output = utils.PrintAndCapture(func() {
if utTestStatus {
utils.PrintCenteredTitle("Cross-Border-Streaming-Media-Unlock", width)
}
if utTestStatus && (language == "zh" && !onlyChinaTest || language == "en") {
wg1.Wait()
fmt.Printf(mediaInfo)
if language == "zh" {
utils.PrintCenteredTitle("跨国流媒体解锁", width)
} else {
utils.PrintCenteredTitle("Cross-Border-Streaming-Media-Unlock", width)
}
fmt.Printf("%s", *mediaInfo)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
}
func runSecurityTests(securityInfo, output, tempOutput string, outputMutex *sync.Mutex) string {
return utils.PrintAndCapture(func() {
if securityTestStatus {
if language == "zh" {
utils.PrintCenteredTitle("IP质量检测", width)
} else {
utils.PrintCenteredTitle("IP-Quality-Check", width)
fmt.Printf(securityInfo)
}
fmt.Printf("%s", securityInfo)
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
}
func runEmailTests(wg2 *sync.WaitGroup, emailInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
return utils.PrintAndCapture(func() {
if emailTestStatus {
utils.PrintCenteredTitle("Email-Port-Check", width)
wg2.Wait()
fmt.Println(emailInfo)
if language == "zh" {
utils.PrintCenteredTitle("邮件端口检测", width)
} else {
utils.PrintCenteredTitle("Email-Port-Check", width)
}
fmt.Println(*emailInfo)
}
}, tempOutput, output)
}
func runNetworkTests(wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
output = utils.PrintAndCapture(func() {
if backtraceStatus && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程线路检测", width)
if strings.Contains(output, "IPV6") {
backtrace.BackTrace(true)
} else {
backtrace.BackTrace(false)
}
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
if nt3Status && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程路由检测", width)
nt.TraceRoute(language, nt3Location, nt3CheckType)
}
}, tempOutput, output)
return utils.PrintAndCapture(func() {
if onlyChinaTest || pingTestStatus {
wg3.Wait()
utils.PrintCenteredTitle("三网ICMP的PING值检测", width)
fmt.Println(*ptInfo)
}
}, tempOutput, output)
}
func runSpeedTests(output, tempOutput string, outputMutex *sync.Mutex) string {
return utils.PrintAndCapture(func() {
if speedTestStatus {
utils.PrintCenteredTitle("就近节点测速", width)
speedtest.ShowHead(language)
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 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)
}
func runEnglishSpeedTests(output, tempOutput string, outputMutex *sync.Mutex) string {
return utils.PrintAndCapture(func() {
if speedTestStatus {
utils.PrintCenteredTitle("Speed-Test", width)
speedtest.ShowHead(language)
@@ -508,21 +708,73 @@ func main() {
speedtest.CustomSP("net", "global", -1, language)
}
}, tempOutput, output)
}
func appendTimeInfo(output, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) string {
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() {
return utils.PrintAndCapture(func() {
utils.PrintCenteredTitle("", width)
if language == "zh" {
fmt.Printf("花费 : %d 分 %d 秒\n", minutes, seconds)
fmt.Printf("时间 : %s\n", currentTime)
} else {
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
fmt.Printf("Current Time : %s\n", currentTime)
}
utils.PrintCenteredTitle("", width)
}, tempOutput, output)
}
func handleUploadResults(output string) {
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)
}
}
}
func main() {
parseFlags()
if handleHelpAndVersion() {
return
}
initLogger()
go func() {
http.Get("https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false")
}()
preCheck := utils.CheckPublicAccess(3 * time.Second)
if menuMode {
handleMenuMode(preCheck)
}
handleLanguageSpecificSettings()
var (
wg1, wg2, wg3 sync.WaitGroup
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
output, tempOutput string
outputMutex sync.Mutex
)
startTime := time.Now()
uploadDone := make(chan bool, 1)
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
go handleSignalInterrupt(sig, &startTime, &output, tempOutput, uploadDone, &outputMutex)
switch language {
case "zh":
output = runChineseTests(preCheck, &wg1, &wg2, &wg3, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, output, tempOutput, startTime, &outputMutex)
case "en":
output = runEnglishTests(preCheck, &wg1, &wg2, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, output, tempOutput, startTime, &outputMutex)
default:
fmt.Println("Unsupported language")
}
utils.ProcessAndUpload(output, filePath, enabelUpload)
handleUploadResults(output)
finish = true
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
fmt.Println("Press Enter to exit...")
fmt.Scanln()

596
goecs.sh
View File

@@ -1,21 +1,21 @@
#!/bin/bash
# From https://github.com/oneclickvirt/ecs
#2024.07.21
# 2025.06.29
# 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
GG GG OO OO EE CC SS
GG OO OO EE CC SS
GG OO OO EE CC SS
GG OO OO EEEEEEEE CC SSSSSSSSSS
GG GGGGGG OO OO EE CC SS
GG GG OO OO EE CC SS
GG GG OO OO EE CC SS
GGGGGGGG OOOOOOO EEEEEEEE CCCCCCCCC SSSSSSSSSS
,ad8888ba, ,ad8888ba, 88888888888 ,ad8888ba, ad88888ba
d8"' `"8b d8"' `"8b 88 d8"' `"8b d8" "8b
d8' d8' `8b 88 d8' Y8a
88 88 88 88aaaaa 88 `"Y8aaaaa,
88 88888 88 88 88""""" 88 `"""""8b,
Y8, 88 Y8, ,8P 88 Y8, `8b
Y8a. .a88 Y8a. .a8P 88 Y8a. .a8P Y8a a8P
`"Y88888P" `"Y8888Y"' 88888888888 `"Y8888Y"' "Y88888P"
EOF
cd /root >/dev/null 2>&1
if [ ! -d "/usr/bin/" ]; then
mkdir -p "/usr/bin/"
@@ -24,6 +24,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 +60,225 @@ download_file() {
return 0
}
check_china() {
_yellow "正在检测IP所在区域......"
if [[ -z "${CN}" ]]; then
# 首先尝试通过 ipapi.co 检测
if curl -m 6 -s https://ipapi.co/json | grep -q 'China'; then
_yellow "根据ipapi.co提供的信息当前IP可能在中国"
if [ "$noninteractive" != "true" ]; then
reading "是否使用中国镜像完成安装? ([y]/n) " input
case $input in
[yY][eE][sS] | [yY] | "")
_green "已选择使用中国镜像"
CN=true
;;
[nN][oO] | [nN])
_yellow "已选择不使用中国镜像"
CN=false
;;
*)
_green "已选择使用中国镜像"
CN=true
;;
esac
else
# 在非交互模式下默认不使用中国镜像
CN=false
fi
else
CN=false
fi
fi
}
get_memory_size() {
if [ -f /proc/meminfo ]; then
local mem_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
echo $((mem_kb / 1024)) # Convert to MB
return
fi
if command -v free >/dev/null 2>&1; then
local mem_kb=$(free -m | awk '/^Mem:/ {print $2}')
echo "$mem_kb" # Already in MB
return
fi
if command -v sysctl >/dev/null 2>&1; then
local mem_bytes=$(sysctl -n hw.memsize 2>/dev/null || sysctl -n hw.physmem 2>/dev/null)
if [ -n "$mem_bytes" ]; then
echo $((mem_bytes / 1024 / 1024)) # Convert to MB
return
fi
fi
}
cleanup_epel() {
_yellow "Cleaning up EPEL repositories..."
rm -f /etc/yum.repos.d/*epel*
yum clean all
}
goecs_check() {
os=$(uname -s)
arch=$(uname -m)
ECS_VERSION=$(curl -m 6 -sSL "https://api.github.com/repos/oneclickvirt/ecs/releases/latest" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}')
# 如果 https://api.github.com/ 请求失败,则使用 https://githubapi.spiritlhl.workers.dev/ 此时可能宿主机无IPV4网络
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}')
if command -v apt-get >/dev/null 2>&1; then
INSTALL_CMD="apt-get -y install"
elif command -v yum >/dev/null 2>&1; then
INSTALL_CMD="yum -y install"
elif command -v dnf >/dev/null 2>&1; then
INSTALL_CMD="dnf -y install"
elif command -v pacman >/dev/null 2>&1; then
INSTALL_CMD="pacman -S --noconfirm"
elif command -v apk >/dev/null 2>&1; then
INSTALL_CMD="apk add"
elif command -v zypper >/dev/null 2>&1; then
INSTALL_CMD="zypper install -y"
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}')
if ! command -v unzip >/dev/null 2>&1; then
_green "Installing unzip"
${INSTALL_CMD} unzip
fi
# 检测原始goecs命令是否存在若存在则升级不存在则安装
version_output=$(goecs -v command 2>/dev/null || ./goecs -v command 2>/dev/null)
if [ $? -eq 0 ]; then
if ! command -v curl >/dev/null 2>&1; then
_green "Installing curl"
${INSTALL_CMD} curl
fi
os=$(uname -s 2>/dev/null || echo "Unknown")
arch=$(uname -m 2>/dev/null || echo "Unknown")
check_china
ECS_VERSION="0.1.46"
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
_yellow "Unable to get version info, using default version 0.1.46"
ECS_VERSION="0.1.46"
fi
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
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
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
download_url="${base_url}/${zip_file}"
_green "Downloading $download_url"
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
_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
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
chmod 777 goecs
rm -rf /usr/bin/goecs
sleep 1
cp goecs /usr/bin/goecs
rm -rf README_EN.md
rm -rf README.md
for install_path in "/usr/bin" "/usr/local/bin"; do
if [ -d "$install_path" ]; then
cp -f goecs "$install_path/"
break
fi
done
if [ "$os" != "Darwin" ]; then
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 [ -f /etc/sysctl.conf ]; then
if grep -q "^$PARAM" /etc/sysctl.conf; then
sudo sed -i "s/^$PARAM.*/$PARAM = $NEW_VALUE/" /etc/sysctl.conf
sed -i "s/^$PARAM.*/$PARAM = $NEW_VALUE/" /etc/sysctl.conf
else
echo "$PARAM = $NEW_VALUE" | sudo tee -a /etc/sysctl.conf
echo "$PARAM = $NEW_VALUE" >> /etc/sysctl.conf
fi
sudo sysctl -p
sysctl -p >/dev/null 2>&1
fi
setcap cap_net_raw=+ep goecs
setcap cap_net_raw=+ep /usr/bin/goecs
echo "goecs version:"
fi
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 +294,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 +301,70 @@ InstallSysbench() {
else
Var_OSRelease="unknown" # 未知系统分支
fi
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) (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" ;;
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 +393,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 +430,14 @@ 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")
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,73 +453,95 @@ env_check() {
else
SYS="$(uname -s)"
fi
[[ -n $SYS ]] || exit 1
# 匹配操作系统
SYSTEM=""
for ((int = 0; int < ${#REGEX[@]}; int++)); do
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
SYSTEM="${RELEASE[int]}"
[[ -n $SYSTEM ]] && 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"
break
fi
done
if [ -z "$SYSTEM" ]; then
_yellow "Unable to recognize system, trying common package managers..."
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"
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"
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"
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"
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]} dd
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
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
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
@@ -385,42 +554,31 @@ env_check() {
_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
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..."
brew install --force sysbench iproute2mac
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() {
@@ -433,18 +591,26 @@ 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 命令
@@ -452,18 +618,26 @@ show_help() {
Available commands:
./goecs.sh env Check and Install package:
sudo (Almost all unix-like systems have it.)
tar (Almost all unix-like systems have it.)
unzip (Almost all unix-like systems have it.)
dd (Almost all unix-like systems have it.)
fio (Almost all unix-like systems can be installed through the system's package manager.)
sysbench (Almost all unix-like systems can be installed through the system's package manager.)
geekbench (geekbench5)(Only support IPV4 environment, and memory greater than 1GB network detection, only support amd64 and arm64 architecture.)
speedtest (Use the officially provided binaries for more accurate test results.)
ping (Use the officially provided binaries for more accurate test results.)
systemd-detect-virt OR dmidecode (Almost all unix-like systems have it, for more accurate test results.)
In fact, sysbench/geekbench is the only one of the above dependencies that must be installed, without which the CPU score cannot be tested.
./goecs.sh env Check and Install dependencies
Warning: This command performs system update(optional), which may:
1. Take considerable time
2. Cause temporary network interruptions
3. Impact system stability
4. Affect subsequent system startups
For systems with less than 1GB RAM, additional risks:
1. System freeze
2. SSH connection loss
3. Critical service failures
Recommended:
Hanging execution during environment dependency installation
Optional components:
sysbench/geekbench (CPU testing)
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

View File

@@ -31,5 +31,5 @@ func MemoryTest(language, testMethod string) {
if !strings.Contains(res, "\n") && res != "" {
res += "\n"
}
fmt.Printf(res)
fmt.Printf("%s", res)
}

View File

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

View File

@@ -1,14 +1,13 @@
package utils
import (
"bufio"
"bytes"
"context"
"fmt"
"github.com/imroc/req/v3"
"github.com/oneclickvirt/UnlockTests/uts"
"github.com/oneclickvirt/basics/system"
. "github.com/oneclickvirt/defaultset"
"github.com/oneclickvirt/security/network"
"io"
"net"
"net/http"
"os"
"path/filepath"
"regexp"
@@ -16,6 +15,12 @@ import (
"sync"
"time"
"unicode/utf8"
"github.com/imroc/req/v3"
"github.com/oneclickvirt/UnlockTests/uts"
"github.com/oneclickvirt/basics/system"
. "github.com/oneclickvirt/defaultset"
"github.com/oneclickvirt/security/network"
)
// PrintCenteredTitle 根据指定的宽度打印居中标题
@@ -58,21 +63,21 @@ func CheckChina(enableLogger bool) bool {
SetRetryBackoffInterval(1*time.Second, 3*time.Second).
SetRetryFixedInterval(2 * time.Second)
ipapiURL := "https://ipapi.co/json"
cipccURL := "http://cip.cc"
ipapiResp, err := client.R().Get(ipapiURL)
if err != nil {
if enableLogger {
Logger.Info("无法获取IP信息:" + err.Error())
}
} else {
return false
}
defer ipapiResp.Body.Close()
var ipapiBody string
ipapiBody, err = ipapiResp.ToString()
ipapiBody, err := ipapiResp.ToString()
if err != nil {
if enableLogger {
Logger.Info("无法读取IP信息响应:" + err.Error())
}
} else {
return false
}
isInChina := strings.Contains(ipapiBody, "China")
if isInChina {
fmt.Println("根据 ipapi.co 提供的信息当前IP可能在中国")
@@ -89,58 +94,24 @@ func CheckChina(enableLogger bool) bool {
fmt.Println("使用中国专项测试")
selectChina = true
}
return selectChina
}
}
}
cipccResp, err := client.R().Get(cipccURL)
if err != nil {
if enableLogger {
Logger.Info("无法获取IP信息:" + err.Error())
}
return false
}
defer cipccResp.Body.Close()
cipccBody, err := cipccResp.ToString()
if err != nil {
if enableLogger {
Logger.Info("无法读取IP信息响应:" + err.Error())
}
return false
}
isInChina := strings.Contains(cipccBody, "中国")
if isInChina {
fmt.Println("根据cip.cc提供的信息当前IP可能在中国")
var input string
fmt.Print("是否选用中国专项测试(无流媒体测试有三网Ping值测试)? ([y]/n) ")
fmt.Scanln(&input)
switch strings.ToLower(input) {
case "yes", "y":
fmt.Println("使用中国专项测试")
selectChina = true
case "no", "n":
fmt.Println("不使用中国专项测试")
default:
fmt.Println("不使用中国专项测试")
selectChina = true
}
}
return selectChina
}
// SecurityCheck 执行安全检查
func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) {
// BasicsAndSecurityCheck 执行安全检查
func BasicsAndSecurityCheck(language, nt3CheckType string, securityCheckStatus 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)
ipInfo, securityInfo, err = network.NetworkCheck("both", securityCheckStatus, language)
if err != nil {
fmt.Println(err.Error())
}
}()
wgt.Add(1)
go func() {
defer wgt.Done()
systemInfo = system.CheckSystemInfo(language)
@@ -238,95 +209,284 @@ func PrintAndCapture(f func(), tempOutput, output string) string {
}
// UploadText 上传文本内容到指定URL
func UploadText(absPath string) (string, error) {
primaryURL := "http://hpaste.spiritlhl.net/api/upload"
backupURL := "https://paste.spiritlhl.net/api/upload"
func UploadText(absPath string) (string, string, error) {
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()
upload := func(url string) (string, error) {
// 获取文件信息并检查大小
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/"), 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
}
result, err := upload(primaryURL)
return "", "", fmt.Errorf("upload failed for %s with status code: %d", url, resp.StatusCode)
}
// 尝试上传到主URL
httpURL, httpsURL, err := upload(primaryURL)
if err == nil {
return result, nil
return httpURL, httpsURL, nil
}
result, 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 result, 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 "", ""
}
// 上传文件并生成短链接
shorturl, err3 := UploadText(absPath)
if err3 != nil {
fmt.Println("Upload failed, cannot generate short URL.")
fmt.Println(err3.Error())
http_url, https_url, err := UploadText(absPath)
if err != nil {
fmt.Println("上传失败,无法生成链接")
fmt.Println(err.Error())
return "", ""
}
return http_url, https_url
}
return "", ""
}
// ============================= 前置联网能力检测 =============================
var StackType string
type NetCheckResult struct {
HasIPv4 bool
HasIPv6 bool
Connected bool
StackType string // "IPv4", "IPv6", "DualStack", "None"
}
func makeResolver(proto, dnsAddr string) *net.Resolver {
return &net.Resolver{
PreferGo: true,
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
d := net.Dialer{
Timeout: 5 * time.Second,
}
return d.DialContext(ctx, proto, dnsAddr)
},
}
}
func CheckPublicAccess(timeout time.Duration) NetCheckResult {
if timeout < 2*time.Second {
timeout = 2 * time.Second
}
var wg sync.WaitGroup
resultChan := make(chan string, 8)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
checks := []struct {
Tag string
Addr string
Kind string // udp4, udp6, http4, http6
}{
// UDP DNS
{"IPv4", "223.5.5.5:53", "udp4"}, // 阿里 DNS
{"IPv4", "8.8.8.8:53", "udp4"}, // Google DNS
{"IPv6", "[2400:3200::1]:53", "udp6"}, // 阿里 IPv6 DNS
{"IPv6", "[2001:4860:4860::8888]:53", "udp6"}, // Google IPv6 DNS
// HTTP HEAD
{"IPv4", "https://www.baidu.com", "http4"}, // 百度
{"IPv4", "https://1.1.1.1", "http4"}, // Cloudflare
{"IPv6", "https://[2400:3200::1]", "http6"}, // 阿里 IPv6
{"IPv6", "https://[2606:4700::1111]", "http6"}, // Cloudflare IPv6
}
for _, check := range checks {
wg.Add(1)
go func(tag, addr, kind string) {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
}
}()
switch kind {
case "udp4", "udp6":
dialer := &net.Dialer{
Timeout: timeout / 4,
}
conn, err := dialer.DialContext(ctx, kind, addr)
if err == nil && conn != nil {
conn.Close()
select {
case resultChan <- tag:
case <-ctx.Done():
return
}
fmt.Println("Upload successful, short URL:", shorturl)
}
case "http4", "http6":
var resolver *net.Resolver
if kind == "http4" {
resolver = makeResolver("udp4", "223.5.5.5:53")
} else {
resolver = makeResolver("udp6", "[2400:3200::1]:53")
}
dialer := &net.Dialer{
Timeout: timeout / 4,
Resolver: resolver,
}
transport := &http.Transport{
DialContext: dialer.DialContext,
MaxIdleConns: 1,
MaxIdleConnsPerHost: 1,
IdleConnTimeout: time.Second,
TLSHandshakeTimeout: timeout / 4,
ResponseHeaderTimeout: timeout / 4,
DisableKeepAlives: true,
}
client := &http.Client{
Timeout: timeout / 4,
Transport: transport,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
req, err := http.NewRequestWithContext(ctx, "HEAD", addr, nil)
if err != nil {
return
}
resp, err := client.Do(req)
if err == nil && resp != nil {
if resp.Body != nil {
resp.Body.Close()
}
if resp.StatusCode < 500 {
select {
case resultChan <- tag:
case <-ctx.Done():
return
}
}
}
}
}(check.Tag, check.Addr, check.Kind)
}
go func() {
wg.Wait()
close(resultChan)
}()
hasV4 := false
hasV6 := false
for {
select {
case res, ok := <-resultChan:
if !ok {
goto result
}
if res == "IPv4" {
hasV4 = true
}
if res == "IPv6" {
hasV6 = true
}
case <-ctx.Done():
goto result
}
}
result:
stack := "None"
if hasV4 && hasV6 {
stack = "DualStack"
} else if hasV4 {
stack = "IPv4"
} else if hasV6 {
stack = "IPv6"
}
StackType = stack
return NetCheckResult{
HasIPv4: hasV4,
HasIPv6: hasV6,
Connected: hasV4 || hasV6,
StackType: stack,
}
}

17
utils/utils_test.go Normal file
View File

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