Compare commits

...

66 Commits

Author SHA1 Message Date
github-actions[bot]
56b71ac53f chore: update ECS_VERSION to 0.1.88 in goecs.sh 2025-09-24 03:32:26 +00:00
spiritlhl
1045d3fab8 fix: 修复disk测试自动启用多盘的规则缺少同挂载点检测导致重复检测的问题 2025-09-24 03:18:06 +00:00
github-actions[bot]
7bd2b59d58 chore: update ECS_VERSION to 0.1.87 in goecs.sh 2025-09-15 14:23:34 +00:00
spiritlhl
cc1da7ea7c fix:修复失效链接 2025-09-15 14:09:17 +00:00
github-actions[bot]
1a002a1681 chore: update ECS_VERSION to 0.1.86 in goecs.sh 2025-08-31 14:30:11 +00:00
spiritlhl
ee2b55e7eb fix: 添加每个测试项目的说明输出短链 2025-08-31 14:14:52 +00:00
spiritlhl
a55cebf94b fix: 修复cdn测试时未强制IPV4链接的问题 2025-08-26 19:03:36 +08:00
spiritlhl
0571a8df13 fix: 回退public更新 2025-08-26 11:25:32 +08:00
spiritlhl
f29a2829f3 fix: 修复笔误 2025-08-26 11:21:34 +08:00
GitHub Actions
33b8e0396f Auto update README files for public version 2025-08-26 03:19:50 +00:00
spiritlhl
c259073d1b fix: 修复为同时修改两个分支 2025-08-26 11:19:09 +08:00
spiritlhl
07ebc8cab5 fix: 修复截断 2025-08-26 11:14:11 +08:00
spiritlhl
1824051e53 fix: 同步修复说明兼容bash和sh,同时自动更新版本说明 2025-08-26 03:06:48 +00:00
spiritlhl
9f93a2e59d fix: 同时兼容 bash 和 sh 环境 2025-08-26 10:55:55 +08:00
spiritlhl
8cd09182da fix 2025-08-25 10:20:54 +08:00
spiritlhl
9bb776d411 fix: LOGO回退老版本,新版本异常难看 2025-08-24 20:49:11 +08:00
spiritlhl
12f2da9da2 fix: 优化部分项目说明,添加更详细的说明,添加英文日文关于测速的说明 2025-08-24 09:36:07 +00:00
github-actions[bot]
7aa70ac1fd chore: update ECS_VERSION to 0.1.85 in goecs.sh 2025-08-23 03:48:51 +00:00
spiritlhl
04ce926582 fix: 更新主版本 2025-08-23 03:35:33 +00:00
spiritlhl
73eb38eed1 fix: 删除无效包导入 2025-08-23 03:34:51 +00:00
spiritlhl
9bc8a934b1 fix: 修复标识输出 2025-08-23 03:19:32 +00:00
spiritlhl
7b729e073b fix: 移动弃用的文件 2025-08-23 03:17:05 +00:00
spiritlhl
111126ae90 fix: 添加内存测试项基准说明,修复部分比较含糊的说明。 2025-08-23 03:15:54 +00:00
spiritlhl
9397f789be fix: 同步securitycheck上游更新,更新主程序版本号,去除默认的清屏操作 2025-08-23 03:02:13 +00:00
spiritlhl
5a1dda6483 fix: 添加额外的ASN获取方式,当查询失败时回落尝试修复查询(虽然出现问题的概率极小) 2025-08-23 02:56:02 +00:00
spiritlhl
e322c717c0 fix: 安装依赖去除sysbench编译尝试,主程序已自带sysbench回落机制,没必要强求依赖安装 2025-08-23 02:52:55 +00:00
spiritlhl
778b33142b fix: 自行编译的分支添加标识为非官方编译 2025-08-23 02:51:32 +00:00
spiritlhl
aa9f361380 feat: 添加Release的下载量统计 2025-08-19 13:00:05 +00:00
github-actions[bot]
3236c60359 chore: update ECS_VERSION to 0.1.83 in goecs.sh 2025-08-11 13:45:39 +00:00
spiritlhl
73b0f30ddc fix: 删除无效文件,去除无效重定向 2025-08-11 13:31:18 +00:00
spiritlhl
825da78bd5 fix: 外部重定向已捕捉无需重复捕捉 2025-08-11 13:16:46 +00:00
spiritlhl
5d2f3c7f96 fix: 更新版本 2025-08-11 13:14:33 +00:00
spiritlhl
61247a206e fix: 删除无效的并发 2025-08-11 13:08:20 +00:00
spiritlhl
f0daad1360 fix: 修复重定向冲突问题,由于nexttrace上层捕获了输出,无法再在融合怪中再次捕获进行重定向 2025-08-11 13:04:25 +00:00
github-actions[bot]
2d23fb55a0 chore: update ECS_VERSION to 0.1.79 in goecs.sh 2025-08-11 12:13:04 +00:00
spiritlhl
a73dbf2d0b fix: 修复部分单项测试说明错位 2025-08-11 12:08:51 +00:00
spiritlhl
b38dd713d9 fix: 修复退出选项被筛选逻辑拦截的问题 2025-08-11 20:02:20 +08:00
github-actions[bot]
e66ef1f106 chore: update ECS_VERSION to 0.1.77 in goecs.sh 2025-08-11 11:52:15 +00:00
spiritlhl
f6ee1e40ec fix: 添加退出程序的选项,添加开始执行前的清屏逻辑 2025-08-11 11:37:43 +00:00
spiritlhl
cb2bf0a7e5 fix: 主体逻辑将backtrace和三网路由详情检测加入整体的并发检测 2025-08-11 11:25:32 +00:00
spiritlhl
ad017db5a6 fix: 更新版本 2025-08-11 11:15:13 +00:00
spiritlhl
a99f58518a fix: 升级backtrace依赖,支持多重路由测试取平均结果,避免单次路由波动分析失败 2025-08-11 11:13:07 +00:00
spiritlhl
2e59bac322 fix: 提取三网详细路由的测试逻辑至于单独的包,添加单项测试 2025-08-11 10:59:17 +00:00
spiritlhl
4132b1daff feat: 详细三网路由测试支持并发测试,大幅缩短测试所需时间 2025-08-11 10:53:48 +00:00
github-actions[bot]
53296b745a chore: update ECS_VERSION to 0.1.76 in goecs.sh 2025-08-08 14:53:41 +00:00
spiritlhl
74630e9615 fix: 更新说明 2025-08-08 14:31:09 +00:00
spiritlhl
5ec7924214 fix: 更新版本(mbw已回落可用但未能测出真实性能) 2025-08-08 14:26:31 +00:00
spiritlhl
7a7fdc26a0 fix: memorytest更新依赖 2025-08-08 14:23:16 +00:00
spiritlhl
d4c855de92 fix: disktest去除无效的条件筛选 2025-08-08 14:16:50 +00:00
spiritlhl
7c22dee443 fix: 修复windows系统非Admin权限下的硬盘测试(FIO测试无误,DD测试缺少C依赖) 2025-08-08 14:15:59 +00:00
github-actions[bot]
797496b640 chore: update ECS_VERSION to 0.1.75 in goecs.sh 2025-08-06 09:12:25 +00:00
spiritlhl
5b686abdc8 fix: 规范输出 2025-08-06 09:06:48 +00:00
spiritlhl
f99a37edbe fix: 更新版本 2025-08-06 09:04:38 +00:00
spiritlhl
4ff49c8b90 fix: 离线模式下不检测程序版本,不统计使用次数 2025-08-06 09:02:57 +00:00
spiritlhl
1d9257beb3 fix: 合并缓存IP的存储位置 2025-08-06 08:51:50 +00:00
spiritlhl
fc6ccb9f92 fix: 修复无系统信息检测时无对应IP信息检测导致后续依赖IP信息查询的函数异常输出的问题 2025-08-06 08:45:00 +00:00
github-actions[bot]
88a2a7fdc9 chore: update ECS_VERSION to 0.1.74 in goecs.sh 2025-08-05 14:28:15 +00:00
spiritlhl
5ff18ed7c7 feat: 更新版本 2025-08-05 14:13:46 +00:00
spiritlhl
df897db244 feat: 添加支持如非最新版本使用时提示版本更新,添加使用统计 2025-08-05 14:13:20 +00:00
spiritlhl
9a8680491c fix: 支持三网回程详细路可指定ALL对四个主要城市全测 2025-08-05 13:37:43 +00:00
spiritlhl
33f81fd6aa fix: 修复笔误 2025-08-05 21:02:05 +08:00
github-actions[bot]
940703c3f9 chore: update ECS_VERSION to 0.1.73 in goecs.sh 2025-08-05 09:42:55 +00:00
spiritlhl
1c2e9cdab9 fix: 修复上游识别,支持直接导入basics识别到的IP地址,而不再重新获取IP地址减少等待时间 2025-08-05 09:28:26 +00:00
spiritlhl
3e6524fa0e fix: 修复和添加上游线路说明 2025-08-02 05:41:17 +00:00
spiritlhl
026f40dc4c fix: 添加额外的本地获取方式 2025-08-01 17:34:56 +00:00
github-actions[bot]
110c58d401 chore: update ECS_VERSION to 0.1.72 in goecs.sh 2025-08-01 17:00:53 +00:00
25 changed files with 1194 additions and 642 deletions

14
.back/OldFunction.go Normal file
View File

@@ -0,0 +1,14 @@
// clearScreen 清屏
func clearScreen() {
var cmd *exec.Cmd
switch runtime.GOOS {
case "windows":
cmd = exec.Command("cmd", "/c", "cls")
case "darwin":
cmd = exec.Command("clear")
default:
cmd = exec.Command("clear")
}
cmd.Stdout = os.Stdout
_ = cmd.Run()
}

View File

@@ -1,9 +0,0 @@
package backtrace
import (
"github.com/oneclickvirt/backtrace/bk"
)
func BackTrace(enableIpv6 bool) {
backtrace.BackTrace(enableIpv6)
}

View File

@@ -1,21 +0,0 @@
package backtrace
import (
"testing"
)
//func TestGeneratePrefixMap(t *testing.T) {
// prefix := "223.119.8.0/21"
// prefixList := GeneratePrefixList(prefix)
// if prefixList != nil {
// // 打印生成的IP地址前缀列表
// for _, ip := range prefixList {
// fmt.Println(ip)
// }
// }
//}
// 本包仅测试,无实际使用
func TestBackTrace(t *testing.T) {
BackTrace(false)
}

View File

@@ -1,9 +0,0 @@
package ntrace
import (
"github.com/oneclickvirt/nt3/nt"
)
func TraceRoute3(language, location, checkType string) {
nt.TraceRoute(language, location, checkType)
}

View File

@@ -1,9 +0,0 @@
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")
}

108
.github/workflows/build_public.yml vendored Normal file
View File

@@ -0,0 +1,108 @@
name: Public Build
on:
workflow_run:
workflows: ["Build and Release"]
types:
- completed
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.24.5'
- name: Update master branch README files
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
if [ -f "go.mod" ]; then
GO_VERSION=$(grep "^go " go.mod | head -n 1 | awk '{print $2}')
echo "提取到的 Go 版本: $GO_VERSION"
if [ -n "$GO_VERSION" ] && [[ "$GO_VERSION" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
echo "版本验证成功,开始替换..."
if [ -f "README.md" ]; then
sed -i "s/选择 go [0-9]\+\.[0-9]\+\.[0-9]\+ 的版本进行安装/选择 go $GO_VERSION 的版本进行安装/g" README.md
sed -i 's|但二进制文件编译至 \[securityCheck\].*)|但已开源|g' README.md
sed -i 's|security.*Enable/Disable security test (default true)|security Enable/Disable security test (default false)|g' README.md
echo "已更新 README.md"
fi
if [ -f "README_EN.md" ]; then
sed -i "s/Select go [0-9]\+\.[0-9]\+\.[0-9]\+ version to install/Select go $GO_VERSION version to install/g" README_EN.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_EN.md
echo "已更新 README_EN.md"
fi
git add README.md README_EN.md
git commit -m "Auto update README files" || echo "No changes to commit"
git push origin ${{ github.ref_name }}
else
echo "错误:未能提取到有效的 Go 版本号或版本号格式不正确"
exit 1
fi
else
echo "错误:未找到 go.mod 文件"
exit 1
fi
- name: Create public branch
run: |
git checkout -b public || git checkout public
git merge ${{ github.ref_name }} --no-edit || true
- name: Remove security package references
run: |
find . -type f -name "*.go" -exec sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' {} +
sed -i '/SecurityUploadToken/d' utils/utils.go
sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' utils/utils.go
sed -i '/^import/,/^)/{/^)/a\'$'\n''const token = "OvwKx5qgJtf7PZgCKbtyojSU.MTcwMTUxNzY1MTgwMw"'$'\n''}' utils/utils.go
sed -i '/github.com\/oneclickvirt\/security/d' go.mod
sed -i 's|var securityFlag = flag.Bool("security", true,|var securityFlag = flag.Bool("security", false,|g' goecs.go
sed -i 's|VPS融合怪测试|VPS融合怪测试(非官方编译)|g' utils/utils.go
sed -i 's|VPS Fusion Monster Test|VPS Fusion Monster Test (Unofficial)|g' utils/utils.go
go mod tidy
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: Update Go version in README files
run: |
if [ -f "go.mod" ]; then
GO_VERSION=$(grep "^go " go.mod | head -n 1 | awk '{print $2}')
echo "提取到的 Go 版本: $GO_VERSION"
if [ -n "$GO_VERSION" ] && [[ "$GO_VERSION" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
echo "版本验证成功,开始替换..."
if [ -f "README.md" ]; then
sed -i "s/选择 go [0-9]\+\.[0-9]\+\.[0-9]\+ 的版本进行安装/选择 go $GO_VERSION 的版本进行安装/g" README.md
echo "已更新 README.md"
fi
if [ -f "README_EN.md" ]; then
sed -i "s/Select go [0-9]\+\.[0-9]\+\.[0-9]\+ version to install/Select go $GO_VERSION version to install/g" README_EN.md
echo "已更新 README_EN.md"
fi
else
echo "错误:未能提取到有效的 Go 版本号或版本号格式不正确"
exit 1
fi
else
echo "错误:未找到 go.mod 文件"
exit 1
fi
- name: Build and Test
run: |
go build -o maintest
./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

View File

@@ -1,55 +0,0 @@
name: Public Build
on:
workflow_run:
workflows: ["Build and Release"]
types:
- completed
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.24.5'
- 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: |
find . -type f -name "*.go" -exec sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' {} +
sed -i '/SecurityUploadToken/d' utils/utils.go
sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' utils/utils.go
sed -i '/^import/,/^)/{/^)/a\'$'\n''const token = "OvwKx5qgJtf7PZgCKbtyojSU.MTcwMTUxNzY1MTgwMw"'$'\n''}' utils/utils.go
sed -i '/github.com\/oneclickvirt\/security/d' go.mod
sed -i 's|var securityFlag = flag.Bool("security", true,|var securityFlag = flag.Bool("security", false,|g' goecs.go
go mod tidy
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
./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

View File

@@ -4,7 +4,7 @@
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs?ref=badge_shield)
[![Hits](https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net)
[![Hits](https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net) [![Downloads](https://ghdownload.spiritlhl.net/oneclickvirt/ecs?color=36c600)](https://github.com/oneclickvirt/ecs/releases)
融合怪测评项目 - GO版本
@@ -47,8 +47,8 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
|----------------|---------------------------|
| Android(arm64) | 存在权限问题未修复非安卓系统的ARM架构无问题 |
| OpenBSD/NetBSD | 部分Goalng的官方库未支持本系统(尤其是net相关项目) |
| Windows虚拟机 | 非物理机器不支持winsat测试硬件性能(硬盘和内存测试) |
| Windows物理机(非Admin下) | 无Admin权限不支持winsat测试硬件性能(硬盘和内存测试) |
| Windows虚拟机 | 无Admin权限的mbw测试性能不准确(内存测试) |
| Windows物理机(非Admin下) | 无Admin权限的mbw测试性能不准确(内存测试) |
---
## **功能**
@@ -61,7 +61,7 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
- 常见流媒体测试并发查询:[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)
- 上游及回程路由线路检测:借鉴 [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)
@@ -82,25 +82,25 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
- **国际用户无加速:**
```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
export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && ./goecs.sh env && ./goecs.sh install && goecs
```
- **国际/国内使用 CDN 加速:**
```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
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 && ./goecs.sh env && ./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
export noninteractive=true && curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh && ./goecs.sh env && ./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
export noninteractive=true && curl -L https://bash.spiritlhl.net/goecs -o goecs.sh && chmod +x goecs.sh && ./goecs.sh env && ./goecs.sh install && goecs
```
#### **详细说明**
@@ -302,11 +302,11 @@ cd ecs
```
2. 安装 Go 环境(如已安装可跳过)
选择 go 1.24.5 的版本进行安装
```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
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/install_scripts/go.sh -o go.sh && chmod +x go.sh && bash go.sh
```
3. 编译
@@ -398,6 +398,10 @@ GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
<img src="https://console.zmto.com/templates/2019/dist/images/logo_dark.svg" alt="zmto" style="height: 50px;">
</a>
## History Usage
![goecs](https://hits.spiritlhl.net/chart/goecs.svg)
## Stargazers over time
[![Stargazers over time](https://starchart.cc/oneclickvirt/ecs.svg?variant=adaptive)](https://www.spiritlhl.net)

View File

@@ -1,8 +1,10 @@
# ecs
# ECS
[![Build and Release](https://github.com/oneclickvirt/ecs/actions/workflows/build_binary.yaml/badge.svg)](https://github.com/oneclickvirt/ecs/actions/workflows/build_binary.yaml)
[![Hits](https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Foneclickvirt%2Fecs?ref=badge_shield)
[![Hits](https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net) [![Downloads](https://ghdownload.spiritlhl.net/oneclickvirt/ecs?color=36c600)](https://github.com/oneclickvirt/ecs/releases)
Fusion Monster Evaluation Project - GO Version
@@ -45,8 +47,8 @@ Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https:
|--------|-------------------------------------------------------------------------------------------------|
| Android(arm64) | Permission issues that are not fixed, no problems with ARM architecture for non-Android systems |
| OpenBSD/NetBSD | Some of Goalng's official libraries do not support this system (especially net-related items) |
| Windows(Virtual Machines) | Non-Physical Machines do not support winsat to test hardware performance (hard disk and memory tests) |
| Windows(Physical Machines)(not under Admin) | No Admin privileges do not support winsat to test hardware performance (hard disk and memory tests) |
| Windows(Virtual Machines) | Inaccurate mbw test performance without Admin rights (memory tests) |
| Windows(Physical Machines)(not under Admin) | Inaccurate mbw test performance without Admin rights (memory tests) |
---
@@ -81,19 +83,19 @@ Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https:
- **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
export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && ./goecs.sh env && ./goecs.sh install && goecs
```
- **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
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 && ./goecs.sh env && ./goecs.sh install && goecs
```
- **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
export noninteractive=true && curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh && ./goecs.sh env && ./goecs.sh install && goecs
```
- **Short Link:**
@@ -298,11 +300,11 @@ cd ecs
```
2. Install Go environment (skip if already installed)
Select go 1.24.5 version to install
```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
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/install_scripts/go.sh -o go.sh && chmod +x go.sh && bash go.sh
```
3. Compile
@@ -344,6 +346,7 @@ GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
| 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 |
| Ranking | [sysbench.spiritlhl.net](https://sysbench.spiritlhl.net/) | [browser.geekbench.com](https://browser.geekbench.com/) |
Note that `goecs` allows you to specify CPU test method via parameters. The default is chosen for faster testing across more systems.
@@ -393,6 +396,13 @@ Thanks also to the following platforms for editorial and testing support
<img src="https://console.zmto.com/templates/2019/dist/images/logo_dark.svg" alt="zmto" style="height: 50px;">
</a>
## History Usage
![goecs](https://hits.spiritlhl.net/chart/goecs.svg)
## 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,6 +1,6 @@
## 目录 / 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)
[![Hits](https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net) [![Downloads](https://ghdownload.spiritlhl.net/oneclickvirt/ecs?color=36c600)](https://github.com/oneclickvirt/ecs/releases)
## 语言 / Languages / 言語
- [中文](#中文)
@@ -15,7 +15,7 @@
- [流媒体解锁](#流媒体解锁)
- [IP质量检测](#IP质量检测)
- [邮件端口检测](#邮件端口检测)
- [三网回城线路检测](#三网回城线路检测)
- [上游及回程线路检测](#上游及回程线路检测)
- [三网回程路由检测](#三网回程路由检测)
- [就近测速](#就近测速)
@@ -27,6 +27,7 @@
- [Streaming Media Unlocking](#Streaming-Media-Unlocking)
- [IP Quality Detection](#IP-Quality-Detection)
- [Email Port Detection](#Email-Port-Detection)
- [Nearby Speed Testing](#Nearby-Speed-Testing)
## 日本語
- [システム基本情報](#システム基本情報)
@@ -36,6 +37,7 @@
- [ストリーミングメディアロック解除](#ストリーミングメディアロック解除)
- [IP品質検出](#IP品質検出)
- [メールポート検出](#メールポート検出)
- [近隣スピードテスト](#近隣スピードテスト)
---
@@ -43,23 +45,32 @@
### **系统基础信息**
CPU型号: 不必多说大概的说按CPU的发布时间都是新款则AMD好于Intel都是旧款则Intel好于AMD。
依赖项目:[https://github.com/oneclickvirt/basics](https://github.com/oneclickvirt/basics) [https://github.com/oneclickvirt/gostun](https://github.com/oneclickvirt/gostun)
CPU数量: 会检测是物理核心还是逻辑核心,优先展示物理核心,查不到物理核心才去展示逻辑核心。在服务器实际使用过程中,程序一般是按逻辑核心分配执行的,非视频转码和科学计算,物理核心一般都是开超线程成逻辑核心用,横向比较的时候,对应类型的核心数量才有比较的意义
CPU型号: 一般来说按CPU的发布时间都是新款则AMD好于Intel都是旧款则Intel好于AMD而Apple的M系列芯片则是断层式领先
CPU缓存显示的宿主机的CPU三级缓存信息
CPU数量: 会检测是物理核心还是逻辑核心优先展示物理核心查不到物理核心才去展示逻辑核心。在服务器实际使用过程中程序一般是按逻辑核心分配执行的非视频转码和科学计算物理核心一般都是开超线程成逻辑核心用横向比较的时候对应类型的核心数量才有比较的意义。当然如果一个是物理核一个是虚拟核在后面CPU测试得分类似的情况下肯定是物理核更优无需担忧CPU性能被共享的问题
AES-NI: 指令集是加密解密加速用的,有的话常规网络请求会更快一些,性能更高一些,没有的话会影响网络请求(含代理用途)
CPU缓存显示的宿主机的CPU三级缓存信息。对普通应用可能影响不大但对数据库、编译、大规模并发请求等场景L3 大小显著影响性能
AES-NI: AES指令集是加密解密加速用的对于HTTPS(TLS/SSL)网络请求、VPN代理(配置使用的AES加密的)、磁盘加密这些场景有明显的优化,更快更省资源。
VM-x/AMD-V/Hyper-V: 是当前测试宿主机是否支持嵌套虚拟化的指标如果测试环境是套在docker里测或者没有root权限那么这个默认就是检测不到显示不支持嵌套虚拟化。这个指标在你需要在宿主机上开设虚拟机(如 KVM、VirtualBox、VMware)的时候有用,其他用途该指标用处不大。
内存: 显示内存 正在使用的大小/总大小 ,不含虚拟内存。
气球驱动: 显示宿主机是否使用了气球驱动,使用了证明母机有共享内存使用,需要结合下面的内存读写测试查看是否有超售/严格的限制。
气球驱动: 显示宿主机是否用了气球驱动。气球驱动用于宿主机和虚拟机之间动态调节内存分配:宿主机可以通过驱动要求虚拟机“放气”释放部分内存,或“充气”占用更多内存。启用它通常意味着宿主机具备内存超售能力,但是否真的存在超售,需要结合下面的内存读写测试查看是否有超售/严格的限制。
内核页合并:显示宿主机是否使用了KSM内存融合使用了证明母机有共享内存使用,需要结合下面的内存读写测试查看是否有超售/严格的限制。
内核页合并:显示宿主机是否用了内核页合并机制。KSM 会将多个进程中内容相同的内存页合并为一份,以减少物理内存占用。启用它通常意味着宿主机可能在进行内存节省或存在一定程度的内存超售。是否真正造成性能影响或内存紧张,需要结合下面的内存读写测试查看是否有超售/严格的限制。
虚拟内存: 显示 SWAP虚拟内存
虚拟内存: swap虚拟内存 是磁盘上划出的虚拟内存空间用来在物理内存不足时临时存放数据。它能防止内存不足导致程序崩溃但频繁使用会明显拖慢系统Linux 官方推荐的 swap 配置如下:
| 物理内存大小 | 推荐 SWAP 大小 |
| ------------------ | ---------- |
| ≤ 2G | 内存的 2 倍 |
| 2G < 内存 8G | 等于物理内存大小 |
| 8G | 8G 即可 |
| 需要休眠 (hibernation) | 至少等于物理内存大小 |
硬盘空间: 显示硬盘 正在使用的大小/总大小
@@ -69,15 +80,15 @@ VM-x/AMD-V/Hyper-V: 是当前测试宿主机是否支持嵌套虚拟化的指标
内核: 显示系统内核版本
系统在线时间: 显示宿主机自从开机到测试时已在线时长
系统在线时间: 显示宿主机自从开机到测试时已在线时长
时区: 显示宿主机系统时区
负载: 显示系统负载
虚拟化架构: 显示宿主机来自什么虚拟化架构一般来说推荐```Dedicated > KVM > Xen```虚拟化,其他虚拟化都会存在性能损耗,导致使用的时候存在性能共享/损耗,但这个也说不准,独立服务器才拥有完全独立的资源占用,其他虚拟化基本都会有资源共享,取决于宿主机的售卖者是否有良心,具体性能优劣还是得看后面的专项测试。
虚拟化架构: 显示宿主机来自什么虚拟化架构一般来说推荐```Dedicated > KVM > Xen```虚拟化,其他虚拟化都会存在性能损耗,导致使用的时候存在性能共享/损耗,但这个也说不准,独立服务器才拥有完全独立的资源占用,其他虚拟化基本都会有资源共享,取决于宿主机的持有者对这个虚拟机是否有良心,具体性能优劣还是得看后面的专项性能测试。
NAT类型: 显示NAT类型具体推荐```Full Cone > Restricted Cone > Port Restricted Cone > Symmetric```,测不出来会显示```Inconclusive```,一般来说不拿来做特殊用途(有关于特殊的代理实时通讯需求的)都不用关注本指标。
NAT类型: 显示NAT类型具体推荐```Full Cone > Restricted Cone > Port Restricted Cone > Symmetric```,测不出来或者非正规协议的类型会显示```Inconclusive```,一般来说只有特殊用途,比如有特殊的代理实时通讯、做FRP内穿端口等需求才需要特别关注其他一般情况下都不用关注本指标。
TCP加速方式一般是```cubic/bbr```拥塞控制协议一般来说做代理服务器用bbr可以改善网速普通用途不必关注此指标。
@@ -85,12 +96,14 @@ IPV4/IPV6 ASN: 显示宿主机IP所属的ASN组织ID和名字同一个IDC可
IPV4/IPV6 Location: 显示对应协议的IP在数据库中的地理位置。
IPV4 Active IPs: 根据 bgp.tools 信息查询当前CIDR分块中 活跃邻居数量/总邻居数量
IPV4 Active IPs: 根据 bgp.tools 信息查询当前CIDR分块中 活跃邻居数量/总邻居数量 由于是非实时的,可能存在延迟。
IPV6 子网掩码根据宿主机信息查询的本机IPV6子网大小
### **CPU测试**
依赖项目:[https://github.com/oneclickvirt/cputest](https://github.com/oneclickvirt/cputest)
支持通过命令行参数选择```GeekBench```和```Sysbench```进行测试:
| 比较项 | sysbench | geekbench |
@@ -101,6 +114,7 @@ IPV6 子网掩码根据宿主机信息查询的本机IPV6子网大小
| 测试稳定性 | 核心测试组件10年以上未变 | 每个大版本更新测试项,分数不同版本间难以对比(每个版本对标当前最好的CPU) |
| 测试内容 | 仅测试计算性能,基于素数计算 | 覆盖多种性能测试,分数加权计算,但部分测试实际不常用 |
| 适用场景 | 适合快速测试,仅测试计算性能 | 适合综合全面的测试 |
| 排行榜 | [sysbench.spiritlhl.net](https://sysbench.spiritlhl.net/) | [browser.geekbench.com](https://browser.geekbench.com/) |
默认使用```Sysbench```进行测试,基准大致如下:
@@ -116,16 +130,40 @@ AMD的7950x单核满血性能得分在6500左右AMD的5950x单核满血性能
多说一句,```GeekBench```测的很多内容,实际在服务器使用过程中根本用不到,测试仅供参考。当然```Sysbench```非常不全面但它基于最基础的计算性能可以大致比较CPU的性能。
实际上CPU性能测试够用就行除非是科学计算以及视频转码一般不需要特别追求高性能CPU。
实际上CPU性能测试够用就行除非是科学计算以及视频转码一般不需要特别追求高性能CPU。如果有性能需求,那么需要关注程序本身吃的是多核还是单核,对应看多核还是单核得分。
### **内存测试**
一般来说只需要判断IO速度是否低于```10240MB/s```,如果低于这个值那么证明内存性能不佳,极大概率存在超售超卖问题。
依赖项目:[https://github.com/oneclickvirt/memorytest](https://github.com/oneclickvirt/memorytest)
至于超开的原因可能是开了虚拟内存(硬盘当内存用)、可能是开了ZRAM(牺牲CPU性能)、可能是开了气球驱动、可能是开了KSM内存融合原因多种多样。
一般来说,只需要判断 IO 速度是否低于 `10240 MB/s (≈10 GB/s)`
如果低于这个值,那么证明内存性能不佳,极大概率存在超售超卖问题。
至于超开的原因可能是:
* 开了虚拟内存 (硬盘当内存用)
* 开了 ZRAM (牺牲 CPU 性能)
* 开了气球驱动 (Balloon Driver)
* 开了 KSM 内存融合
原因多种多样。
| 内存类型 | 典型频率 (MHz) | 单通道带宽 | 双通道带宽 |
| ---- | ------------ | ------------------------------------- | --------------------------------------- |
| DDR3 | 1333 \~ 2133 | 10 \~ 17 GB/s (≈ 10240 \~ 17408 MB/s) | 20 \~ 34 GB/s (≈ 20480 \~ 34816 MB/s) |
| DDR4 | 2133 \~ 3200 | 17 \~ 25 GB/s (≈ 17408 \~ 25600 MB/s) | 34 \~ 50 GB/s (≈ 34816 \~ 51200 MB/s) |
| DDR5 | 4800 \~ 7200 | 38 \~ 57 GB/s (≈ 38912 \~ 58368 MB/s) | 76 \~ 114 GB/s (≈ 77824 \~ 116736 MB/s) |
根据上表内容,本项目测试的粗略判断方法:
* **< 20 GB/s (20480 MB/s)** → 可能是 DDR3或 DDR4 单通道 / 低频)
* **20 \~ 40 GB/s (20480 \~ 40960 MB/s)** → 大概率 DDR4
* **≈ 50 GB/s (≈ 51200 MB/s)** → 基本就是 DDR5
### **硬盘测试**
依赖项目:[https://github.com/oneclickvirt/disktest](https://github.com/oneclickvirt/disktest)
```dd```测试可能误差偏大但测试速度快无硬盘大小限制,```fio```测试真实一些但测试速度慢有硬盘以及内存大小的最低需求。
同时服务器可能有不同的文件系统某些文件系统的IO引擎在同样的硬件条件下测试的读写速度更快这是正常的。项目默认使用```fio```进行测试测试使用的IO引擎优先级为```libaio > posixaio > psync```,备选项```dd```测试在```fio```测试不可用时自动替换。
@@ -134,7 +172,7 @@ AMD的7950x单核满血性能得分在6500左右AMD的5950x单核满血性能
| 操作系统类型 | 主要指标 | 次要指标 |
|---------|-------------------|---------------------|
| Windows/Mac | 4K读 → 64K读 → 写入测试 | 图形界面系统优先考虑读取性能 |
| Windows/MacOS | 4K读 → 64K读 → 写入测试 | 图形界面系统优先考虑读取性能 |
| Linux (无图形界面) | 4K读 + 4K写 + 1M读写| 读/写值通常相似 |
以下硬盘类型对于指标值指 常规~满血 性能状态,指```libaio```作为IO测试引擎指在```Linux```下进行测试
@@ -168,14 +206,40 @@ AMD的7950x单核满血性能得分在6500左右AMD的5950x单核满血性能
### **流媒体解锁**
检索常见的流媒体平台解锁当然也不全是流媒体还有一些常见的别的平台的解锁也纳入了。一般来说IP解锁地区都是一致的不会到处乱飘如果发现多家平台解锁地区不一致那么IP大概率是租赁的IPXO等平台的各平台数据库识别缓慢IP质量一般来说也好不到哪里去。
依赖项目:[https://github.com/oneclickvirt/CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests) [https://github.com/oneclickvirt/UnlockTests](https://github.com/oneclickvirt/UnlockTests)
默认只检测跨国流媒体解锁。
一般来说正常的情况下一个IP多个流媒体的解锁地区都是一致的不会到处乱飘如果发现多家平台解锁地区不一致那么IP大概率来自IPXO等平台租赁或者是刚刚宣告和被使用未被流媒体普通的数据库所识别修正地域。由于各平台的IP数据库识别速度不一致所以有时候有的平台解锁区域正常有的飘到路由上的某个位置有的飘到IP未被你使用前所在的位置。
| DNS 类型 | 解锁方式判断是否必要 | DNS 对解锁影响 | 说明 |
| ------------ | ---------- | --------- | --------------------------------------- |
| 官方主流 DNS | 否 | 小 | 流媒体解锁主要依赖节点 IPDNS 解析基本不会干扰解锁。 |
| 非主流 / 自建 DNS | 是 | 大 | 流媒体解锁结果受 DNS 解析影响较大,需要判断是原生解锁还是 DNS 解锁。 |
所以测试过程中如果宿主机当前使用的是官方主流的DNS不会进行是否为原生解锁的判断。
### **IP质量检测**
依赖项目:[https://github.com/oneclickvirt/securityCheck](https://github.com/oneclickvirt/securityCheck)
检测14个数据库的IP相关信息一般来说看使用类型和公司类型还有安全信息的其他判别足矣安全得分真的图一乐。多个平台比较对应检测项目都为对应值证明当前IP确实如此不要仅相信一个数据库源的信息。
* **使用类型 & 公司类型**显示IP归属和使用场景例如是否属于家庭用户、企业办公、托管服务或云/数据中心。
* **云提供商 / 数据中心 / 移动设备**判断IP是否来自云服务、数据中心或移动网络帮助识别共享或高风险IP。
* **代理 / VPN / Tor / Tor出口**检测IP是否用于隐藏真实身份或位置可能涉及匿名访问或滥用行为。
* **网络爬虫 / 机器人**:识别自动化访问或采集程序,对安全风险评估有参考价值。
* **匿名 / 滥用者 / 威胁 / 中继 / Bogon**显示IP历史行为特征和是否属于保留/未分配IP辅助判断IP可信度。
* **安全得分、声誉、信任得分、威胁得分、欺诈得分、滥用得分**各数据库对IP的量化安全评价仅供参考。
* **社区投票 & 黑名单记录**:展示用户反馈及公共黑名单信息,可快速识别潜在风险。
* **Google搜索可行性**检测IP访问Google搜索服务的可行性间接反映网络限制或屏蔽情况。
多平台对比更可靠,不同数据库算法和更新频率不同,单一来源可能存在误判。多个数据库显示相似结果,说明这个结果更可靠。
### **邮件端口检测**
依赖项目:[https://github.com/oneclickvirt/portchecker](https://github.com/oneclickvirt/portchecker)
- **SMTP25**:用于邮件服务器之间传输邮件(发送邮件)。
- **SMTPS465**:用于加密的 SMTP 发送邮件SSL/TLS 方式)。
- **SMTP587**:用于客户端向邮件服务器发送邮件,支持 STARTTLS 加密。
@@ -184,13 +248,43 @@ AMD的7950x单核满血性能得分在6500左右AMD的5950x单核满血性能
- **IMAP143**:用于邮件客户端在线管理邮件(查看、同步邮件),不加密。
- **IMAPS993**:用于加密的 IMAP安全地管理邮件SSL/TLS 方式)。
具体当前宿主机不做邮局或者不收电子邮件,那么该项目指标不理会。
具体当前宿主机不做邮局不收电子邮件,那么该项目指标不需要理会。
### **三网回程线路检测**
### **上游及回程线路检测**
检测当前的宿主机的IP地址 到 四个主要POP点城市的三个主要运营商的接入点的IP地址 的线路,具体来说
依赖项目:[https://github.com/oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)
电信163、联通4837、移动CMI 是常见的线路
#### 上游类型与运营商等级说明
- **直接上游Direct Upstream**
当前运营商直接购买网络服务的上级运营商,通常是 BGP 邻居。
- **间接上游Indirect Upstream**
直接上游的上级,形成层层向上的关系链。可通过 BGP 路由路径中的多跳信息识别。
| 等级 | 描述 |
|------|------|
| **Tier 1 Global** | 全球顶级运营商(如 AT&T、Verizon、NTT、Telia 等之间免费互联Settlement-Free Peering不依赖他人即可访问全球任意网络。 |
| **Tier 1 Regional** | 区域性顶级运营商,在特定区域具有一级能力,但在全球范围互联性稍弱。 |
| **Tier 1 Indirect** | 间接连接的 Tier 1非直接购买通过中间上游间接接入 Tier 1 网络。 |
| **Tier 2** | 需要向 Tier 1 付费购买上网能力的二级运营商,通常是各国主流电信商或 ISP。 |
| **CDN Provider** | 内容分发网络提供商,如 Cloudflare、Akamai、Fastly 等,主要用于内容加速而非传统上游。 |
| **Direct/Indirect Others** | 其他类型的直接或间接连接,如 IXInternet Exchange成员、私有对等互联等。 |
上游质量判断:直接接入的高等级上游(特别是 Tier 1 Global越多通常网络连通性越好。但实际网络质量也受到以下因素影响
- 上下游之间的商业结算关系;
- 购买的带宽套餐和服务质量;
- 对等端口Peering Ports大小和负载
- 网络拥塞、路由策略、延迟路径等。
无法完全从 BGP 路由中判断。
一般来说,**接入高质量上游越多,网络连通性越优**。但由于存在诸多不可见的商业和技术因素,**无法仅凭上游等级准确判断网络质量**上游检测约等于图一乐实际得看对应的路由情况和长时间Ping的情况。
然后是检测当前的宿主机的IP地址 到 四个主要POP点城市的三个主要运营商的接入点的IP地址 的线路,具体来说
电信163、联通4837、移动CMI 是常见的线路移动CMI对两广地区的移动运营商特供延迟低也能算优质仅限两广移动。
电信CN2GIA > 电信CN2GT 移动CMIN2 联通9929 算优质的线路
@@ -198,310 +292,466 @@ AMD的7950x单核满血性能得分在6500左右AMD的5950x单核满血性能
### **三网回程路由检测**
默认检测广州为目的地,实际可使用命令行参数指定目的地,见对应的说明。
依赖项目:[https://github.com/oneclickvirt/nt3](https://github.com/oneclickvirt/nt3)
主要就是看是不是直连,是不是延迟低,是不是没有隐藏路由信息。如果路由全球跑,延迟起飞,那么线路自然不会好到哪里去
默认检测广州为目的地,实际可使用命令行参数指定目的地,见对应的参数说明
主要就是看是不是直连是不是延迟低是不是没有隐藏路由信息有没有一些优质线路或IX链接。
如果路由全球跑,延迟起飞,那么线路自然不会好到哪里去。
有时候路由信息完全藏起来了,只知道实际使用的延迟低,实际可能也是优质线路只是查不到信息,这就没办法直接识别了。
### **就近测速**
依赖项目:[https://github.com/oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
先测的官方推荐的测速点然后测有代表性的国际测速点最后测国内三大运营商ping值最低的测速点。
境内使用为主就看境内测速即可,境外使用看境外测速,官方测速点可以代表受测的宿主机本地带宽基准。
一般来说境外的服务器的带宽100Mbps起步境内的服务器1Mbps带宽起步具体看线路优劣带宽特别大有时候未必用得上够用就行了。
一般来说中国境外的服务器的带宽100Mbps起步中国境内的服务器1Mbps带宽起步具体看线路优劣带宽特别大有时候未必用得上够用就行了。
日常我偏向使用1Gbps带宽的服务器至少下载依赖什么的速度足够快境内小水管几Mbps真的下半天下不完恨不得到机房插个U盘转移数据。
---
## English
### **Basic System Information**
### 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.
Dependency project: [https://github.com/oneclickvirt/basics](https://github.com/oneclickvirt/basics) [https://github.com/oneclickvirt/gostun](https://github.com/oneclickvirt/gostun)
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 Model**: Generally speaking, based on CPU release time, newer models favor AMD over Intel, while older models favor Intel over AMD. Apple's M-series chips are in a league of their own.
CPU Cache: Displays the host machine's three-level CPU cache information.
**CPU Count**: Detects whether cores are physical or logical, prioritizing physical cores display. Logical cores are shown only when physical cores cannot be detected. In actual server usage, programs are generally allocated based on logical cores. For non-video transcoding and scientific computing, physical cores usually have hyperthreading enabled to function as logical cores. When making comparisons, only corresponding core types are meaningful. Of course, if one is physical and the other is virtual, with similar CPU test scores, physical cores are definitely better without worrying about CPU performance sharing issues.
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.
**CPU Cache**: Displays the host's CPU L3 cache information. While it may not significantly impact regular applications, for databases, compilation, and large-scale concurrent requests, L3 cache size significantly affects performance.
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.
**AES-NI**: AES instruction set is used for encryption/decryption acceleration, providing significant optimization for HTTPS (TLS/SSL) network requests, VPN proxies (configured with AES encryption), and disk encryption scenarios - faster and more resource-efficient.
Memory: Displays memory size in format "currently used size/total size", not including virtual memory.
**VM-x/AMD-V/Hyper-V**: Indicators showing whether the current test host supports nested virtualization. If the test environment runs in Docker or lacks root permissions, this will show as unsupported by default. This indicator is useful when you need to create virtual machines (like KVM, VirtualBox, VMware) on the host; otherwise, it has limited utility.
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.
**Memory**: Shows memory usage as currently used size/total size, excluding virtual memory.
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.
**Balloon Driver**: Shows whether the host has balloon driver enabled. Balloon driver is used for dynamic memory allocation between host and virtual machines: the host can request virtual machines to "deflate" and release some memory, or "inflate" to occupy more memory. Enabling it usually means the host has memory overselling capability, but whether actual overselling exists needs to be checked with memory read/write tests below for overselling/strict limitations.
Virtual Memory: Displays SWAP virtual memory.
**Kernel Page Merging**: Shows whether the host has kernel page merging mechanism enabled. KSM merges memory pages with identical content from multiple processes into a single copy to reduce physical memory usage. Enabling it usually means the host may be implementing memory savings or has some degree of memory overselling. Whether it actually causes performance impact or memory pressure needs to be checked with memory read/write tests below for overselling/strict limitations.
Disk Space: Displays disk usage in format "currently used size/total size".
**Virtual Memory**: Swap virtual memory is virtual memory space allocated on disk, used to temporarily store data when physical memory is insufficient. It prevents program crashes due to insufficient memory, but frequent use will noticeably slow down the system. Linux officially recommends swap configuration as follows:
Boot Disk Path: Shows the path of the boot disk.
| Physical Memory Size | Recommended SWAP Size |
| -------------------- | --------------------- |
| ≤ 2G | 2x memory size |
| 2G < memory ≤ 8G | Equal to physical memory |
| ≥ 8G | About 8G is sufficient |
| Hibernation needed | At least equal to physical memory |
System: Displays system name and architecture.
**Disk Space**: Shows disk usage as currently used size/total size
Kernel: Displays system kernel version.
**Boot Disk Path**: Shows the boot disk path
System Uptime: Shows how long the host machine has been online since boot until testing time.
**System**: Shows system name and architecture
Timezone: Displays the host machine's system timezone.
**Kernel**: Shows system kernel version
Load: Displays system load.
**System Uptime**: Shows host uptime from boot to test time
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.
**Time Zone**: Shows host system time zone
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.
**Load**: Shows system load
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.
**Virtualization Architecture**: Shows what virtualization architecture the host comes from. Generally recommended: `Dedicated > KVM > Xen` virtualization. Other virtualization types have performance losses, causing performance sharing/loss during use. However, this isn't definitive - only dedicated servers have completely independent resource usage. Other virtualization basically involves resource sharing, depending on whether the host holder is conscientious about this virtual machine. Actual performance superiority still depends on subsequent specialized performance tests.
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.
**NAT Type**: Shows NAT type. Specifically recommended: `Full Cone > Restricted Cone > Port Restricted Cone > Symmetric`. Undetectable or non-standard protocol types show as `Inconclusive`. Generally, only special purposes like specific proxies, real-time communication, or FRP port forwarding need special attention to this indicator; other general situations don't need to focus on this metric.
IPv4/IPv6 Location: Shows the geographic location of the corresponding protocol's IP in the database.
**TCP Acceleration Method**: Usually `cubic/bbr` congestion control protocols. Generally speaking, using bbr for proxy servers can improve network speed; regular usage doesn't need to focus on this indicator.
IPV4 Active IPs: Query the number of active neighbours/total number of neighbours in the current CIDR chunk based on the bgp.tools information.
**IPV4/IPV6 ASN**: Shows the ASN organization ID and name that the host IP belongs to. The same IDC may have multiple ASNs, and ASNs may have multiple merchants selling servers with different IP segments. The specific upstream and downstream relationships are complex; use bgp.tool for further investigation.
### **CPU Testing**
**IPV4/IPV6 Location**: Shows the geographic location of the corresponding protocol's IP in the database.
Supports selecting `GeekBench` and `Sysbench` for testing through command line parameters:
**IPV4 Active IPs**: Based on bgp.tools information, queries active neighbor count/total neighbor count in the current CIDR block. Since this is non-real-time, there may be delays.
**IPV6 Subnet Mask**: Queries the local IPV6 subnet size based on host information.
### CPU Testing
Dependency project: [https://github.com/oneclickvirt/cputest](https://github.com/oneclickvirt/cputest)
Supports command-line parameter selection between `GeekBench` and `Sysbench` for testing:
| 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 |
|----------------|----------|-----------|
| Applicability | Lightweight, runs on almost any server | Heavy, cannot run on small machines |
| Test Requirements | No network needed, no special hardware requirements | Requires internet, IPV4 environment, at least 1G memory |
| Open Source | LUA-based, open source, can compile for various architectures (this project has Go version built-in) | Official binary closed source, doesn't support self-compilation |
| Test Stability | Core test components unchanged for 10+ years | Updates test items with each major version, scores difficult to compare across versions (each version benchmarks against current best CPUs) |
| Test Content | Only tests computational performance, based on prime calculations | Covers various performance tests, weighted score calculation, but some tests aren't commonly used |
| Use Case | Suitable for quick testing, only tests computational performance | Suitable for comprehensive testing |
| Leaderboard | [sysbench.spiritlhl.net](https://sysbench.spiritlhl.net/) | [browser.geekbench.com](https://browser.geekbench.com/) |
By default, ```Sysbench``` is used for testing, with the baseline roughly as follows:
Default uses `Sysbench` for testing, with rough benchmarks as follows:
CPU test single-core ```Sysbench``` scores above 5000 can be considered first tier, 4000 to 5000 points second tier, with roughly one tier per 1000 points.
CPU test single-core `Sysbench` scores above 5000 can be considered first-tier, 4000-5000 points second-tier, 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.
AMD 7950x single-core full performance scores around 6500, AMD 5950x single-core full performance scores around 5700, Intel regular CPUs (E5 series) around 1000-800, single-core CPUs below 500 can be considered 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.
Sometimes multi-core and single-core scores are identical, proving the merchant is limiting program concurrent CPU usage, 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.
`Sysbench` benchmarks can be seen in the [CPU Performance Ladder For Sysbench](https://sysbench.spiritlhl.net/) tier chart. Specific scores depend on the sysbench version 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.
`GeekBench` benchmarks can be seen in the [official website](https://browser.geekbench.com/processor-benchmarks/) tier chart. Specific scores differ for each `GeekBench` version, pay attention to which `GeekBench` version was used during 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.
One more thing: `GeekBench` tests many things that are actually unused in server operations, tests are 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.
Actually, CPU performance testing should be sufficient. Unless for scientific computing and video transcoding, generally no need to particularly pursue high-performance CPUs. If there are performance requirements, need to focus on whether the program itself uses multi-core or single-core, and look at multi-core or single-core scores accordingly.
### **Memory Testing**
### 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.
Dependency project: [https://github.com/oneclickvirt/memorytest](https://github.com/oneclickvirt/memorytest)
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.
Generally speaking, you only need to determine if IO speed is below `10240 MB/s (≈10 GB/s)`.
If below this value, it proves poor memory performance with high probability of overselling issues.
### **Disk Testing**
Possible reasons for overselling:
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.
* Virtual memory enabled (using disk as memory)
* ZRAM enabled (sacrificing CPU performance)
* Balloon driver enabled
* KSM memory fusion enabled
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.
Various reasons exist.
Using `fio` test results as an example, the baseline is as follows:
| Memory Type | Typical Frequency (MHz) | Single Channel Bandwidth | Dual Channel Bandwidth |
| ----------- | ----------------------- | ------------------------ | ---------------------- |
| DDR3 | 1333 ~ 2133 | 10 ~ 17 GB/s (≈ 10240 ~ 17408 MB/s) | 20 ~ 34 GB/s (≈ 20480 ~ 34816 MB/s) |
| DDR4 | 2133 ~ 3200 | 17 ~ 25 GB/s (≈ 17408 ~ 25600 MB/s) | 34 ~ 50 GB/s (≈ 34816 ~ 51200 MB/s) |
| DDR5 | 4800 ~ 7200 | 38 ~ 57 GB/s (≈ 38912 ~ 58368 MB/s) | 76 ~ 114 GB/s (≈ 77824 ~ 116736 MB/s) |
Based on the above table, this project's rough judgment method:
* **< 20 GB/s (20480 MB/s)** → Possibly DDR3 (or DDR4 single channel / low frequency)
* **20 ~ 40 GB/s (20480 ~ 40960 MB/s)** → Most likely DDR4
* **≈ 50 GB/s (≈ 51200 MB/s)** → Basically DDR5
### Disk Testing
Dependency project: [https://github.com/oneclickvirt/disktest](https://github.com/oneclickvirt/disktest)
`dd` testing may have larger errors but tests quickly with no disk size limitations. `fio` testing is more realistic but tests slowly with minimum disk and memory size requirements.
Additionally, servers may have different file systems. Certain file systems' IO engines achieve faster read/write speeds under the same hardware conditions, which is normal. The project defaults to using `fio` for testing, with IO engine priority: `libaio > posixaio > psync`. Alternative `dd` testing automatically replaces when `fio` testing is unavailable.
Using `fio` test results as benchmark examples:
| 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 |
|---------|-----------------|-------------------|
| Windows/MacOS | 4K Read → 64K Read → Write Tests | GUI systems prioritize read performance |
| Linux (No 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`
The following disk types refer to regular~full performance states, using `libaio` as IO test engine, tested under `Linux`:
| Drive Type | 4K(IOPS) Performance | 1M(IOPS) Performance |
|------------|--------------------------|----------------------|
| 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:
Quick Assessment:
1. **Primary Check**: 4K read(IOPS) 4K write(IOPS)
- Almost identical with little difference
1. **Primary Check**: 4K Read (IOPS) 4K Write (IOPS)
- Nearly 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
- < 10 MB/s = Poor performance, severe overselling/restrictions
2. **Secondary Check**: 1M total(IOPS)
- IO limit set by provider
2. **Secondary Check**: 1M Total (IOPS)
- Provider's IO limitations
- Resource overselling situation
- Higher value is better
- NVMe SSD typically reaches 4-6 GB/s
- Standard SSD typically reaches 1-2 GB/s
- Higher values are better
- NVMe SSD usually reaches 4-6 GB/s
- Standard SSD usually reaches 1-2 GB/s
If NVMe SSD's 1M(IOPS) value < 1GB/s, it indicates severe resource overselling.
If NVMe SSD's 1M (IOPS) value < 1GB/s indicates serious 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.
Note: This tests real IO, limited to this project. IO tests from other projects don't guarantee universal benchmarks because they may use different parameters, may not set direct IO read/write, may have inconsistent IO engines, or inconsistent test times, all causing benchmark deviations.
### **Streaming Media Unlocking**
### 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.
Dependency project: [https://github.com/oneclickvirt/CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests) [https://github.com/oneclickvirt/UnlockTests](https://github.com/oneclickvirt/UnlockTests)
### **IP Quality Detection**
Default only checks cross-border streaming media unlocking.
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.
Generally speaking, under normal circumstances, multiple streaming services for one IP should have consistent unlock regions without scattered locations. If multiple platforms show inconsistent unlock regions, the IP likely comes from platforms like IPXO rentals or has been recently announced and used, not yet recognized and corrected by streaming media common databases. Due to inconsistent IP database recognition speeds across platforms, sometimes some platforms unlock regions normally, some drift to certain router locations, and some drift to where the IP was before you used it.
### **Email Port Detection**
| DNS Type | Unlock Method Judgment Necessary | DNS Impact on Unlocking | Description |
| -------- | ------------------------------- | ----------------------- | ----------- |
| Official Mainstream DNS | No | Small | Streaming unlock mainly relies on node IP, DNS resolution basically doesn't interfere with unlocking |
| Non-mainstream / Self-built DNS | Yes | Large | Streaming unlock results greatly affected by DNS resolution, need to judge if it's native unlock or DNS unlock |
- **SMTP (25)**: Used for email transmission between mail servers (sending mail).
So during testing, if the host currently uses official mainstream DNS, no judgment of whether it's native unlocking will be performed.
### IP Quality Detection
Dependency project: [https://github.com/oneclickvirt/securityCheck](https://github.com/oneclickvirt/securityCheck)
Detects IP-related information from 14 databases. Generally speaking, looking at usage type, company type, and security information's other discriminators is sufficient. Security scores are really just for fun. When multiple platforms show corresponding detection items all having corresponding values, it proves the current IP is indeed as such - don't trust information from just one database source.
* **Usage Type & Company Type**: Shows IP attribution and usage scenarios, such as whether it belongs to home users, enterprise office, hosting services, or cloud/data centers.
* **Cloud Provider / Data Center / Mobile Device**: Determines if IP comes from cloud services, data centers, or mobile networks, helping identify shared or high-risk IPs.
* **Proxy / VPN / Tor / Tor Exit**: Detects if IP is used to hide real identity or location, possibly involving anonymous access or abuse behavior.
* **Web Crawler / Bot**: Identifies automated access or collection programs, with reference value for security risk assessment.
* **Anonymous / Abuser / Threat / Relay / Bogon**: Shows IP historical behavior characteristics and whether it belongs to reserved/unallocated IPs, assisting in judging IP credibility.
* **Security Score, Reputation, Trust Score, Threat Score, Fraud Score, Abuse Score**: Various databases' quantified security evaluations of IPs, for reference only.
* **Community Voting & Blacklist Records**: Shows user feedback and public blacklist information, can quickly identify potential risks.
* **Google Search Feasibility**: Tests IP's feasibility for accessing Google search services, indirectly reflecting network restrictions or blocking situations.
Multi-platform comparison is more reliable. Different databases have different algorithms and update frequencies; single sources may misjudge. Similar results from multiple databases indicate higher reliability.
### Email Port Detection
Dependency project: [https://github.com/oneclickvirt/portchecker](https://github.com/oneclickvirt/portchecker)
- **SMTP (25)**: Used for mail transfer 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.
- **SMTP (587)**: Used for clients sending mail to mail servers, supports STARTTLS encryption.
- **POP3 (110)**: Used for mail clients downloading 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.
- **IMAP (143)**: Used for mail clients managing mail online (viewing, syncing 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.
If the current host doesn't function as a mail server and doesn't send/receive emails, this project indicator can be ignored.
### Nearby Speed Testing
Dependency project: [https://github.com/oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
First test the officially recommended speed test points, then test representative international speed test points.
Official speed test points can represent the local bandwidth baseline of the host machine being tested.
In daily use, I prefer to use servers with 1Gbps bandwidth, at least the speed of downloading dependencies is fast enough.
---
## 日本語
### **システム基本情報**
### システム基本情報
CPU型番: 簡単に言えば、CPUの発売時期によって、新しいモデルならAMDがIntelより優れ、古いモデルならIntelがAMDより優れています。
依存プロジェクト:[https://github.com/oneclickvirt/basics](https://github.com/oneclickvirt/basics) [https://github.com/oneclickvirt/gostun](https://github.com/oneclickvirt/gostun)
CPUコア数: 物理コアか論理コアかを検出し、優先的に物理コアを表示します。物理コアが検出できない場合のみ論理コアを表示します。サーバーの実際の使用では、プログラムは通常、論理コアに基づいて実行されます。ビデオエンコードや科学計算以外では、物理コアは通常ハイパースレッディングを有効にして論理コアとして使用されます。比較する際は、同じタイプのコア数を比較することが意味を持ちます。
**CPUモデル**: 一般的に、CPUのリリース時期に基づいて、新しいモデルではAMDがIntelより優れており、古いモデルではIntelがAMDより優れています。一方、AppleのMシリーズチップは圧倒的に優位に立っています。
CPUキャッシュホストマシンのCPU L1/L2/L3キャッシュ情報を表示します
**CPU数量**: 物理コアか論理コアかを検出し、物理コアの表示を優先します。物理コアが検出できない場合のみ論理コアを表示します。実際のサーバー使用において、プログラムは一般的に論理コアベースで実行が割り当てられます。動画変換や科学計算以外では、物理コアは通常ハイパースレッディングを有効にして論理コアとして使用されます。比較する際は、対応するコアタイプの数量のみが比較意義を持ちます。もちろん、一つが物理コア、もう一つが仮想コアで、CPUテストスコアが似ている場合、物理コアの方が明らかに優れており、CPU性能共有の問題を心配する必要はありません
AES-NI: 暗号化/復号化を高速化する命令セットです。これがあれば通常のネットワークリクエストがより速く、パフォーマンスが高くなります。ない場合はネットワークリクエスト(プロキシ用途を含む)に影響します。
**CPUキャッシュ**: ホストのCPU L3キャッシュ情報を表示します。一般的なアプリケーションにはあまり影響しないかもしれませんが、データベース、コンパイル、大規模な並行リクエストなどのシナリオでは、L3キャッシュサイズが性能に大きく影響します。
VM-x/AMD-V/Hyper-V: 現在のテスト環境がネステッド仮想化をサポートしているかどうかを示す指標です。テスト環境がDockerコンテナ内にあるか、root権限がない場合、デフォルトでは検出できず、ネステッド仮想化をサポートしていないと表示されます。この指標は、ホストマシン上で仮想マシンKVM、VirtualBox、VMwareなどを設定する必要がある場合に役立ちますが、他の用途ではあまり重要ではありません
**AES-NI**: AES命令セットは暗号化・復号化の高速化に使用され、HTTPSTLS/SSLネットワークリクエスト、VPNプロキシAES暗号化設定使用、ディスク暗号化などのシナリオで明らかな最適化を提供し、より高速でリソース効率的です
メモリ: 使用中サイズ/総サイズ のメモリを表示します。仮想メモリは含まれません
**VM-x/AMD-V/Hyper-V**: 現在のテストホストがネスト仮想化をサポートしているかどうかの指標です。テスト環境がDockerで実行されているか、root権限がない場合、デフォルトではネスト仮想化不サポートとして表示されます。この指標は、ホスト上で仮想マシンKVM、VirtualBox、VMwareなどを作成する必要がある場合に有用で、その他の用途では限定的です
バルーンドライバ: ホストマシンがバルーンドライバを使用しているかどうかを表示します。使用している場合は、親マシンがメモリを共有していることを示し、以下のメモリ読み書きテストと合わせて、オーバーセリング/厳しい制限があるかどうかを確認する必要があります
**メモリ**: メモリ使用量を現在使用中サイズ/総サイズで表示します。仮想メモリは含まれません
Kernel Same-page Merging: ホストマシンがKSMメモリマージを使用しているかどうかを表示します。使用している場合は、親マシンがメモリを共有していることを示し、以下のメモリ読み書きテストと合わせて、オーバーセリング/厳しい制限があるかどうかを確認する必要があります。
**バルーンドライバー**: ホストでバルーンドライバーが有効になっているかどうかを表示します。バルーンドライバーはホストと仮想マシン間での動的メモリ割り当てに使用され、ホストは仮想マシンに「収縮」してメモリの一部を解放するか、「膨張」してより多くのメモリを占有するよう要求できます。有効化は通常、ホストがメモリオーバーセリング機能を持っていることを意味しますが、実際にオーバーセリングが存在するかどうかは、下記のメモリ読み書きテストオーバーセリング/厳格な制限を確認する必要があります。
仮想メモリ: SWAP仮想メモリを表示します
**カーネルページマージ**: ホストでカーネルページマージ機能が有効になっているかどうかを表示します。KSMは複数のプロセスから同一内容のメモリページを1つにマージして物理メモリ使用量を削減します。有効化は通常、ホストがメモリ節約を実施しているか、ある程度のメモリオーバーセリングがあることを意味します。実際に性能影響やメモリ不足を引き起こすかどうかは、下記のメモリ読み書きテストでオーバーセリング/厳格な制限を確認する必要があります。
ディスク容量: 使用中サイズ/総サイズ のディスク容量を表示します
**仮想メモリ**: スワップ仮想メモリは、ディスク上に割り当てられた仮想メモリ空間で、物理メモリ不足時にデータを一時的に格納するために使用されます。メモリ不足によるプログラムクラッシュを防ぎますが、頻繁な使用はシステムを著しく遅くします。Linuxが公式推奨するスワップ設定は以下の通りです
ブートディスクパス:ブートディスクのパスを表示します
| 物理メモリサイズ | 推奨SWAPサイズ |
| ---------------- | -------------- |
| ≤ 2G | メモリの2倍 |
| 2G < メモリ ≤ 8G | 物理メモリサイズと同等 |
| ≥ 8G | 約8Gで十分 |
| 休止状態hibernation必要 | 最低でも物理メモリサイズと同等 |
OS: システム名とアーキテクチャを表示します
**ディスク容量**: ディスク使用量を現在使用中サイズ/総サイズで表示します
カーネル: システムカーネルバージョンを表示します
**起動ディスクパス**: 起動ディスクのパスを表示します
システム稼働時間: ホストマシンが起動してからテスト時までの稼働時間を表示します
**システム**: システム名とアーキテクチャを表示します
タイムゾーン: ホストマシンのシステムタイムゾーンを表示します
**カーネル**: システムカーネルバージョンを表示します
負荷: システム負荷を表示します
**システム稼働時間**: ホストの起動からテスト時点までの稼働時間を表示します
仮想化アーキテクチャ: ホストマシンがどの仮想化アーキテクチャから来ているかを表示します。一般的に ```Dedicated > KVM > Xen``` 仮想化が推奨されます。他の仮想化はパフォーマンス低下を引き起こし、使用時にパフォーマンス共有/損失が発生しますが、これも確実ではありません。専用サーバーのみが完全に独立したリソース占有を持ち、他の仮想化はほとんどリソース共有があります。これはホストマシンの販売者が良心的かどうかによって異なります。具体的なパフォーマンスの優劣は、後の専門テストを見る必要があります。
**タイムゾーン**: ホストシステムのタイムゾーンを表示します
NAT種類: NAT種類を表示します。具体的には ```Full Cone > Restricted Cone > Port Restricted Cone > Symmetric``` が推奨されます。検出できない場合は ```Inconclusive``` と表示されます。一般的に特別な用途(特殊なプロキシとリアルタイム通信の要件に関連する)に使用しない限り、この指標を気にする必要はありません。
**負荷**: システム負荷を表示します
TCP加速方式一般的に ```cubic/bbr``` 輻輳制御プロトコルです。一般的にプロキシサーバーとして使用する場合、bbrを使用するとネットワーク速度が改善されますが、通常の用途ではこの指標に注目する必要ありません
**仮想化アーキテクチャ**: ホストがどの仮想化アーキテクチャから来ているかを表示します。一般的に推奨順序:`Dedicated > KVM > Xen`仮想化。その他の仮想化は性能損失があり、使用時に性能共有/損失が発生しますが、これは断定的ではありません。専用サーバーのみが完全に独立したリソース占有を持ちます。その他の仮想化は基本的にリソース共有があり、ホスト保有者がこの仮想マシンに対して良心的かどうかに依存します。実際の性能優劣は後続の専門性能テストを見る必要ありま
IPV4/IPV6 ASN: ホストマシンのIPが属するASN組織IDと名前を表示します。同じIDCに複数のASNがある可能性があり、1つのASNの下に異なるIPセグメントのサーバーを販売する複数の業者がいる可能性があります。具体的な上流/下流関係は複雑です。bgp.toolを使用してさらに詳しく調べることができます
**NATタイプ**: NATタイプを表示します。具体的な推奨順序`Full Cone > Restricted Cone > Port Restricted Cone > Symmetric`。検出不可能または非標準プロトコルタイプは`Inconclusive`と表示されます。一般的に、特殊な用途、例えば特殊なプロキシ、リアルタイム通信、FRPポート転送などの需要がある場合のみ特別に注意が必要で、その他の一般状況では本指標に注意する必要はありません
IPV4/IPV6 ロケーション: データベース内の対応するプロトコルのIPの地理的位置を表示します
**TCP高速化方式**: 通常`cubic/bbr`輻輳制御プロトコルです。一般的に、プロキシサーバーでbbrを使用すると通信速度を改善できますが、普通の用途では本指標に注意する必要はありません
IPV4 アクティブIP: bgp.tools情報に基づいて、現在のCIDRチャンクのアクティブなネイバー数/総ネイバー数を照会する
**IPV4/IPV6 ASN**: ホストIPが属するASN組織IDと名前を表示します。同じIDCが複数のASNを持つ可能性があり、ASNの下に異なるIPセグメントのサーバーを販売する複数の業者がいる可能性があります。具体的な上下流関係は複雑で、bgp.toolでさらなる調査が可能です
### **CPUテスト**
**IPV4/IPV6 Location**: 対応プロトコルのIPのデータベース内地理位置を表示します。
コマンドラインパラメータを通じて```GeekBench```と```Sysbench```のテストを選択できます:
**IPV4 Active IPs**: bgp.tools情報に基づき、現在のCIDRブロック内のアクティブ近隣数/総近隣数を照会します。非リアルタイムのため遅延がある可能性があります。
**IPV6 サブネットマスク**: ホスト情報に基づいてローカルIPV6サブネットサイズを照会します。
### CPUテスト
依存プロジェクト:[https://github.com/oneclickvirt/cputest](https://github.com/oneclickvirt/cputest)
コマンドラインパラメータで`GeekBench`と`Sysbench`のテスト選択をサポートします:
| 比較項目 | sysbench | geekbench |
|------------------|----------|-----------|
|----------|----------|-----------|
| 適用範囲 | 軽量、ほぼすべてのサーバーで実行可能 | 重量級、小型マシンでは実行不可 |
| テスト要件 | ネットワーク不要、特別なハードウェア要件なし | ネットワーク必要、IPV4環境、最低1Gメモリ |
| オープンソース状況 | LUAベース、オープンソース、各アーキテクチャ版をコンパイル可能本プロジェクトはGoに再構築して内蔵) | 公式バイナリクローズドソース、自コンパイル不可 |
| テスト安定性 | コアテストコンポーネント10年以上変更なし | 各メジャーバージョンでテスト項目更新、スコアはバージョン間で比較困難(各バージョンは当時最高のCPUを基準 |
| テスト内容 | 計算性能のみテスト、素数計算ベース | 多様な性能テストカバー、スコアは重み付け計算、一部テストは実際にはあまり使用されない |
| 適用シーン | 迅速テストに適、計算性能のみテスト | 総合的全面テストに適 |
| テスト要件 | ネットワーク不要、特ハードウェア不要 | インターネット必要、IPV4環境、最低1Gメモリ |
| オープンソース状況 | LUAベース、オープンソース、各アーキテクチャ版を自分でコンパイル可能本プロジェクトはGo版を内蔵) | 公式バイナリクローズドソース、自分でコンパイル不可 |
| テスト安定性 | コアテストコンポーネント10年以上変更なし | 各メジャーバージョン更新でテスト項目変更、異なるバージョン間でスコア比較困難(各バージョンは現在最高のCPUを基準 |
| テスト内容 | 計算性能のみテスト、素数計算ベース | 多性能テストカバー、スコア加重計算、但し一部テストは実際には非常用 |
| 適用シナリオ | 迅速テストに適、計算性能のみテスト | 総合的全面的なテストに適 |
| ランキング | [sysbench.spiritlhl.net](https://sysbench.spiritlhl.net/) | [browser.geekbench.com](https://browser.geekbench.com/) |
デフォルトで```Sysbench```を使用してテストを行います。基準は概ね以下の通りです:
デフォルトで`Sysbench`でテストを行い、基準は大まかに以下の通りです:
CPUテストシングルコア```Sysbench```スコア5000以上なら第一ティア、40005000点なら第二ティア、1000点ごとに大体一ランクと考えられます。
CPUテストシングルコア`Sysbench`スコア5000以上は第一階層、4000-5000点は第二階層、1000点に大体一階層と考えられます。
AMD7950xシングルコアフルパフォーマンススコアは6500、AMD5950xシングルコアフルパフォーマンススコアは5700、Intelの通常のCPUE5など1000800、500未満のシングルコアCPUはパフォーマンスが比較的低いと言えます。
AMD 7950xシングルコアフル性能スコアは6500前後、AMD 5950xシングルコアフル性能スコアは5700前後、Intel普通のCPUE5などは1000~800前後、500以下のシングルコアCPUは性能が比較的劣ると言えます。
時々マルチコアスコアとシングルコアスコアが同じ場合があります。これは販売者がプログラムの並CPU使用を制限していることを示しています。典型的な例はTencent Cloudです。
時々マルチコアスコアとシングルコアスコアが同じになることがあり、これは者がプログラムの並CPU使用を制限していることを証明します。典型例はTencent Cloudです。
Sysbenchのベンチマークは[CPU Performance Ladder For Sysbench](https://sysbench.spiritlhl.net/)のラダーチャートで見ることができる
`Sysbench`の基準は[CPU Performance Ladder For Sysbench](https://sysbench.spiritlhl.net/)階層図で確認可能、具体的なスコアはテストしたsysbenchのバージョンに依存しません
```GeekBench```の基準は[公式ウェブサイト](https://browser.geekbench.com/processor-benchmarks/)階層チャートを参照してください。具体的なスコアは各```GeekBench```バージョンで異なるため、テスト時の```GeekBench```バージョンに注意してください。
`GeekBench`の基準は[公式サイト](https://browser.geekbench.com/processor-benchmarks/)階層図で確認可能、具体的なスコアは各`GeekBench`バージョンで異なり、使用時にテストした`GeekBench`バージョンに注意してください。
補足ですが、```GeekBench```テストする多くの内容は、サーバー使用過程で実際には必要ないことが多いです。テストは参考程度にしてください。もちろん```Sysbench```は非常に包括的ではありませんが、基本的な計算性能に基づいてCPUのパフォーマンスを大まかに比較できます。
もう一つ付け加えると、`GeekBench`テストする多くの内容が実際のサーバー使用過程では全く使われないため、テストは参考のみです。もちろん`Sysbench`は非常に不完全ですが、最も基本的な計算性能に基づいてCPUの性能を大まかに比較できます。
実際にはCPUパフォーマンスは十分であれば良く、科学計算やビデオエンコード以外では、特に高性能CPUを追求する必要はありません。
実際にはCPU性能テストは十分であれば良く、科学計算や動画変換以外では、特に高性能CPUを追求する必要は一般的にありません。性能需要がある場合は、プログラム自体がマルチコアかシングルコアを使うかに注意し、対応してマルチコアかシングルコアのスコアを見る必要があります。
### **メモリテスト**
### メモリテスト
一般的に、IO速度が```10240MB/s```未満かどうかを判断するだけで十分です。この値を下回る場合、メモリパフォーマンスが良くなく、オーバーセリング/オーバーコミットの問題がある可能性が非常に高いです。
依存プロジェクト:[https://github.com/oneclickvirt/memorytest](https://github.com/oneclickvirt/memorytest)
オーバーコミットの原因は、仮想メモリの使用ディスクをメモリとして使用、ZRAMCPUパフォーマンスを犠牲、バルーンドライバの使用、KSMメモリマージの使用など、様々な可能性があります。
一般的に、IO速度が`10240 MB/s (≈10 GB/s)`を下回るかどうかを判断するだけで十分です。
この値を下回る場合、メモリ性能が不良で、オーバーセリング問題が存在する可能性が極めて高いことを証明します。
### **ディスクテスト**
オーバーセリングの原因は以下が考えられます:
```dd```テストは誤差が大きい可能性がありますが、テスト速度が速くディスクサイズ制限がありません。```fio```テストはより現実的ですが、テスト速度が遅く、ディスクおよびメモリサイズの最低要件があります。
* 仮想メモリの有効化(ディスクをメモリとして使用)
* ZRAMの有効化CPU性能を犠牲
* バルーンドライバーの有効化
* KSMメモリ融合の有効化
同時に、サーバーには異なるファイルシステムがある可能性があり、特定のファイルシステムのIOエンジンは同じハードウェア条件下でも読み書き速度が速くなる場合があります。これは正常です。プロジェクトはデフォルトで```fio```を使用してテストを行います。テストに使用されるIOエンジンの優先順位は```libaio > posixaio > psync```です。代替オプションの```dd```テストは```fio```テストが利用できない場合に自動的に置き換えられます。
原因は多種多様です。
```fio```テスト結果を例に基準は以下の通りです:
| メモリタイプ | 典型的周波数 (MHz) | シングルチャネル帯域幅 | デュアルチャネル帯域幅 |
| ----------- | ------------------ | -------------------- | -------------------- |
| DDR3 | 1333 ~ 2133 | 10 ~ 17 GB/s (≈ 10240 ~ 17408 MB/s) | 20 ~ 34 GB/s (≈ 20480 ~ 34816 MB/s) |
| DDR4 | 2133 ~ 3200 | 17 ~ 25 GB/s (≈ 17408 ~ 25600 MB/s) | 34 ~ 50 GB/s (≈ 34816 ~ 51200 MB/s) |
| DDR5 | 4800 ~ 7200 | 38 ~ 57 GB/s (≈ 38912 ~ 58368 MB/s) | 76 ~ 114 GB/s (≈ 77824 ~ 116736 MB/s) |
| OSタイプ | 主要指標 | 副次指標 |
|---------|-------------------|---------------------|
| Windows/Mac | 4K読み → 64K読み → 書き込みテスト | グラフィカルインターフェースシステムは読み取りパフォーマンスを優先 |
| Linux (GUIなし) | 4K読み + 4K書き + 1M読み書き| 読み/書き値は通常類似 |
上表内容に基づく、本プロジェクトテストの粗略判断方法:
以下のディスクタイプの指標値は、通常〜フルパフォーマンス状態を示し、```libaio```をIOテストエンジンとして使用し、```Linux```でテストを実施した場合を指します:
* **< 20 GB/s (20480 MB/s)** → DDR3の可能性またはDDR4シングルチャネル/低周波数)
* **20 ~ 40 GB/s (20480 ~ 40960 MB/s)** → 高確率でDDR4
* **≈ 50 GB/s (≈ 51200 MB/s)** → 基本的にDDR5
| ドライブタイプ | 4K(IOPS)パフォーマンス | 1M(IOPS)パフォーマンス |
|------------|--------------------------|----------------------|
### ディスクテスト
依存プロジェクト:[https://github.com/oneclickvirt/disktest](https://github.com/oneclickvirt/disktest)
`dd`テストは誤差が大きい可能性がありますが、テスト速度が速くディスクサイズ制限がありません。`fio`テストはより現実的ですが、テスト速度が遅く、ディスクおよびメモリサイズの最低要件があります。
同時に、サーバーは異なるファイルシステムを持つ可能性があり、一部のファイルシステムのIOエンジンは同じハードウェア条件下でテストの読み書き速度がより速く、これは正常です。プロジェクトはデフォルトで`fio`でテストを行い、使用するIOエンジンの優先度は`libaio > posixaio > psync`、代替オプション`dd`テストは`fio`テストが使用不可能時に自動置換されます。
`fio`テスト結果を例に基準は以下の通りです:
| OS タイプ | 主要指標 | 次要指標 |
|----------|----------|----------|
| Windows/MacOS | 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 |
| HDD機械式ハードディスク| 10-40 MB/s | 500-600 MB/s |
| 性能不良 | < 10 MB/s | < 200 MB/s |
迅速評価
迅速評価
1. **主要チェック**: 4K読み(IOPS) 4K書き(IOPS)
- ほぼ同じで大きな差がな
1. **主要チェック**: 4K読み取り (IOPS) 4K書き込み (IOPS)
- ほぼ同じで差は小さ
- 200 MB/s = NVMe SSD
- 50-100 MB/s = 標準SSD
- 10-40 MB/s = HDD (機械式ハードディスク)
- < 10 MB/s = 性能不良、オーバーセリング/制限が深刻
- 10-40 MB/s = HDD機械式ハードディスク
- < 10 MB/s = ゴミ性能、オーバーセリング/制限が深刻
2. **次チェック**: 1M(IOPS)
- プロバイダが設定したIO制限
- リソースオーバーコミット状況
- 値が高いほど良い
- NVMe SSDは通常4-6 GB/s達成
- 標準SSDは通常1-2 GB/s達成
2. **次チェック**: 1M (IOPS)
- プロバイダが設定したIO制限
- リソースオーバーセリング状況
- 値が高いほど良い
- NVMe SSDは通常4-6 GB/sに達する
- 標準SSDは通常1-2 GB/sに達する
NVMe SSDの1M(IOPS)< 1GB/sの場合深刻なリソースオーバーコミットが存在することを示します
NVMe SSDの1M (IOPS) < 1GB/s の場合深刻なリソースオーバーセリングが存在することを示します
注意ここでテストされるのは実際のIOであり本プロジェクト限定されま本プロジェクト以外テストによるIOは基準の普遍性を保証できません他のテストでは同じパラメータを使用していない可能性がありIO直接読み書きを設定していない可能性IOエンジン設定が一致しない可能性テスト時間設定が一致しない可能性がありこれらはすべて基準にズレを生じさせる原因となります
注意ここでテストるのはのIOで本プロジェクト限定本プロジェクト以外テストしたIOは基準の汎用性を保証ません彼らがテスト時に同じパラメータを使用していない可能性IO直接読み書きを設定していない可能性IOエンジン設定が一致しない可能性テスト時間設定が一致しない可能性がありすべて基準の偏差を引き起こします
### **ストリーミングメディアロック解除**
### ストリーミングメディアロック解除
一般的なストリーミングメディアプラットフォームのロック解除を検索しますもちろんすべてがストリーミングメディアというわけではなく他の一般的なプラットフォームのロック解除も含まれています一般的にIPのロック解除地域は一貫しておりあちこちに変動することはありません複数のプラットフォームでロック解除地域が一致しない場合そのIPはIPXOなどのプラットフォームからレンタルされている可能性が高く各プラットフォームのデータベース識別が遅いためIP品質も一般的に良くないと考えられます
依存プロジェクト[https://github.com/oneclickvirt/CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests) [https://github.com/lmc999/RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck)
### **IP品質検出**
デフォルトでは国境を越えるストリーミングメディアのロック解除のみをチェックします
14のデータベースのIP関連情報を検出します一般的に使用タイプ会社タイプおよびその他のセキュリティ情報の判別を見るだけで十分ですセキュリティスコアは参考程度です複数のプラットフォームで対応する検出項目が一致している場合現在のIPが確かにそうであることを証明しています単一のデータベースソースの情報だけを信頼しないでください
一般的に正常な状況下では一つのIPの複数のストリーミングメディアのロック解除地域はすべて一致しあちこち飛び回ることはありません複数のプラットフォームでロック解除地域が一致しない場合IPはIPXOなどのプラットフォームからのレンタルか最近宣告され使用されたものでストリーミングメディアの一般的なデータベースに認識修正されていない可能性が高いです各プラットフォームのIPデータベース認識速度が一致しないため時々あるプラットフォームではロック解除地域が正常あるプラットフォームではルート上のある位置に飛ぶあるプラットフォームではIPがあなたによって使用される前にいた位置に飛ぶことがあります
### **メールポート検出**
| DNS タイプ | ロック解除方式判断の必要性 | DNSのロック解除への影響 | 説明 |
| --------- | ------------------------- | ---------------------- | ---- |
| 公式主流DNS | 不要 | | ストリーミングメディアのロック解除は主にードIPに依存しDNS解析は基本的にロック解除を干渉しない |
| 非主流/自建DNS | 必要 | | ストリーミングメディアのロック解除結果はDNS解析の影響を大きく受けネイティブロック解除かDNSロック解除かを判断する必要がある |
- **SMTP25**メールサーバー間でメールを転送するために使用されますメール送信
- **SMTPS465**暗号化されたSMTPメール送信SSL/TLS方式に使用されます
- **SMTP587**クライアントからメールサーバーへのメール送信に使用されSTARTTLS暗号化をサポートします
- **POP3110**メールクライアントがサーバーからメールをダウンロードするために使用され暗号化されていません
- **POP3S995**暗号化されたPOP3用で安全にメールをダウンロードしますSSL/TLS方式)。
- **IMAP143**メールクライアントがオンラインでメールを管理するために使用されますメールの閲覧同期)、暗号化されていません
- **IMAPS993**暗号化されたIMAP用で安全にメールを管理しますSSL/TLS方式)。
そのためテスト過程でホストが現在使用しているのが公式主流のDNSの場合ネイティブロック解除かどうかの判断は行われません
具体的に現在のホストマシンがメールサーバーとして使用されていないまたは電子メールを受信しない場合この項目の指標は気にする必要はありません
### IP品質検出
---
依存プロジェクト[https://github.com/oneclickvirt/securityCheck](https://github.com/oneclickvirt/securityCheck)
14のデータベースのIP関連情報を検出します一般的に使用タイプと会社タイプそしてセキュリティ情報のその他識別を見れば十分でセキュリティスコアは本当にお遊びです複数のプラットフォームで対応する検出項目がすべて対応する値になっている場合現在のIPが確実にそうであることを証明します一つのデータベースソースの情報のみを信じてはいけません
* **使用タイプ & 会社タイプ**: IP帰属と使用シナリオを表示し例えば家庭ユーザー企業オフィスホスティングサービスまたはクラウド/データセンターに属するかどうか
* **クラウドプロバイダー / データセンター / モバイルデバイス**: IPがクラウドサービスデータセンターまたはモバイルネットワークから来ているかを判断し共有または高リスクIPの識別に役立つ
* **プロキシ / VPN / Tor / Tor出口**: IPが真の身元や位置を隠すために使用されているかを検出し匿名アクセスや悪用行為に関与している可能性がある
* **ネットワーククローラー / ロボット**: 自動化されたアクセスまたは収集プログラムを識別しセキュリティリスク評価に参考価値がある
* **匿名 / 悪用者 / 脅威 / 中継 / Bogon**: IP履歴行動特徴と予約/未割り当てIPに属するかどうかを表示しIP信頼度判断を補助
* **セキュリティスコア評判信頼スコア脅威スコア詐欺スコア悪用スコア**: 各データベースのIPに対する定量化されたセキュリティ評価参考のみ
* **コミュニティ投票 & ブラックリスト記録**: ユーザーフィードバックと公共ブラックリスト情報を展示し潜在的リスクを迅速に識別可能
* **Google検索実行可能性**: IPがGoogle検索サービスにアクセスする実行可能性を検出しネットワーク制限やブロック状況を間接的に反映
マルチプラットフォーム比較がより信頼性が高く異なるデータベースのアルゴリズムと更新頻度が異なるため単一ソースは誤判断の可能性があります複数のデータベースが類似の結果を示す場合その結果はより信頼性が高いことを説明します
### メールポート検出
依存プロジェクト[https://github.com/oneclickvirt/portchecker](https://github.com/oneclickvirt/portchecker)
- **SMTP (25)**: メールサーバー間でのメール転送メール送信に使用
- **SMTPS (465)**: 暗号化されたSMTPメール送信SSL/TLS方式に使用
- **SMTP (587)**: クライアントからメールサーバーへのメール送信STARTTLS暗号化をサポート
- **POP3 (110)**: メールクライアントがサーバーからメールをダウンロードするために使用暗号化なし
- **POP3S (995)**: 暗号化されたPOP3安全にメールをダウンロードSSL/TLS方式に使用
- **IMAP (143)**: メールクライアントがオンラインでメール管理メール閲覧同期)、暗号化なし
- **IMAPS (993)**: 暗号化されたIMAP安全にメール管理SSL/TLS方式に使用
現在のホストがメール局として機能せず電子メールの送受信を行わない場合この項目指標は無視して構いません
### 近隣スピードテスト
依存プロジェクト[https://github.com/oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
まず公式推奨の測定ポイントをテストし次に代表的な国際測定ポイントをテストします
公式測定ポイントはテスト対象のホストマシンのローカル帯域幅ベースラインを表すことができます
日常的には1Gbps帯域幅のサーバーを使用することを好みます少なくとも依存関係のダウンロードなどの速度が十分に速いからです

View File

@@ -8,36 +8,30 @@ import (
)
func DiskTest(language, testMethod, testPath string, isMultiCheck bool, autoChange bool) (realTestMethod, res string) {
if runtime.GOOS == "windows" {
if testMethod != "winsat" && testMethod != "" {
// res = "Detected host is Windows, using Winsat for testing.\n"
realTestMethod = "winsat"
}
res = disk.WinsatTest(language, isMultiCheck, testPath)
} else {
switch testMethod {
case "fio":
res = disk.FioTest(language, isMultiCheck, testPath)
if res == "" && autoChange {
// res = "Fio test failed, switching to DD for testing.\n"
res += disk.DDTest(language, isMultiCheck, testPath)
realTestMethod = "dd"
} else {
realTestMethod = "fio"
}
case "dd":
res = disk.DDTest(language, isMultiCheck, testPath)
if res == "" && autoChange {
// res = "DD test failed, switching to Fio for testing.\n"
res += disk.FioTest(language, isMultiCheck, testPath)
realTestMethod = "fio"
} else {
realTestMethod = "dd"
}
default:
// res = "Unsupported test method specified, switching to DD for testing.\n"
switch testMethod {
case "fio":
res = disk.FioTest(language, isMultiCheck, testPath)
if res == "" && autoChange {
res += disk.DDTest(language, isMultiCheck, testPath)
realTestMethod = "dd"
} else {
realTestMethod = "fio"
}
case "dd":
res = disk.DDTest(language, isMultiCheck, testPath)
if res == "" && autoChange {
res += disk.FioTest(language, isMultiCheck, testPath)
realTestMethod = "fio"
} else {
realTestMethod = "dd"
}
default:
if runtime.GOOS == "windows" {
realTestMethod = "winsat"
res = disk.WinsatTest(language, isMultiCheck, testPath)
} else {
res = disk.DDTest(language, isMultiCheck, testPath)
realTestMethod = "dd"
}
}
if !strings.Contains(res, "\n") && res != "" {

18
go.mod
View File

@@ -6,17 +6,17 @@ require (
github.com/imroc/req/v3 v3.54.0
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841
github.com/oneclickvirt/UnlockTests v0.0.28-20250727155204
github.com/oneclickvirt/backtrace v0.0.6-20250801151556
github.com/oneclickvirt/basics v0.0.15-20250728021329
github.com/oneclickvirt/backtrace v0.0.7-20250811023541
github.com/oneclickvirt/basics v0.0.15-20250812130523
github.com/oneclickvirt/cputest v0.0.12-20250720122317
github.com/oneclickvirt/defaultset v0.0.2-20240624082446
github.com/oneclickvirt/disktest v0.0.9-20250801101625
github.com/oneclickvirt/disktest v0.0.10-20250924030424
github.com/oneclickvirt/gostun v0.0.5-20250727155022
github.com/oneclickvirt/memorytest v0.0.9-20250720135728
github.com/oneclickvirt/nt3 v0.0.6-20250726150925
github.com/oneclickvirt/memorytest v0.0.9-20250808065154
github.com/oneclickvirt/nt3 v0.0.8-20250811123903
github.com/oneclickvirt/pingtest v0.0.8-20250728015259
github.com/oneclickvirt/portchecker v0.0.3-20250728015900
github.com/oneclickvirt/security v0.0.6-20250727160145
github.com/oneclickvirt/security v0.0.6-20250823030124
github.com/oneclickvirt/speedtest v0.0.10-20250728015734
)
@@ -58,9 +58,9 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxtrace/NTrace-core v1.4.2 // indirect
github.com/oneclickvirt/dd v0.0.2-20250701085922 // indirect
github.com/oneclickvirt/fio v0.0.2-20250701085933 // indirect
github.com/oneclickvirt/mbw v0.0.1-20250630140849 // indirect
github.com/oneclickvirt/dd v0.0.2-20250808062818 // indirect
github.com/oneclickvirt/fio v0.0.2-20250808045755 // indirect
github.com/oneclickvirt/mbw v0.0.1-20250808061222 // indirect
github.com/oschwald/maxminddb-golang v1.13.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pion/dtls/v2 v2.2.7 // indirect

36
go.sum
View File

@@ -98,34 +98,34 @@ github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841 h1:Zef93z9UiZQwRA
github.com/oneclickvirt/CommonMediaTests v0.0.4-20250329123841/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
github.com/oneclickvirt/UnlockTests v0.0.28-20250727155204 h1:apFaEbHGKflYMZzK17nXzEai4GG873mTd+d9hCO/KdY=
github.com/oneclickvirt/UnlockTests v0.0.28-20250727155204/go.mod h1:oOa6wj/qECtRMxwBO6D7o0L0F0Q/5sQ747OCnFQqoGE=
github.com/oneclickvirt/backtrace v0.0.6-20250801151556 h1:qxCHjNkaUH2z4buO5qrqqXE1XPB0bTU3wfkCEp8G51w=
github.com/oneclickvirt/backtrace v0.0.6-20250801151556/go.mod h1:/+KUtOWz48TyiTTbhVTsp3D6b5WY+4pCgvFBYtUGtns=
github.com/oneclickvirt/basics v0.0.15-20250728021329 h1:bXat5W1twZdOdzJ15BFZUYsjAEcTH9ly9oMDIg5+Rbo=
github.com/oneclickvirt/basics v0.0.15-20250728021329/go.mod h1:2PV+1ge01zb0Sqzj2V2I7P0wAdFSLF1XgAiumchJJbg=
github.com/oneclickvirt/backtrace v0.0.7-20250811023541 h1:GzkzvUC6U9b6Dkz/Bl4JRPeQ7XBGoW7Qw1aWqzhF+MQ=
github.com/oneclickvirt/backtrace v0.0.7-20250811023541/go.mod h1:/+KUtOWz48TyiTTbhVTsp3D6b5WY+4pCgvFBYtUGtns=
github.com/oneclickvirt/basics v0.0.15-20250812130523 h1:nPNTVq8d9N1rdshkMAbnhZxTb7L2Yt7NlIg6rY10YRQ=
github.com/oneclickvirt/basics v0.0.15-20250812130523/go.mod h1:2PV+1ge01zb0Sqzj2V2I7P0wAdFSLF1XgAiumchJJbg=
github.com/oneclickvirt/cputest v0.0.12-20250720122317 h1:toiwAK1hZE5b8klu2mOQ7J4sv5yV9lpPKwgPahfRYBQ=
github.com/oneclickvirt/cputest v0.0.12-20250720122317/go.mod h1:vjlH8tkPFft1tlLOpeNskXVvurxkHaJ3+dgFxQGLXY4=
github.com/oneclickvirt/dd v0.0.2-20250701085922 h1:WiWZwcnCPhRc8hLZdvkjD2kOEpnqn1S31z1j0x3V4l0=
github.com/oneclickvirt/dd v0.0.2-20250701085922/go.mod h1:tImu9sPTkLWo2tf1dEN1xQzrylWKauj9hbU8PHfyAeU=
github.com/oneclickvirt/dd v0.0.2-20250808062818 h1:0KHrKkdpL5oBE1OHsrRd2siRw4/2k6f9LBaP7T4JpOc=
github.com/oneclickvirt/dd v0.0.2-20250808062818/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.9-20250801101625 h1:N8sAZrziexT/4qqVwK1hIvXrIKjAinsGdQ9ceumBxNo=
github.com/oneclickvirt/disktest v0.0.9-20250801101625/go.mod h1:6YCvGr+Z0tvcP4Ue8bezZqm/GqS/dSyEnSUhvS3Q03o=
github.com/oneclickvirt/fio v0.0.2-20250701085933 h1:4P7QcOTxbqyx5DhHdFvyeRSsdNajSo9l/H2XK0vICIc=
github.com/oneclickvirt/fio v0.0.2-20250701085933/go.mod h1:NIq+XYTey68KNERGIy/oRDlzpwLzBVoHOCiqX8didsE=
github.com/oneclickvirt/disktest v0.0.10-20250924030424 h1:56Aq2xygO/vA/co5vJ7/MQTNijIDl8eYbVk8uCWN4mI=
github.com/oneclickvirt/disktest v0.0.10-20250924030424/go.mod h1:Vp3iMVBD4ccReDJz5n5SlzUdq0kDuVhpRklQk21KT+8=
github.com/oneclickvirt/fio v0.0.2-20250808045755 h1:eWihCRWcalJjPIdrF8dMe68ZiPnMkSfHC8ENvElp/xE=
github.com/oneclickvirt/fio v0.0.2-20250808045755/go.mod h1:NIq+XYTey68KNERGIy/oRDlzpwLzBVoHOCiqX8didsE=
github.com/oneclickvirt/gostun v0.0.5-20250727155022 h1:/e3gSUrOp1tg/1NTRx+P8B51OGcP26Q6//5EoSIjOvk=
github.com/oneclickvirt/gostun v0.0.5-20250727155022/go.mod h1:pfp7MFZJK9n/KTLAVqqFcCAns4xqMykmjI+1UeF/vdE=
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.9-20250720135728 h1:RusZfaESDXK+k5YYfVXTCW5zLeQEd/dYY80a6xievE0=
github.com/oneclickvirt/memorytest v0.0.9-20250720135728/go.mod h1:7xMacjQobvFAtODht2hxTsB9hM2IFS7vZk3gxx+bsjo=
github.com/oneclickvirt/nt3 v0.0.6-20250726150925 h1:M+9kEpMp+O2a//yp9zJ11DleK7hxEmFd5jOWKNrSlmY=
github.com/oneclickvirt/nt3 v0.0.6-20250726150925/go.mod h1:O7YkaOMFihB8hwQiD74WTbDlyoTieDwTDBR6jbkZaP0=
github.com/oneclickvirt/mbw v0.0.1-20250808061222 h1:WGXOe6QvHiDRhPVMI0VcctjzW08kGvJf50yq5YeZCtw=
github.com/oneclickvirt/mbw v0.0.1-20250808061222/go.mod h1:0Vq6NRpyLmGUdfHfL3uDcFsuZhi7KlG+OCs5ky2757Y=
github.com/oneclickvirt/memorytest v0.0.9-20250808065154 h1:mjYOvpFz2mpDU9MNjj66oIDcc2r6+zoW8veP616/+4Q=
github.com/oneclickvirt/memorytest v0.0.9-20250808065154/go.mod h1:DBxiVZX7mWCe0Fy+qu57ENheLo00sLfjKzvxiICrUtU=
github.com/oneclickvirt/nt3 v0.0.8-20250811123903 h1:ubSPLh/DSrXj+tOgmRABgi2vrVmbmjjSne+NrVFNmNc=
github.com/oneclickvirt/nt3 v0.0.8-20250811123903/go.mod h1:F1v+6xInBKnbUa8gV1M40R1HOzxg+obtduNhx3CTnmA=
github.com/oneclickvirt/pingtest v0.0.8-20250728015259 h1:egoxZRZBOWN3JqBwqEsULDyRo2/dpGMeWcmV3U87zig=
github.com/oneclickvirt/pingtest v0.0.8-20250728015259/go.mod h1:gxwsxxwitNQiGq2OI0ZogYoOLwc8DtuOdSRe6/EvRqs=
github.com/oneclickvirt/portchecker v0.0.3-20250728015900 h1:AomzdppSOFB70AJESQhlp0IPbsHTTJGimAWDk2TzCWM=
github.com/oneclickvirt/portchecker v0.0.3-20250728015900/go.mod h1:9sjMDPCd4Z40wkYB0S9gQPGH8YPtnNE1ZJthVIuHUzA=
github.com/oneclickvirt/security v0.0.6-20250727160145 h1://sqEyAITvv04zXZwWurTkMDMD4nUAl7Wukj5lEDALI=
github.com/oneclickvirt/security v0.0.6-20250727160145/go.mod h1:WpzPJsQFP0uOHmUUsqT9sjNhD5b+1LFd90HiM8cz4nM=
github.com/oneclickvirt/security v0.0.6-20250823030124 h1:3RjpJNfKV7anN6GJs0ky2BfXFHPUVrDxUomEqoB0x7I=
github.com/oneclickvirt/security v0.0.6-20250823030124/go.mod h1:RSMooIlb4H/kLrGWNvUyOgdzQKgYKVv+LzWGlsPsLW4=
github.com/oneclickvirt/speedtest v0.0.10-20250728015734 h1:HKO7/JQ74ueXA8Wo8NIvcK9DphbEG/YTfAAVz/akSiY=
github.com/oneclickvirt/speedtest v0.0.10-20250728015734/go.mod h1:0W8vnMbA3iucXLXFdGfe9Ia6RPS0izRO7jvu/SnH1P8=
github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE=

175
goecs.go
View File

@@ -24,6 +24,7 @@ import (
"github.com/oneclickvirt/ecs/cputest"
"github.com/oneclickvirt/ecs/disktest"
"github.com/oneclickvirt/ecs/memorytest"
"github.com/oneclickvirt/ecs/nexttrace"
"github.com/oneclickvirt/ecs/speedtest"
"github.com/oneclickvirt/ecs/unlocktest"
"github.com/oneclickvirt/ecs/upstreams"
@@ -31,7 +32,6 @@ import (
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"
@@ -39,7 +39,7 @@ import (
)
var (
ecsVersion = "v0.1.72"
ecsVersion = "v0.1.88"
menuMode bool
onlyChinaTest bool
input, choice string
@@ -59,7 +59,7 @@ var (
autoChangeDiskTestMethod = true
filePath = "goecs.txt"
enabelUpload = true
help bool
onlyIpInfoCheckStatus, help bool
goecsFlag = flag.NewFlagSet("goecs", flag.ContinueOnError)
finish bool
)
@@ -99,7 +99,7 @@ func getMenuChoice(language string) string {
if re.MatchString(input) {
inChoice := input
switch inChoice {
case "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
return inChoice
default:
if language == "zh" {
@@ -143,7 +143,7 @@ func parseFlags() {
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")
goecsFlag.StringVar(&nt3Location, "nt3loc", "GZ", "Specify NT3 test location (supported: GZ, SH, BJ, CD for Guangzhou, Shanghai, Beijing, Chengdu)")
goecsFlag.StringVar(&nt3Location, "nt3loc", "GZ", "Specify NT3 test location (supported: GZ, SH, BJ, CD, ALL for Guangzhou, Shanghai, Beijing, Chengdu and all)")
goecsFlag.StringVar(&nt3CheckType, "nt3t", "ipv4", "Set NT3 test type (supported: both, ipv4, ipv6)")
goecsFlag.IntVar(&spNum, "spnum", 2, "Set the number of servers per operator for speed test")
goecsFlag.BoolVar(&enableLogger, "log", false, "Enable/Disable logging in the current path")
@@ -185,11 +185,13 @@ func handleMenuMode(preCheck utils.NetCheckResult) {
commTestStatus, utTestStatus, securityTestStatus, emailTestStatus = false, false, false, false
backtraceStatus, nt3Status, speedTestStatus = false, false, false
autoChangeDiskTestMethod = true
printMenuOptions()
printMenuOptions(preCheck)
Loop:
for {
choice = getMenuChoice(language)
switch choice {
case "0":
os.Exit(0)
case "1":
setFullTestStatus(preCheck)
onlyChinaTest = utils.CheckChina(enableLogger)
@@ -235,6 +237,7 @@ Loop:
fmt.Println("Can not test without network connection!")
return
}
nt3Location = "ALL"
setRouteTestStatus()
break Loop
default:
@@ -243,23 +246,83 @@ Loop:
}
}
func printMenuOptions() {
func printMenuOptions(preCheck utils.NetCheckResult) {
var stats *utils.StatsResponse
var statsErr error
var githubInfo *utils.GitHubRelease
var githubErr error
// 只有在网络连接正常时才获取统计信息和版本信息
if preCheck.Connected {
var pwg sync.WaitGroup
pwg.Add(2)
go func() {
defer pwg.Done()
stats, statsErr = utils.GetGoescStats()
}()
go func() {
defer pwg.Done()
githubInfo, githubErr = utils.GetLatestEcsRelease()
}()
pwg.Wait()
} else {
statsErr = fmt.Errorf("network not connected")
githubErr = fmt.Errorf("network not connected")
}
var statsInfo string
var cmp int
if preCheck.Connected {
// 网络连接正常时处理统计信息和版本比较
if statsErr != nil {
statsInfo = "NULL"
} else {
switch language {
case "zh":
statsInfo = fmt.Sprintf("总使用量: %s | 今日使用: %s",
utils.FormatGoecsNumber(stats.Total),
utils.FormatGoecsNumber(stats.Daily))
case "en":
statsInfo = fmt.Sprintf("Total Usage: %s | Daily Usage: %s",
utils.FormatGoecsNumber(stats.Total),
utils.FormatGoecsNumber(stats.Daily))
}
}
if githubErr == nil {
cmp = utils.CompareVersions(ecsVersion, githubInfo.TagName)
} else {
cmp = 0
}
}
switch language {
case "zh":
fmt.Println("VPS融合怪版本: ", ecsVersion)
fmt.Println("1. 融合怪完全体")
fmt.Printf("VPS融合怪版本: %s\n", ecsVersion)
if preCheck.Connected {
switch cmp {
case -1:
fmt.Printf("检测到新版本 %s 如有必要请更新!\n", githubInfo.TagName)
}
fmt.Printf("使用统计: %s\n", statsInfo)
}
fmt.Println("1. 融合怪完全体(能测全测)")
fmt.Println("2. 极简版(系统信息+CPU+内存+磁盘+测速节点5个)")
fmt.Println("3. 精简版(系统信息+CPU+内存+磁盘+常用流媒体+路由+测速节点5个)")
fmt.Println("4. 精简网络版(系统信息+CPU+内存+磁盘+回程+路由+测速节点5个)")
fmt.Println("5. 精简解锁版(系统信息+CPU+内存+磁盘IO+御三家+常用流媒体+测速节点5个)")
fmt.Println("6. 网络单项(IP质量检测+三网回程+三网路由与延迟+测速节点11个)")
fmt.Println("6. 网络单项(IP质量检测+上游及三网回程+广州三网回程详细路由+全国延迟+测速节点11个)")
fmt.Println("7. 解锁单项(御三家解锁+常用流媒体解锁)")
fmt.Println("8. 硬件单项(系统信息+CPU+内存+dd磁盘测试+fio磁盘测试)")
fmt.Println("9. IP质量检测(15个数据库的IP检测+邮件端口检测)")
fmt.Println("10. 三网回程线路+广州三网路由+全国三网延迟")
fmt.Println("8. 硬件单项(系统信息+CPU+dd磁盘测试+fio磁盘测试)")
fmt.Println("9. IP质量检测(15个数据库的IP质量检测+邮件端口检测)")
fmt.Println("10. 三网回程线路检测+三网回程详细路由(北京上海广州成都)+三网延迟测试(全国)")
fmt.Println("0. 退出程序")
case "en":
fmt.Println("VPS Fusion Monster Test Version: ", ecsVersion)
fmt.Println("1. VPS Fusion Monster Test Comprehensive Test Suite")
fmt.Printf("VPS Fusion Monster Test Version: %s\n", ecsVersion)
if preCheck.Connected {
switch cmp {
case -1:
fmt.Printf("New version detected %s update if necessary!\n", githubInfo.TagName)
}
fmt.Printf("%s\n", statsInfo)
}
fmt.Println("1. VPS Fusion Monster Test (Full Test)")
fmt.Println("2. Minimal Test Suite (System Info + CPU + Memory + Disk + 5 Speed Test Nodes)")
fmt.Println("3. Standard Test Suite (System Info + CPU + Memory + Disk + Basic Unlock Tests + 5 Speed Test Nodes)")
fmt.Println("4. Network-Focused Test Suite (System Info + CPU + Memory + Disk + 5 Speed Test Nodes)")
@@ -268,6 +331,7 @@ func printMenuOptions() {
fmt.Println("7. Unlock-Only Test (Basic Unlock Tests + Common Streaming Services Unlock)")
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)")
fmt.Println("0. Exit Program")
}
}
@@ -334,16 +398,18 @@ func setUnlockFocusedTestStatus(preCheck utils.NetCheckResult) {
}
func setNetworkOnlyTestStatus() {
onlyIpInfoCheckStatus = true
securityTestStatus = true
speedTestStatus = true
backtraceStatus = true
nt3Status = true
pingTestStatus = true
}
func setUnlockOnlyTestStatus() {
onlyIpInfoCheckStatus = true
commTestStatus = true
utTestStatus = true
enabelUpload = false
}
func setHardwareOnlyTestStatus(preCheck utils.NetCheckResult) {
@@ -357,15 +423,16 @@ func setHardwareOnlyTestStatus(preCheck utils.NetCheckResult) {
}
func setIPQualityTestStatus() {
onlyIpInfoCheckStatus = true
securityTestStatus = true
emailTestStatus = true
}
func setRouteTestStatus() {
onlyIpInfoCheckStatus = true
backtraceStatus = true
nt3Status = true
pingTestStatus = true
enabelUpload = false
}
func printInvalidChoice() {
@@ -386,7 +453,7 @@ func handleLanguageSpecificSettings() {
}
}
func handleSignalInterrupt(sig chan os.Signal, startTime *time.Time, output *string, tempOutput string, uploadDone chan bool, outputMutex *sync.Mutex) {
func handleSignalInterrupt(sig chan os.Signal, startTime *time.Time, output *string, _ string, uploadDone chan bool, outputMutex *sync.Mutex) {
select {
case <-sig:
if !finish {
@@ -467,11 +534,14 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGrou
*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)
if onlyIpInfoCheckStatus && !basicStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
*output = runIpInfoCheck(*output, tempOutput, outputMutex)
}
if utTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" && !onlyChinaTest {
wg1.Add(1)
go func() {
defer wg3.Done()
*ptInfo = pt.PingTest()
defer wg1.Done()
*mediaInfo = unlocktest.MediaTest(language)
}()
}
if emailTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
@@ -481,11 +551,11 @@ func runChineseTests(preCheck utils.NetCheckResult, wg1, wg2, wg3 *sync.WaitGrou
*emailInfo = email.EmailCheck()
}()
}
if utTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" && !onlyChinaTest {
wg1.Add(1)
if (onlyChinaTest || pingTestStatus) && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
wg3.Add(1)
go func() {
defer wg1.Done()
*mediaInfo = unlocktest.MediaTest(language)
defer wg3.Done()
*ptInfo = pt.PingTest()
}()
}
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
@@ -507,6 +577,9 @@ func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, ba
*output = runCPUTest(*output, tempOutput, outputMutex)
*output = runMemoryTest(*output, tempOutput, outputMutex)
*output = runDiskTest(*output, tempOutput, outputMutex)
if onlyIpInfoCheckStatus && !basicStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
*output = runIpInfoCheck(*output, tempOutput, outputMutex)
}
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
if utTestStatus {
wg1.Add(1)
@@ -530,6 +603,24 @@ func runEnglishTests(preCheck utils.NetCheckResult, wg1, wg2 *sync.WaitGroup, ba
*output = appendTimeInfo(*output, tempOutput, startTime, outputMutex)
}
// runIpInfoCheck 系统和网络基础信息检测不进行测试的时候该函数检测取得本机IP信息并显示(单项测试中输出)
func runIpInfoCheck(output, tempOutput string, outputMutex *sync.Mutex) string {
outputMutex.Lock()
defer outputMutex.Unlock()
return utils.PrintAndCapture(func() {
var ipinfo string
upstreams.IPV4, upstreams.IPV6, ipinfo = utils.OnlyBasicsIpInfo(language)
if ipinfo != "" {
if language == "zh" {
utils.PrintCenteredTitle("IP信息", width)
} else {
utils.PrintCenteredTitle("IP-Information", width)
}
fmt.Printf("%s", ipinfo)
}
}, tempOutput, output)
}
func runBasicTests(preCheck utils.NetCheckResult, basicInfo, securityInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
outputMutex.Lock()
defer outputMutex.Unlock()
@@ -544,13 +635,13 @@ func runBasicTests(preCheck utils.NetCheckResult, basicInfo, securityInfo *strin
}
}
if preCheck.Connected && preCheck.StackType == "DualStack" {
*basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus)
upstreams.IPV4, upstreams.IPV6, *basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus)
} else if preCheck.Connected && preCheck.StackType == "IPv4" {
*basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, "ipv4", securityTestStatus)
upstreams.IPV4, upstreams.IPV6, *basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, "ipv4", securityTestStatus)
} else if preCheck.Connected && preCheck.StackType == "IPv6" {
*basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, "ipv6", securityTestStatus)
upstreams.IPV4, upstreams.IPV6, *basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, "ipv6", securityTestStatus)
} else {
*basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, "", false)
upstreams.IPV4, upstreams.IPV6, *basicInfo, *securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, "", false)
securityTestStatus = false
}
if basicStatus {
@@ -688,20 +779,16 @@ func runEmailTests(wg2 *sync.WaitGroup, emailInfo *string, output, tempOutput st
func runNetworkTests(wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
outputMutex.Lock()
defer outputMutex.Unlock()
output = utils.PrintAndCapture(func() {
return utils.PrintAndCapture(func() {
if backtraceStatus && !onlyChinaTest {
utils.PrintCenteredTitle("上游及回程线路检测", width)
upstreams.UpstreamsCheck()
upstreams.UpstreamsCheck() // 不能在重定向的同时外部并发,此处仅可以顺序执行
}
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
if nt3Status && !onlyChinaTest {
utils.PrintCenteredTitle("三网回程路由检测", width)
nt.TraceRoute(language, nt3Location, nt3CheckType)
nexttrace.NextTrace3Check(language, nt3Location, nt3CheckType) // 不能在重定向的同时外部并发,此处仅可以顺序执行
}
}, tempOutput, output)
return utils.PrintAndCapture(func() {
if onlyChinaTest || pingTestStatus {
if (onlyChinaTest || pingTestStatus) && *ptInfo != "" {
wg3.Wait()
utils.PrintCenteredTitle("三网ICMP的PING值检测", width)
fmt.Println(*ptInfo)
@@ -770,8 +857,10 @@ func handleUploadResults(output string) {
if httpURL != "" || httpsURL != "" {
if language == "en" {
fmt.Printf("Upload successfully!\nHttp URL: %s\nHttps URL: %s\n", httpURL, httpsURL)
fmt.Println("Each Test Benchmark: https://bash.spiritlhl.net/ecsguide")
} else {
fmt.Printf("上传成功!\nHttp URL: %s\nHttps URL: %s\n", httpURL, httpsURL)
fmt.Println("每项测试基准见: https://bash.spiritlhl.net/ecsguide")
}
}
}
@@ -782,12 +871,16 @@ func main() {
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)
go func() {
if preCheck.Connected {
http.Get("https://hits.spiritlhl.net/goecs.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false")
}
}()
if menuMode {
handleMenuMode(preCheck)
} else {
onlyIpInfoCheckStatus = true
}
handleLanguageSpecificSettings()
if !preCheck.Connected {

365
goecs.sh
View File

@@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/sh
# From https://github.com/oneclickvirt/ecs
# 2025.06.29
# 2025.08.26
# curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh
# 或
@@ -20,22 +20,27 @@ cd /root >/dev/null 2>&1
if [ ! -d "/usr/bin/" ]; then
mkdir -p "/usr/bin/"
fi
_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"; }
_red() { printf "\033[31m\033[01m%s\033[0m\n" "$*"; }
_green() { printf "\033[32m\033[01m%s\033[0m\n" "$*"; }
_yellow() { printf "\033[33m\033[01m%s\033[0m\n" "$*"; }
_blue() { printf "\033[36m\033[01m%s\033[0m\n" "$*"; }
reading() {
printf "\033[32m\033[01m%s\033[0m" "$1"
read "$2"
}
check_cdn() {
local o_url=$1
for cdn_url in "${cdn_urls[@]}"; do
if curl -sL -k "$cdn_url$o_url" --max-time 6 | grep -q "success" >/dev/null 2>&1; then
export cdn_success_url="$cdn_url"
return
local o_url="$1"
local cdn_url
for cdn_url in $cdn_urls; do
if curl -4 -sL -k "$cdn_url$o_url" --max-time 6 | grep -q "success" >/dev/null 2>&1; then
cdn_success_url="$cdn_url"
return 0
fi
sleep 0.5
done
export cdn_success_url=""
cdn_success_url=""
return 1
}
check_cdn_file() {
@@ -50,9 +55,9 @@ check_cdn_file() {
download_file() {
local url="$1"
local output="$2"
if ! wget -O "$output" "$url"; then
if ! wget -O "$output" "$url" 2>/dev/null; then
_yellow "wget failed, trying curl..."
if ! curl -L -o "$output" "$url"; then
if ! curl -L -o "$output" "$url" 2>/dev/null; then
_red "Both wget and curl failed. Unable to download the file."
return 1
fi
@@ -62,8 +67,7 @@ download_file() {
check_china() {
_yellow "正在检测IP所在区域......"
if [[ -z "${CN}" ]]; then
# 首先尝试通过 ipapi.co 检测
if [ -z "${CN}" ]; then
if curl -m 6 -s https://ipapi.co/json | grep -q 'China'; then
_yellow "根据ipapi.co提供的信息当前IP可能在中国"
if [ "$noninteractive" != "true" ]; then
@@ -94,28 +98,33 @@ check_china() {
get_memory_size() {
if [ -f /proc/meminfo ]; then
local mem_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
local mem_kb
mem_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
echo $((mem_kb / 1024)) # Convert to MB
return
return 0
fi
if command -v free >/dev/null 2>&1; then
local mem_kb=$(free -m | awk '/^Mem:/ {print $2}')
local mem_kb
mem_kb=$(free -m | awk '/^Mem:/ {print $2}')
echo "$mem_kb" # Already in MB
return
return 0
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)
local mem_bytes
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
return 0
fi
fi
echo 0
return 1
}
cleanup_epel() {
_yellow "Cleaning up EPEL repositories..."
rm -f /etc/yum.repos.d/*epel*
yum clean all
yum clean all >/dev/null 2>&1
}
goecs_check() {
@@ -143,7 +152,7 @@ goecs_check() {
os=$(uname -s 2>/dev/null || echo "Unknown")
arch=$(uname -m 2>/dev/null || echo "Unknown")
check_china
ECS_VERSION="0.1.71"
ECS_VERSION="0.1.88"
for api in \
"https://api.github.com/repos/oneclickvirt/ecs/releases/latest" \
"https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" \
@@ -155,23 +164,24 @@ goecs_check() {
sleep 1
done
if [ -z "$ECS_VERSION" ]; then
_yellow "Unable to get version info, using default version 0.1.71"
ECS_VERSION="0.1.71"
_yellow "Unable to get version info, using default version 0.1.88"
ECS_VERSION="0.1.88"
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
if command -v "$cmd_path" >/dev/null 2>&1; then
version_output=$($cmd_path -v command 2>/dev/null)
break
fi
done
if [ -n "$version_output" ]; then
extracted_version=${version_output//v/}
extracted_version=${version_output#*v}
extracted_version=${extracted_version#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
if [ "$(printf '%s\n%s\n' "$extracted_version" "$ecs_version" | sort -V | tail -n 1)" = "$extracted_version" ]; then
_green "goecs version ($extracted_version) is up to date, no upgrade needed"
return
return 0
else
_yellow "goecs version ($extracted_version) < $ecs_version, upgrade needed, starting in 5 seconds"
rm -rf /usr/bin/goecs /usr/local/bin/goecs ./goecs
@@ -181,11 +191,11 @@ goecs_check() {
_green "goecs not found, installation needed, starting in 5 seconds"
fi
sleep 5
if [[ "$CN" == true ]]; then
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/")
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}"
@@ -301,169 +311,179 @@ InstallSysbench() {
else
Var_OSRelease="unknown" # 未知系统分支
fi
local mem_size=$(get_memory_size)
local mem_size
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
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
case "$confirm" in
[Yy]*)
;;
*)
_yellow "Skipping EPEL installation"
return 1
;;
esac
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 ;;
if ! apt-get install -y sysbench; then
apt-get --fix-broken install -y
apt-get install --no-install-recommends -y sysbench
fi
;;
centos | rhel | almalinux | redhat | opencloudos)
(yum -y install epel-release && yum -y install sysbench) || (dnf install epel-release -y && dnf install sysbench -y) ;;
if ! yum -y install epel-release || ! yum -y install sysbench; then
if command -v dnf >/dev/null 2>&1; then
dnf install epel-release -y
dnf install sysbench -y
fi
fi
;;
fedora)
dnf -y install sysbench ;;
arch)
pacman -S --needed --noconfirm sysbench && pacman -S --needed --noconfirm libaio && ldconfig ;;
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
case "$confirm" in
[Yy]*)
;;
*)
_yellow "Skipping sysbench installation"
return 1
;;
esac
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
if ! grep -q "^${COMMUNITY_REPO}" /etc/apk/repositories; then
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."
else
echo "Community repository is already enabled."
fi
if apk info sysbench >/dev/null 2>&1; then
echo -e "${Msg_Info}Sysbench already installed."
echo "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"
if ! apk add --no-cache sysbench; then
echo "Sysbench Module not found, installing ..."
echo "SysBench Current not support Alpine Linux, Skipping..."
Var_Skip_SysBench="1"
else
echo -e "${Msg_Success}Sysbench installed successfully."
echo "Sysbench installed successfully."
fi
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() {
if [ ! -f "/usr/bin/sysbench" ] && [ ! -f "/usr/local/bin/sysbench" ]; then
InstallSysbench
fi
# 尝试编译安装
if [ ! -f "/usr/bin/sysbench" ] && [ ! -f "/usr/local/bin/sysbench" ]; then
echo -e "${Msg_Warning}Sysbench Module install Failure, trying compile modules ..."
Check_Sysbench_InstantBuild
fi
source ~/.bashrc
# 最终检测
if [ "$(command -v sysbench)" ] || [ -f "/usr/bin/sysbench" ] || [ -f "/usr/local/bin/sysbench" ]; then
_yellow "Install sysbench successfully!"
else
_red "SysBench Moudle install Failure! Try Restart Bench or Manually install it! (/usr/bin/sysbench)"
_blue "Will try to test with geekbench5 instead later."
fi
sleep 3
}
Check_Sysbench_InstantBuild() {
if [ "${Var_OSRelease}" = "centos" ] || [ "${Var_OSRelease}" = "rhel" ] || [ "${Var_OSRelease}" = "almalinux" ] || [ "${Var_OSRelease}" = "ubuntu" ] || [ "${Var_OSRelease}" = "debian" ] || [ "${Var_OSRelease}" = "fedora" ] || [ "${Var_OSRelease}" = "arch" ] || [ "${Var_OSRelease}" = "astra" ]; then
local os_sysbench=${Var_OSRelease}
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}"
echo -e "${Msg_Info}Downloading Source code (Version 1.0.20)..."
mkdir -p /tmp/sysbench_install/src/
mv /tmp/sysbench-1.0.20 /tmp/sysbench_install/src/
echo -e "${Msg_Info}Compiling Sysbench Module ..."
cd /tmp/sysbench_install/src/sysbench-1.0.20
./autogen.sh && ./configure --without-mysql && make -j8 && make install
echo -e "${Msg_Info}Cleaning up ..."
cd /tmp && rm -rf /tmp/sysbench_install/src/sysbench*
else
echo -e "${Msg_Warning}Unsupported operating system: ${Var_OSRelease}"
fi
}
prepare_compile_env() {
local system="$1"
if [ "${system}" = "centos" ] || [ "${system}" = "rhel" ] || [ "${system}" = "almalinux" ]; then
yum install -y epel-release
yum install -y wget curl make gcc gcc-c++ make automake libtool pkgconfig libaio-devel
elif [ "${system}" = "ubuntu" ] || [ "${system}" = "debian" ]; then
! apt-get update && apt-get --fix-broken install -y && apt-get update
! apt-get -y install --no-install-recommends curl wget make automake libtool pkg-config libaio-dev unzip && apt-get --fix-broken install -y && apt-get -y install --no-install-recommends curl wget make automake libtool pkg-config libaio-dev unzip
elif [ "${system}" = "fedora" ]; then
dnf install -y wget curl gcc gcc-c++ make automake libtool pkgconfig libaio-devel
elif [ "${system}" = "arch" ]; then
pacman -S --needed --noconfirm wget curl gcc gcc make automake libtool pkgconfig libaio lib32-libaio
else
echo -e "${Msg_Warning}Unsupported operating system: ${system}"
case "$SYSTEM" in
CentOS|RHEL|AlmaLinux)
_yellow "Installing EPEL repository..."
if ! yum -y install epel-release; then
_red "EPEL installation failed!"
cleanup_epel
_yellow "Attempting to continue without EPEL..."
fi
;;
esac
fi
}
env_check() {
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
SYS="$(hostnamectl | grep -i system | cut -d : -f2 | xargs)"
elif [ -x "$(type -p lsb_release)" ]; then
elif command -v hostnamectl >/dev/null 2>&1; then
SYS="$(hostnamectl | grep -i system | cut -d : -f2 | sed 's/^ *//')"
elif command -v lsb_release >/dev/null 2>&1; then
SYS="$(lsb_release -sd)"
elif [ -s /etc/lsb-release ]; then
SYS="$(grep -i description /etc/lsb-release | cut -d \" -f2)"
elif [ -s /etc/redhat-release ]; then
SYS="$(grep . /etc/redhat-release)"
SYS="$(cat /etc/redhat-release)"
elif [ -s /etc/issue ]; then
SYS="$(grep . /etc/issue | cut -d '\' -f1 | sed '/^[ ]*$/d')"
SYS="$(head -n1 /etc/issue | cut -d '\' -f1 | sed '/^[ ]*$/d')"
else
SYS="$(uname -s)"
fi
SYSTEM=""
for ((int = 0; int < ${#REGEX[@]}; int++)); do
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
SYSTEM="${RELEASE[int]}"
UPDATE_CMD=${PACKAGE_UPDATE[int]}
INSTALL_CMD=${PACKAGE_INSTALL[int]}
REMOVE_CMD=${PACKAGE_REMOVE[int]}
UNINSTALL_CMD=${PACKAGE_UNINSTALL[int]}
break
fi
done
sys_lower=$(echo "$SYS" | tr '[:upper:]' '[:lower:]')
if echo "$sys_lower" | grep -E "debian|astra" >/dev/null 2>&1; then
SYSTEM="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 echo "$sys_lower" | grep -E "ubuntu" >/dev/null 2>&1; then
SYSTEM="Ubuntu"
UPDATE_CMD="apt-get update"
INSTALL_CMD="apt-get -y install"
REMOVE_CMD="apt-get -y remove"
UNINSTALL_CMD="apt-get -y autoremove"
elif echo "$sys_lower" | grep -E "centos|red hat|kernel|oracle linux|alma|rocky" >/dev/null 2>&1; then
SYSTEM="CentOS"
UPDATE_CMD="yum -y update"
INSTALL_CMD="yum -y install"
REMOVE_CMD="yum -y remove"
UNINSTALL_CMD="yum -y autoremove"
elif echo "$sys_lower" | grep -E "amazon linux" >/dev/null 2>&1; then
SYSTEM="CentOS"
UPDATE_CMD="yum -y update"
INSTALL_CMD="yum -y install"
REMOVE_CMD="yum -y remove"
UNINSTALL_CMD="yum -y autoremove"
elif echo "$sys_lower" | grep -E "fedora" >/dev/null 2>&1; then
SYSTEM="Fedora"
UPDATE_CMD="yum -y update"
INSTALL_CMD="yum -y install"
REMOVE_CMD="yum -y remove"
UNINSTALL_CMD="yum -y autoremove"
elif echo "$sys_lower" | grep -E "arch" >/dev/null 2>&1; then
SYSTEM="Arch"
UPDATE_CMD="pacman -Sy"
INSTALL_CMD="pacman -Sy --noconfirm --needed"
REMOVE_CMD="pacman -Rsc --noconfirm"
UNINSTALL_CMD="pacman -Rns --noconfirm"
elif echo "$sys_lower" | grep -E "freebsd" >/dev/null 2>&1; then
SYSTEM="FreeBSD"
UPDATE_CMD="pkg update"
INSTALL_CMD="pkg install -y"
REMOVE_CMD="pkg delete"
UNINSTALL_CMD="pkg autoremove"
elif echo "$sys_lower" | grep -E "alpine" >/dev/null 2>&1; then
SYSTEM="Alpine"
UPDATE_CMD="apk update"
INSTALL_CMD="apk add --no-cache"
REMOVE_CMD="apk del"
UNINSTALL_CMD="apk autoremove"
elif echo "$sys_lower" | grep -E "openbsd" >/dev/null 2>&1; then
SYSTEM="OpenBSD"
UPDATE_CMD="pkg_add -qu"
INSTALL_CMD="pkg_add -I"
REMOVE_CMD="pkg_delete -I"
UNINSTALL_CMD="pkg_delete -a"
elif echo "$sys_lower" | grep -E "opencloudos" >/dev/null 2>&1; then
SYSTEM="OpenCloudOS"
UPDATE_CMD="yum -y update"
INSTALL_CMD="yum -y install"
REMOVE_CMD="yum -y remove"
UNINSTALL_CMD="yum -y autoremove"
fi
if [ -z "$SYSTEM" ]; then
_yellow "Unable to recognize system, trying common package managers..."
if command -v apt-get >/dev/null 2>&1; then
@@ -510,7 +530,7 @@ env_check() {
_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/")
cdn_urls="https://cdn0.spiritlhl.top/ http://cdn3.spiritlhl.net/ http://cdn1.spiritlhl.net/ http://cdn2.spiritlhl.net/"
check_cdn_file
_yellow "Warning: System update will be performed"
_yellow "This operation may:"
@@ -520,15 +540,18 @@ env_check() {
_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
case "$update_confirm" in
[Yy]*)
_green "Updating system package manager..."
if ! ${UPDATE_CMD} 2>/dev/null; then
_red "System update failed!"
fi
;;
*)
_yellow "Skipping system update"
_yellow "Note: Some packages may fail to install"
;;
esac
fi
for cmd in sudo wget tar unzip iproute2 systemd-detect-virt dd fio; do
if ! command -v "$cmd" >/dev/null 2>&1; then
@@ -538,43 +561,37 @@ env_check() {
done
if ! command -v sysbench >/dev/null 2>&1; then
_green "Installing sysbench"
${INSTALL_CMD} sysbench
if [ $? -ne 0 ]; then
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
chmod +x /tmp/sysbench.zip
unzip /tmp/sysbench.zip -d /tmp
Check_SysBench
if ! ${INSTALL_CMD} sysbench; then
_red "Unable to install sysbench through package manager"
_yellow "Sysbench installation skipped"
fi
fi
if ! command -v geekbench >/dev/null 2>&1; then
_green "Installing geekbench"
curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/cputest/main/dgb.sh" -o dgb.sh && chmod +x dgb.sh
bash dgb.sh -v gb5
sh dgb.sh -v gb5
rm -rf dgb.sh
fi
if ! command -v speedtest >/dev/null 2>&1; then
_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
sh dspt.sh
rm -rf dspt.sh
rm -rf speedtest.tar.gz
fi
if ! command -v ping >/dev/null 2>&1; then
_green "Installing ping"
${INSTALL_CMD} iputils-ping >/dev/null 2>&1
${INSTALL_CMD} 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 iproute2mac..."
brew install --force sysbench iproute2mac
if command -v brew >/dev/null 2>&1; then
brew install --force sysbench iproute2mac
fi
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
if ! grep -q "^net.ipv4.ping_group_range = 0 2147483647$" /etc/sysctl.conf 2>/dev/null; then
echo "net.ipv4.ping_group_range = 0 2147483647" >> /etc/sysctl.conf 2>/dev/null
sysctl -p >/dev/null 2>&1
fi
fi
_green "Environment preparation complete."

View File

@@ -10,7 +10,6 @@ import (
func MemoryTest(language, testMethod string) (realTestMethod, res string) {
if runtime.GOOS == "windows" {
if testMethod != "winsat" && testMethod != "" {
// res = "Detected host is Windows, using Winsat for testing.\n"
realTestMethod = "winsat"
}
res += memory.WinsatTest(language)
@@ -19,7 +18,6 @@ func MemoryTest(language, testMethod string) (realTestMethod, res string) {
case "sysbench":
res = memory.SysBenchTest(language)
if res == "" {
// res = "sysbench test failed, switch to use dd test.\n"
res += memory.DDTest(language)
realTestMethod = "dd"
} else {
@@ -29,7 +27,6 @@ func MemoryTest(language, testMethod string) (realTestMethod, res string) {
res = memory.DDTest(language)
realTestMethod = "dd"
default:
// res = "Unsupported test method, switch to use dd test.\n"
res += memory.DDTest(language)
realTestMethod = "dd"
}

44
nexttrace/nexttrace.go Normal file
View File

@@ -0,0 +1,44 @@
package nexttrace
import (
"fmt"
"strings"
"github.com/oneclickvirt/nt3/nt"
)
func NextTrace3Check(language, nt3Location, nt3CheckType string) {
resultChan := make(chan nt.TraceResult, 100)
go nt.TraceRoute(language, nt3Location, nt3CheckType, resultChan)
for result := range resultChan {
if result.Index == -1 {
for index, res := range result.Output {
res = strings.TrimSpace(res)
if res != "" && index == 0 {
fmt.Println(res)
}
}
continue
}
if result.ISPName == "Error" {
for _, res := range result.Output {
res = strings.TrimSpace(res)
if res != "" {
fmt.Println(res)
}
}
return
}
for _, res := range result.Output {
res = strings.TrimSpace(res)
if res == "" {
continue
}
if strings.Contains(res, "ICMP") {
fmt.Print(res)
} else {
fmt.Println(res)
}
}
}
}

View File

@@ -0,0 +1,13 @@
package nexttrace
import (
"testing"
"time"
)
func TestNextTrace3Check(t *testing.T) {
start := time.Now()
NextTrace3Check("zh", "ALL", "ipv4")
duration := time.Since(start)
t.Logf("执行耗时: %s", duration)
}

View File

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

View File

@@ -1,66 +1,66 @@
package upstreams
import (
"context"
"encoding/json"
"fmt"
"strings"
"sync"
"time"
"github.com/imroc/req/v3"
"github.com/oneclickvirt/UnlockTests/uts"
bgptools "github.com/oneclickvirt/backtrace/bgptools"
backtrace "github.com/oneclickvirt/backtrace/bk"
. "github.com/oneclickvirt/defaultset"
)
type IpInfo struct {
Ip string `json:"ip"`
City string `json:"city,omitempty"`
Region string `json:"region,omitempty"`
Country string `json:"country,omitempty"`
Org string `json:"org,omitempty"`
City string `json:"city"`
Region string `json:"region"`
Country string `json:"country"`
Org string `json:"org"`
}
func fetchIP(ctx context.Context, url string, parse func([]byte) (string, error), ch chan<- string) {
client := req.C().SetTimeout(3 * time.Second)
resp, err := client.R().SetContext(ctx).Get(url)
if err != nil || !resp.IsSuccessState() {
return
}
ip, err := parse(resp.Bytes())
if err == nil && ip != "" && strings.Contains(ip, ".") {
ch <- ip
}
type ConcurrentResults struct {
bgpResult string
backtraceResult string
bgpError error
// backtraceError error
}
var IPV4, IPV6 string
func UpstreamsCheck() {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
ipChan := make(chan string, 3)
go fetchIP(ctx, "https://ipinfo.io", func(b []byte) (string, error) {
var data IpInfo
err := json.Unmarshal(b, &data)
return data.Ip, err
}, ipChan)
go fetchIP(ctx, "https://api.ip.sb/ip", func(b []byte) (string, error) {
return strings.TrimSpace(string(b)), nil
}, ipChan)
go fetchIP(ctx, "http://ip-api.com/json/?fields=query", func(b []byte) (string, error) {
var data struct {
Query string `json:"query"`
}
err := json.Unmarshal(b, &data)
return data.Query, err
}, ipChan)
var ip string
select {
case ip = <-ipChan:
case <-ctx.Done():
results := ConcurrentResults{}
var wg sync.WaitGroup
if IPV4 != "" {
wg.Add(1)
go func() {
defer wg.Done()
for i := 0; i < 2; i++ {
result, err := bgptools.GetPoPInfo(IPV4)
results.bgpError = err
if err == nil && result.Result != "" {
results.bgpResult = result.Result
return
}
if i == 0 {
time.Sleep(3 * time.Second)
}
}
}()
}
if ip != "" {
if result, err := bgptools.GetPoPInfo(ip); err == nil {
fmt.Print(result.Result)
}
wg.Add(1)
go func() {
defer wg.Done()
result := backtrace.BackTrace(uts.IPV6)
results.backtraceResult = result
}()
wg.Wait()
if results.bgpResult != "" {
fmt.Print(results.bgpResult)
}
backtrace.BackTrace(uts.IPV6)
if results.backtraceResult != "" {
fmt.Printf("%s\n", results.backtraceResult)
}
fmt.Println(Yellow("准确线路自行查看详细路由,本测试结果仅作参考"))
fmt.Println(Yellow("同一目标地址多个线路时,检测可能已越过汇聚层,除第一个线路外,后续信息可能无效"))
}

View File

@@ -3,5 +3,6 @@ package upstreams
import "testing"
func TestUpstreamsCheck(t *testing.T) {
IPV4 = "148.100.85.25"
UpstreamsCheck()
}

View File

@@ -11,6 +11,7 @@ import (
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"sync"
"time"
@@ -18,12 +19,28 @@ import (
"github.com/imroc/req/v3"
"github.com/oneclickvirt/UnlockTests/uts"
bnetwork "github.com/oneclickvirt/basics/network"
"github.com/oneclickvirt/basics/system"
butils "github.com/oneclickvirt/basics/utils"
. "github.com/oneclickvirt/defaultset"
"github.com/oneclickvirt/security/network"
)
// 获取本程序本日及总执行的统计信息
type StatsResponse struct {
Counter string `json:"counter"`
Action string `json:"action"`
Total int `json:"total"`
Daily int `json:"daily"`
Date string `json:"date"`
Timestamp string `json:"timestamp"`
}
// 获取最新的Github的仓库中的版本
type GitHubRelease struct {
TagName string `json:"tag_name"`
}
// PrintCenteredTitle 根据指定的宽度打印居中标题
func PrintCenteredTitle(title string, width int) {
// 计算字符串的字符数
@@ -39,13 +56,13 @@ func PrintHead(language string, width int, ecsVersion string) {
if language == "zh" {
PrintCenteredTitle("VPS融合怪测试", width)
fmt.Printf("版本:%s\n", ecsVersion)
fmt.Println("测评频道: https://t.me/vps_reviews\n" +
fmt.Println("测评频道: https://t.me/+UHVoo2U4VyA5NTQ1\n" +
"Go项目地址https://github.com/oneclickvirt/ecs\n" +
"Shell项目地址https://github.com/spiritLHLS/ecs")
} else {
PrintCenteredTitle("VPS Fusion Monster Test", width)
fmt.Printf("Version: %s\n", ecsVersion)
fmt.Println("Review Channel: https://t.me/vps_reviews\n" +
fmt.Println("Review Channel: https://t.me/+UHVoo2U4VyA5NTQ1\n" +
"Go Project: https://github.com/oneclickvirt/ecs\n" +
"Shell Project: https://github.com/spiritLHLS/ecs")
}
@@ -99,18 +116,38 @@ func CheckChina(enableLogger bool) bool {
return selectChina
}
// OnlyBasicsIpInfo 仅检查和输出IP信息
func OnlyBasicsIpInfo(language string) (string, string, string) {
ipv4, ipv6, ipInfo, _, err := bnetwork.NetworkCheck("both", false, language)
if err != nil {
return "", "", ""
}
basicInfo := ipInfo
if strings.Contains(ipInfo, "IPV4") && strings.Contains(ipInfo, "IPV6") && ipv4 != "" && ipv6 != "" {
uts.IPV4 = true
uts.IPV6 = true
} else if strings.Contains(ipInfo, "IPV4") && ipv4 != "" {
uts.IPV4 = true
uts.IPV6 = false
} else if strings.Contains(ipInfo, "IPV6") && ipv6 != "" {
uts.IPV6 = true
uts.IPV4 = false
}
basicInfo = strings.ReplaceAll(basicInfo, "\n\n", "\n")
return ipv4, ipv6, basicInfo
}
// BasicsAndSecurityCheck 执行安全检查
func BasicsAndSecurityCheck(language, nt3CheckType string, securityCheckStatus bool) (string, string, string) {
func BasicsAndSecurityCheck(language, nt3CheckType string, securityCheckStatus bool) (string, string, string, string, string) {
var wgt sync.WaitGroup
var ipInfo, securityInfo, systemInfo string
var err error
var ipv4, ipv6, ipInfo, securityInfo, systemInfo string
wgt.Add(1)
go func() {
defer wgt.Done()
ipInfo, securityInfo, err = network.NetworkCheck("both", securityCheckStatus, language)
if err != nil {
fmt.Println(err.Error())
}
ipv4, ipv6, ipInfo, securityInfo, _ = network.NetworkCheck("both", securityCheckStatus, language)
// if err != nil {
// fmt.Println(err.Error())
// }
}()
wgt.Add(1)
go func() {
@@ -119,19 +156,19 @@ func BasicsAndSecurityCheck(language, nt3CheckType string, securityCheckStatus b
}()
wgt.Wait()
basicInfo := systemInfo + ipInfo
if strings.Contains(ipInfo, "IPV4") && strings.Contains(ipInfo, "IPV6") {
if strings.Contains(ipInfo, "IPV4") && strings.Contains(ipInfo, "IPV6") && ipv4 != "" && ipv6 != "" {
uts.IPV4 = true
uts.IPV6 = true
if nt3CheckType == "" {
nt3CheckType = "ipv4"
}
} else if strings.Contains(ipInfo, "IPV4") {
} else if strings.Contains(ipInfo, "IPV4") && ipv4 != "" {
uts.IPV4 = true
uts.IPV6 = false
if nt3CheckType == "" {
nt3CheckType = "ipv4"
}
} else if strings.Contains(ipInfo, "IPV6") {
} else if strings.Contains(ipInfo, "IPV6") && ipv6 != "" {
uts.IPV6 = true
uts.IPV4 = false
if nt3CheckType == "" {
@@ -144,7 +181,7 @@ func BasicsAndSecurityCheck(language, nt3CheckType string, securityCheckStatus b
nt3CheckType = "ipv4"
}
basicInfo = strings.ReplaceAll(basicInfo, "\n\n", "\n")
return basicInfo, securityInfo, nt3CheckType
return ipv4, ipv6, basicInfo, securityInfo, nt3CheckType
}
// CaptureOutput 捕获函数输出和错误输出,实时输出,并返回字符串
@@ -336,8 +373,6 @@ func ProcessAndUpload(output string, filePath string, enableUplaod bool) (string
return "", ""
}
// ============================= 前置联网能力检测 =============================
var StackType string
type NetCheckResult struct {
@@ -359,6 +394,7 @@ func makeResolver(proto, dnsAddr string) *net.Resolver {
}
}
// 前置联网能力检测
func CheckPublicAccess(timeout time.Duration) NetCheckResult {
if timeout < 2*time.Second {
timeout = 2 * time.Second
@@ -492,3 +528,77 @@ result:
StackType: stack,
}
}
// 获取每日/总的程序执行统计信息
func GetGoescStats() (*StatsResponse, error) {
client := req.C().SetTimeout(5 * time.Second)
var stats StatsResponse
resp, err := client.R().
SetSuccessResult(&stats).
Get("https://hits.spiritlhl.net/goecs")
if err != nil {
return nil, err
}
if !resp.IsSuccessState() {
return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
}
return &stats, nil
}
// 统计结果单位转换
func FormatGoecsNumber(num int) string {
if num >= 1000000 {
return fmt.Sprintf("%.1fM", float64(num)/1000000)
} else if num >= 1000 {
return fmt.Sprintf("%.1fK", float64(num)/1000)
}
return fmt.Sprintf("%d", num)
}
// 通过Github的API检索仓库最新TAG的版本
func GetLatestEcsRelease() (*GitHubRelease, error) {
urls := []string{
"https://api.github.com/repos/oneclickvirt/ecs/releases/latest",
"https://fd.spiritlhl.top/https://api.github.com/repos/oneclickvirt/ecs/releases/latest",
"https://githubapi.spiritlhl.top/repos/oneclickvirt/ecs/releases/latest",
"https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest",
}
client := req.C().SetTimeout(3 * time.Second)
for _, url := range urls {
var release GitHubRelease
resp, err := client.R().
SetSuccessResult(&release).
Get(url)
if err != nil {
continue
}
if resp.IsSuccessState() && release.TagName != "" {
return &release, nil
}
}
return nil, fmt.Errorf("failed to fetch release from all sources")
}
// 比较程序版本是否需要升级
func CompareVersions(v1, v2 string) int {
normalize := func(s string) []int {
s = strings.TrimPrefix(strings.ToLower(s), "v")
parts := strings.Split(s, ".")
result := make([]int, 3)
for i := 0; i < 3 && i < len(parts); i++ {
n, _ := strconv.Atoi(parts[i])
result[i] = n
}
return result
}
a := normalize(v1)
b := normalize(v2)
for i := 0; i < 3; i++ {
if a[i] < b[i] {
return -1
} else if a[i] > b[i] {
return 1
}
}
return 0
}

View File

@@ -20,11 +20,11 @@ func TestBasicsAndSecurityCheck(t *testing.T) {
timeout := 3 * time.Second
result := CheckPublicAccess(timeout)
if result.Connected {
fmt.Print("✅ 本机有公网连接,类型: %s\n", result.StackType)
fmt.Printf("✅ 本机有公网连接,类型: %s\n", result.StackType)
} else {
fmt.Println("❌ 本机未检测到公网连接")
}
basicInfo, securityInfo, nt3CheckType := BasicsAndSecurityCheck("zh", "ipv4", false)
_, _, basicInfo, securityInfo, nt3CheckType := BasicsAndSecurityCheck("zh", "ipv4", false)
fmt.Println(basicInfo)
fmt.Println(securityInfo)
fmt.Println(nt3CheckType)