Compare commits

...

57 Commits

Author SHA1 Message Date
spiritlhl
6d02103aba fix: 修复流媒体解锁的请求头参数设置 2026-01-30 05:57:44 +00:00
github-actions[bot]
5ffb48dcdc chore: update ECS_VERSION to 0.1.112 in goecs.sh 2026-01-16 06:16:27 +00:00
spiritlhl
7c19502950 fix:部分测速成功也输出,但补充节点测速 2026-01-16 14:02:42 +08:00
spiritlhl
3c434781f5 fix:修复私有测速节点可能存在部分上传下载测速失败的问题,自动轮换 2026-01-16 14:00:53 +08:00
spiritlhl
f62636ca3e fix:回退upx安装步骤,实际受限于编译的镜像不可直接进行安装 2026-01-13 20:00:59 +08:00
spiritlhl
c4b11ae37d fix: Install UPX in build workflow
Added step to install UPX for binary compression.
2026-01-13 19:57:55 +08:00
github-actions[bot]
8f2fe236d5 chore: update ECS_VERSION to 0.1.111 in goecs.sh 2026-01-13 11:56:25 +00:00
spiritlhl
347a0faa7a fix:添加UPX操作压缩减小产物大小 2026-01-13 19:42:41 +08:00
spiritlhl
74640e3066 fix:更新版本 2026-01-13 19:36:24 +08:00
spiritlhl
3b646eeeda fix:修复错误的格式化字符 2026-01-13 19:35:39 +08:00
github-actions[bot]
eaad433395 chore: update ECS_VERSION to 0.1.110 in goecs.sh 2026-01-13 04:28:12 +00:00
spiritlhl
03af7c423b Bump ecsVersion to v0.1.110 2026-01-13 12:12:40 +08:00
spiritlhl
0e96a6499b Update build_binary.yaml to disable certain options
Disable large packages, Docker images, and swap storage in the build workflow.
2026-01-13 12:03:44 +08:00
spiritlhl
5b44f5f651 fix:修复编译占用的磁盘过大的问题 2026-01-13 11:49:57 +08:00
spiritlhl
e4a759fceb fix:修改非选项1时的测速逻辑,区分中英文测速使用不同的节点逻辑 2026-01-13 11:23:21 +08:00
spiritlhl
e5c4b0ce8e Clean up newlines in create_public_branch.py
Remove unnecessary newlines around specific strings in content.
2026-01-12 23:48:03 +08:00
spiritsoul
188a1153e6 fix:删除对应的依赖 2026-01-12 23:40:58 +08:00
spiritsoul
4c4887f487 fix:以文本结构匹配避免正则匹配越界 2026-01-12 23:31:27 +08:00
spiritsoul
feac73a427 fix:修复正则匹配 2026-01-12 23:28:45 +08:00
spiritlhl
f3048d074c Clean up Go module cache and remove go.sum 2026-01-12 23:19:18 +08:00
spiritlhl
58702b54e7 Remove privatespeedtest code from speed.go
Brutally remove privatespeedtest-related code from speed.go, ensuring the file remains syntactically correct.
2026-01-12 23:16:49 +08:00
spiritlhl
1e4d63ef57 Update Go version to 1.25.4 in workflow 2026-01-12 23:08:23 +08:00
spiritlhl
9f3acacae0 Disable modify_go_mod function and related calls
Comment out the modify_go_mod function and its calls.
2026-01-12 23:07:43 +08:00
spiritlhl
e9755f0c20 Refine speed test description in README.md 2026-01-12 23:01:19 +08:00
GitHub Actions
d8b397b31b Auto update README files 2026-01-12 14:41:00 +00:00
github-actions[bot]
9e22d1bc23 chore: update ECS_VERSION to 0.1.108 in goecs.sh 2026-01-12 14:37:10 +00:00
spiritlhl
284f6b8ba7 fix: 修复误删除的md文件 2026-01-12 14:22:34 +00:00
spiritlhl
27203cf850 fix:修复公共分支生成的Action,使用更完善的python脚本完成修复 2026-01-12 14:21:43 +00:00
spiritlhl
9b6922f55a fix:升级回程测试的nexttrace核心版本 2026-01-12 14:15:13 +00:00
spiritlhl
447b25989e fix:修复预设 2026-01-12 14:13:29 +00:00
github-actions[bot]
a50b68d184 chore: update ECS_VERSION to 0.1.107 in goecs.sh 2026-01-12 13:36:44 +00:00
spiritlhl
6b68e643c7 fix:更新主程序版本 2026-01-12 13:22:47 +00:00
spiritlhl
14c79b9a89 feat:添加私有测速平台节点测速,原测速平台节点仅作为备用方式 2026-01-12 13:21:29 +00:00
github-actions[bot]
60ae7ec3c3 chore: update ECS_VERSION to 0.1.106 in goecs.sh 2025-12-18 04:23:44 +00:00
spiritlhl
3d78128f6a fix:更新版本 2025-12-18 03:39:23 +00:00
spiritlhl
9c67a8d446 fix: 更新内存测试方法逻辑,增强对不同测试方法的支持 2025-12-18 03:35:45 +00:00
spiritlhl
014dba0ce6 feat: 添加更短的短链链接,默认不再进行任何环境安装 2025-11-29 02:49:56 +00:00
github-actions[bot]
b5fdab4b27 chore: update ECS_VERSION to 0.1.105 in goecs.sh 2025-11-26 07:43:20 +00:00
spiritlhl
16c4c2ff92 fix:统一参数解析 2025-11-26 07:20:43 +00:00
spiritlhl
e1991c850f fix:更新平台检测 2025-11-26 07:00:59 +00:00
spiritlhl
0b7c7865ff Merge pull request #15 from osscv/patch-1
Update acknowledgments in README.md
2025-11-21 20:19:02 +08:00
osscv
238ea3eb6f Update acknowledgments in README.md
Added DKLYDataHub to the list of acknowledgments.
2025-11-21 20:14:24 +08:00
spiritlhl
b859c52ba3 fix
Updated traffic proportion explanation to include IPV4 distinction.
2025-11-12 19:17:58 +08:00
spiritlhl
f1642843dd fix:添加cf的基准值比较网站 2025-11-12 17:11:12 +08:00
github-actions[bot]
90ba076afb chore: update ECS_VERSION to 0.1.104 in goecs.sh 2025-11-12 09:04:02 +00:00
spiritlhl
d31d20e16f feat:更新IP质量数据库,添加cloudflare的流量浏览器设备占比查询 2025-11-12 08:49:39 +00:00
github-actions[bot]
a4084835f9 chore: update ECS_VERSION to 0.1.103 in goecs.sh 2025-11-11 10:26:21 +00:00
spiritlhl
39c2607b42 fix:修复nexttrace权限不足时导致整个程序退出的问题 2025-11-11 10:12:27 +00:00
spiritlhl
519c0f3e86 fix:更新外部依赖库,去除可能的数据竞争 2025-11-11 10:00:19 +00:00
spiritlhl
3b5b8a348e fix:修复恶性BUG添加单项recover机制,优化整体执行的稳定性 2025-11-11 09:42:44 +00:00
spiritlhl
858585b4ff fix:处理IPV6解析不存在和不可用的两种情况,修复潜在的可能导致数组越界整个程序崩溃的问题 2025-11-11 09:04:37 +00:00
github-actions[bot]
b891416147 chore: update ECS_VERSION to 0.1.102 in goecs.sh 2025-11-09 09:21:01 +00:00
spiritlhl
8e79568895 fix:更新版本 2025-11-09 09:06:49 +00:00
spiritlhl
01aa051c96 fix:更新backtrace的IPV6检测支持更多IP段 2025-11-09 09:05:51 +00:00
spiritlhl
628a380122 fix:更新IP质量检测依赖 2025-11-09 09:03:44 +00:00
spiritlhl
2b94d289f3 fix: 更新youtube的地区识别 2025-11-09 09:02:59 +00:00
github-actions[bot]
e3676760da chore: update ECS_VERSION to 0.1.101 in goecs.sh 2025-11-09 05:15:53 +00:00
22 changed files with 1270 additions and 303 deletions

310
.back/create_public_branch.py Executable file
View File

@@ -0,0 +1,310 @@
#!/usr/bin/env python3
"""
Script to create public branch by removing security dependencies and references.
This script properly handles Go file modifications to ensure the code can compile.
"""
import re
import os
import sys
import shutil
def read_file(filepath):
"""Read file content."""
with open(filepath, 'r', encoding='utf-8') as f:
return f.read()
def write_file(filepath, content):
"""Write content to file."""
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
def modify_go_mod(filepath):
"""
Modify go.mod to remove privatespeedtest (and optional security) dependencies.
Automatically matches module names regardless of version or indirect comment.
"""
content = read_file(filepath)
# Modules to remove
remove_modules = [
r'github\.com/oneclickvirt/privatespeedtest',
r'github\.com/oneclickvirt/security',
]
for mod in remove_modules:
# Remove full require line (with or without // indirect)
content = re.sub(
rf'^[ \t]*{mod}[ \t]+v[^\s]+(?:[ \t]+// indirect)?[ \t]*\n',
'',
content,
flags=re.MULTILINE
)
write_file(filepath, content)
print(f"✓ Removed privatespeedtest/security from {filepath}")
def remove_code_block(lines, start_marker, end_condition='empty_line'):
"""
Remove code block from lines starting with start_marker.
Args:
lines: List of file lines
start_marker: String or list of strings to identify block start
end_condition: 'empty_line' (default) or 'closing_brace' or custom function
Returns:
Modified lines with the block removed
"""
if isinstance(start_marker, str):
start_marker = [start_marker]
result = []
skip_mode = False
brace_depth = 0
i = 0
while i < len(lines):
line = lines[i]
# Check if we should start skipping
if not skip_mode:
for marker in start_marker:
if marker in line:
skip_mode = True
if end_condition == 'closing_brace':
# Count opening braces on the function declaration line
brace_depth = line.count('{') - line.count('}')
break
if not skip_mode:
result.append(line)
else:
# We're in skip mode
if end_condition == 'empty_line':
# Skip until we find an empty line
if line.strip() == '':
skip_mode = False
# Don't add the empty line, continue to next
elif end_condition == 'closing_brace':
# Track brace depth
brace_depth += line.count('{') - line.count('}')
if brace_depth == 0 and '}' in line:
# Function ended, skip until next empty line
end_condition = 'empty_line'
i += 1
return result
def modify_speed_go(filepath):
"""
Remove privatespeedtest-related code from speed.go.
Uses line-by-line processing for reliability.
"""
content = read_file(filepath)
lines = content.split('\n')
# Remove specific code blocks by their comment markers
blocks_to_remove = [
'// formatString 格式化字符串到指定宽度',
'// printTableRow 打印表格行',
'// privateSpeedTest 使用 privatespeedtest 进行单个运营商测速',
'// privateSpeedTestWithFallback 使用私有测速,如果失败则回退到 global 节点',
'// 对于三网测速cmcc、cu、ct和 other优先使用 privatespeedtest 进行私有测速',
]
for block_marker in blocks_to_remove:
lines = remove_code_block(lines, block_marker)
# Reconstruct content
content = '\n'.join(lines)
# Remove privatespeedtest import
content = re.sub(
r'\n\s*"github\.com/oneclickvirt/privatespeedtest/pst"\s*\n',
'\n',
content,
flags=re.MULTILINE
)
# Remove time import (only used by privatespeedtest)
content = re.sub(
r'\n\s*"time"\s*\n',
'\n',
content,
flags=re.MULTILINE
)
# Clean up multiple consecutive empty lines (optional)
content = re.sub(r'\n{3,}', '\n\n', content)
write_file(filepath, content)
print(f"✓ Removed privatespeedtest from {filepath}")
def modify_utils_go(filepath):
"""
Modify utils/utils.go to:
1. Replace security/network import with basics/network
2. Replace SecurityUploadToken usage with hardcoded token
"""
content = read_file(filepath)
# Replace import
content = re.sub(
r'"github\.com/oneclickvirt/security/network"',
r'"github.com/oneclickvirt/basics/network"',
content
)
# Replace token usage - find the exact line and replace it
content = re.sub(
r'\ttoken := network\.SecurityUploadToken',
r'\ttoken := "OvwKx5qgJtf7PZgCKbtyojSU.MTcwMTUxNzY1MTgwMw"',
content
)
# Update title for public version
content = re.sub(
r'VPS融合怪测试',
r'VPS融合怪测试(非官方编译)',
content
)
content = re.sub(
r'VPS Fusion Monster Test',
r'VPS Fusion Monster Test (Unofficial)',
content
)
write_file(filepath, content)
print(f"✓ Modified {filepath}")
def modify_params_go(filepath):
"""
Modify internal/params/params.go to change security flag default to false.
"""
content = read_file(filepath)
# Change default value in struct initialization
content = re.sub(
r'(\s+SecurityTestStatus:\s+)true,',
r'\1false,',
content
)
# Change flag default value
content = re.sub(
r'(c\.GoecsFlag\.BoolVar\(&c\.SecurityTestStatus, "security", )true(, "Enable/Disable security test"\))',
r'\1false\2',
content
)
write_file(filepath, content)
print(f"✓ Modified {filepath}")
def modify_readme(filepath, is_english=False):
"""
Modify README files to update Go version and security status.
"""
content = read_file(filepath)
# Extract Go version from go.mod
go_mod_content = read_file('go.mod')
go_version_match = re.search(r'^go (\d+\.\d+(?:\.\d+)?)', go_mod_content, re.MULTILINE)
if not go_version_match:
print(f"⚠ Warning: Could not extract Go version from go.mod")
return
go_version = go_version_match.group(1)
if is_english:
# Update Go version in English README
content = re.sub(
r'Select go \d+\.\d+\.\d+ version to install',
f'Select go {go_version} version to install',
content
)
# Update security status
content = re.sub(
r'but binary files compiled in \[securityCheck\][^\)]*\)',
'but open sourced',
content
)
# Update help text for security flag
content = re.sub(
r'security\s+Enable/Disable security test \(default true\)',
'security Enable/Disable security test (default false)',
content
)
else:
# Update Go version in Chinese README
content = re.sub(
r'选择 go \d+\.\d+\.\d+ 的版本进行安装',
f'选择 go {go_version} 的版本进行安装',
content
)
# Update security status
content = re.sub(
r'但二进制文件编译至 \[securityCheck\][^\)]*\)',
'但已开源',
content
)
# Update help text for security flag
content = re.sub(
r'security\s+Enable/Disable security test \(default true\)',
'security Enable/Disable security test (default false)',
content
)
write_file(filepath, content)
print(f"✓ Modified {filepath}")
def main():
"""Main function to process all files."""
print("Starting public branch creation process...")
print()
# Check if we're in the right directory
if not os.path.exists('go.mod'):
print("Error: go.mod not found. Please run this script from the project root.")
sys.exit(1)
# Modify Go source files
print("Modifying Go source files...")
modify_speed_go('internal/tests/speed.go')
modify_utils_go('utils/utils.go')
modify_params_go('internal/params/params.go')
print()
# Modify go.mod
print("Modifying go.mod...")
modify_go_mod('go.mod')
print()
# Modify README files
print("Modifying README files...")
modify_readme('README.md', is_english=False)
modify_readme('README_EN.md', is_english=True)
print()
print("✓ All modifications completed successfully!")
print()
print("Next steps:")
print("1. Run 'go mod tidy' to clean up dependencies")
print("2. Run 'go build -o maintest' to verify compilation")
print("3. Test the binary with: ./maintest -menu=false -l en -security=false -upload=false")
if __name__ == '__main__':
main()

View File

@@ -19,11 +19,31 @@ jobs:
with:
fetch-depth: 0
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.25.3
go-version: 1.25.4
# - name: Install UPX
# run: |
# apk add --no-cache upx
- name: Configure Git for Private Modules
run: |
git config --global url."https://${{ secrets.GHT }}@github.com/".insteadOf "https://github.com/"
@@ -31,16 +51,21 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GHT }}
- name: Clean Go cache before build
run: |
go clean -cache -modcache -testcache
df -h
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
# version: latest
version: '~> v2'
args: release
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GHT }}
GOPRIVATE: github.com/oneclickvirt/security
GOPRIVATE: github.com/oneclickvirt/security,github.com/oneclickvirt/privatespeedtest
- name: Update goecs.sh with new version
run: |

View File

@@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.3'
go-version: '1.25.4'
- name: Update master branch README files
run: |
@@ -61,42 +61,15 @@ jobs:
- 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
python3 .back/create_public_branch.py
rm -f go.sum
go clean -modcache
go clean -cache -testcache -fuzzcache
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
# This step is now handled by the Python script
echo "README files already updated by create_public_branch.py"
- name: Build and Test
run: |
go build -o maintest

View File

@@ -1,6 +1,10 @@
before:
hooks:
- go mod tidy -v
- go clean -cache
project_name: goecs
builds:
- id: universal
env:
@@ -31,6 +35,7 @@ builds:
goarch: arm
main: ./
binary: goecs
- id: darwin-amd64
env:
- CGO_ENABLED=1
@@ -44,6 +49,7 @@ builds:
- amd64
main: ./
binary: goecs
- id: darwin-arm64
env:
- CGO_ENABLED=1
@@ -57,18 +63,23 @@ builds:
- arm64
main: ./
binary: goecs
universal_binaries:
- name_template: "goecs"
replace: false
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "goecs"
archives:
- name_template: "goecs_{{ .Os }}_{{ .Arch }}"
format: zip
files:
- none*
changelog:
sort: asc
filters:
@@ -79,4 +90,18 @@ changelog:
- Merge pull request
- Merge branch
- go mod tidy
- New translations
- New translations
upx:
- enabled: true
brute: true
goos:
- linux
- windows
goarch:
- amd64
- 386
- arm64
- ppc64le
- s390x
- riscv64

View File

@@ -60,7 +60,7 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
- 邮件端口测试:[portchecker](https://github.com/oneclickvirt/portchecker)
- 上游及回程路由线路检测:借鉴 [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace),二次开发至 [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)
- 三网路由测试:基于 [NTrace-core](https://github.com/nxtrace/NTrace-core),二次开发至 [nt3](https://github.com/oneclickvirt/nt3)
- 网速测试:基于 [speedtest.net](https://github.com/spiritLHLS/speedtest.net-CN-ID) 和 [speedtest.cn](https://github.com/spiritLHLS/speedtest.cn-CN-ID) 数据,开发 [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
- 网速测试:基于 [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)
- 支持root或admin环境下测试支持非root或非admin环境下测试支持离线环境下进行测试**暂未**支持无DNS的在线环境下进行测试
@@ -74,35 +74,43 @@ 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 && ./goecs.sh env && ./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 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 && ./goecs.sh env && ./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 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 && ./goecs.sh env && ./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 install && goecs
```
- **短链接:**
```bash
export noninteractive=true && curl -L https://bash.spiritlhl.net/goecs -o goecs.sh && chmod +x goecs.sh && ./goecs.sh env && ./goecs.sh install && goecs
export noninteractive=true && curl -L https://bash.spiritlhl.net/goecs -o goecs.sh && chmod +x goecs.sh && ./goecs.sh install && goecs
```
```bash
export noninteractive=true && curl -L https://ba.sh/JrVa -o goecs.sh && chmod +x goecs.sh && ./goecs.sh install && goecs
```
**如果需要测试更准确,请按照下面的详细说明进行安装,添加非必需的依赖**
#### **详细说明**
**详细说明**中的命令**可控制是否安装依赖****是否更新包管理器****默认互动模式可进行选择**
以下命令可控制**是否安装依赖****是否更新包管理器****互动模式和非交互模式**
<details>
<summary>展开查看详细说明</summary>
@@ -190,12 +198,18 @@ Usage: goecs [options]
Enable/Disable CPU test (default true)
-cpum string
Set CPU test method (supported: sysbench, geekbench, winsat) (default "sysbench")
-cpu-method string
Set CPU test method (supported: sysbench, geekbench, winsat) (default "sysbench")
-cput string
Set CPU test thread mode (supported: single, multi) (default "multi")
-cpu-thread string
Set CPU test thread mode (supported: single, multi) (default "multi")
-disk
Enable/Disable disk test (default true)
-diskm string
Set disk test method (supported: fio, dd, winsat) (default "fio")
-disk-method string
Set disk test method (supported: fio, dd, winsat) (default "fio")
-diskmc
Enable/Disable multiple disk checks, e.g., -diskmc=false
-diskp string
@@ -207,20 +221,28 @@ Usage: goecs [options]
Show help information
-l string
Set language (supported: en, zh) (default "zh")
-lang string
Set language (supported: en, zh) (default "zh")
-log
Enable/Disable logging in the current path
-memory
Enable/Disable memory test (default true)
-memorym string
Set memory test method (supported: stream, sysbench, dd, winsat, auto) (default "stream")
-memory-method string
Set memory test method (supported: stream, sysbench, dd, winsat, auto) (default "stream")
-menu
Enable/Disable menu mode, disable example: -menu=false (default true)
-nt3
Enable/Disable NT3 test (in 'en' language or on windows it always false) (default true)
-nt3loc string
Specify NT3 test location (supported: GZ, SH, BJ, CD, ALL for Guangzhou, Shanghai, Beijing, Chengdu and all) (default "GZ")
-nt3-location string
Specify NT3 test location (supported: GZ, SH, BJ, CD, ALL for Guangzhou, Shanghai, Beijing, Chengdu and all) (default "GZ")
-nt3t string
Set NT3 test type (supported: both, ipv4, ipv6) (default "ipv4")
-nt3-type string
Set NT3 test type (supported: both, ipv4, ipv6) (default "ipv4")
-ping
Enable/Disable ping test
-security
@@ -233,8 +255,6 @@ Usage: goecs [options]
Enable/Disable Telegram DC test
-upload
Enable/Disable upload the result (default true)
-ut
Enable/Disable unlock media test (default true)
-v Display version information
-version
Display version information
@@ -313,7 +333,7 @@ cd ecs
2. 安装 Go 环境(如已安装可跳过)
选择 go 1.25.3 的版本进行安装
选择 go 1.25.4 的版本进行安装
```bash
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
@@ -384,7 +404,9 @@ GOOS=darwin GOARCH=amd64 go build -o goecs_darwin
## 致谢
感谢 [he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [maxmind.com](https://www.maxmind.com/en/home) [cloudflare.com](https://www.cloudflare.com/) [ip.sb](https://ip.sb) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) [ipfighter.com](https://ipfighter.com/) [getipintel.net](http://check.getipintel.net/) [fraudlogix.com](https://fraudlogix.com) 等网站提供的API进行检测感谢互联网各网站提供的查询资源
感谢
[DKLYDataHub - IP Geolocation Data](https://data.dkly.net)
[he.net](https://he.net) [bgp.tools](https://bgp.tools) [ipinfo.io](https://ipinfo.io) [maxmind.com](https://www.maxmind.com/en/home) [cloudflare.com](https://www.cloudflare.com/) [ip.sb](https://ip.sb) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [virustotal.com](https://www.virustotal.com/) [ipfighter.com](https://ipfighter.com/) [getipintel.net](http://check.getipintel.net/) [fraudlogix.com](https://fraudlogix.com) 等网站提供的API进行检测感谢互联网各网站提供的查询资源
感谢

View File

@@ -74,35 +74,43 @@ Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https:
#### **One-click command**
**One-Click Command** will **Install Dependencies by Default**, **Update Package Manager by Default**, **Default Non-Interactive Mode***
**One-Click Command** will **Not install Dependencies** by Default, **Not update Package Manager** by Default, **Non-Interactive Mode** by Default.
- **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 && ./goecs.sh env && ./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 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 && ./goecs.sh env && ./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 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 && ./goecs.sh env && ./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 install && goecs
```
- **Short Link:**
```bash
export noninteractive=true && curl -L https://bash.spiritlhl.net/goecs -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs
``
export noninteractive=true && curl -L https://bash.spiritlhl.net/goecs -o goecs.sh && chmod +x goecs.sh && bash goecs.sh install && goecs
```
OR
```bash
export noninteractive=true && curl -L https://ba.sh/JrVa -o goecs.sh && chmod +x goecs.sh && ./goecs.sh install && goecs
```
**For more accurate testing, please follow the detailed instructions below to install and add non-essential dependencies**
#### **Detailed instructions**
**Detailed description** of the commands in **Command **Controls whether to install dependencies**, **Whether to update the package manager**, **Default interaction mode can be selected***
The following commands control whether dependencies are installed, whether the package manager is updated, and whether interactive or non-interactive mode is used.
<details>
<summary>Expand to view detailed instructions</summary>
@@ -189,12 +197,18 @@ Usage: goecs [options]
Enable/Disable CPU test (default true)
-cpum string
Set CPU test method (supported: sysbench, geekbench, winsat) (default "sysbench")
-cpu-method string
Set CPU test method (supported: sysbench, geekbench, winsat) (default "sysbench")
-cput string
Set CPU test thread mode (supported: single, multi) (default "multi")
-cpu-thread string
Set CPU test thread mode (supported: single, multi) (default "multi")
-disk
Enable/Disable disk test (default true)
-diskm string
Set disk test method (supported: fio, dd, winsat) (default "fio")
-disk-method string
Set disk test method (supported: fio, dd, winsat) (default "fio")
-diskmc
Enable/Disable multiple disk checks, e.g., -diskmc=false
-diskp string
@@ -206,20 +220,28 @@ Usage: goecs [options]
Show help information
-l string
Set language (supported: en, zh) (default "zh")
-lang string
Set language (supported: en, zh) (default "zh")
-log
Enable/Disable logging in the current path
-memory
Enable/Disable memory test (default true)
-memorym string
Set memory test method (supported: stream, sysbench, dd, winsat, auto) (default "stream")
-memory-method string
Set memory test method (supported: stream, sysbench, dd, winsat, auto) (default "stream")
-menu
Enable/Disable menu mode, disable example: -menu=false (default true)
-nt3
Enable/Disable NT3 test (in 'en' language or on windows it always false) (default true)
-nt3loc string
Specify NT3 test location (supported: GZ, SH, BJ, CD, ALL for Guangzhou, Shanghai, Beijing, Chengdu and all) (default "GZ")
-nt3-location string
Specify NT3 test location (supported: GZ, SH, BJ, CD, ALL for Guangzhou, Shanghai, Beijing, Chengdu and all) (default "GZ")
-nt3t string
Set NT3 test type (supported: both, ipv4, ipv6) (default "ipv4")
-nt3-type string
Set NT3 test type (supported: both, ipv4, ipv6) (default "ipv4")
-ping
Enable/Disable ping test
-security
@@ -232,8 +254,6 @@ Usage: goecs [options]
Enable/Disable Telegram DC test
-upload
Enable/Disable upload the result (default true)
-ut
Enable/Disable unlock media test (default true)
-v Display version information
-version
Display version information
@@ -310,7 +330,7 @@ cd ecs
2. Install Go environment (skip if already installed)
Select go 1.25.3 version to install
Select go 1.25.4 version to install
```bash
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

View File

@@ -243,53 +243,55 @@ AMD的7950x单核满血性能得分在6500左右AMD的5950x单核满血性能
检测18个数据库的IP相关信息多个平台比较对应检测项目都为对应值证明当前IP确实如此不要仅相信一个数据库源的信息:
[ipinfo.io](https://ipinfo.io) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) [ipfighter.com](https://ipfighter.com/) [getipintel.net](http://check.getipintel.net/) [fraudlogix.com](https://fraudlogix.com)
[ipinfo.io](https://ipinfo.io) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) [ipfighter.com](https://ipfighter.com/) [getipintel.net](http://check.getipintel.net/) [fraudlogix.com](https://fraudlogix.com) [cloudflare.com](https://www.cloudflare.com/)
以下为每个字段的对应的含义
| 字段类别 | 字段名称 | 字段说明 | 可能的值 | 评分规则 |
|---------|---------|---------|---------|---------|
| 安全得分 | 声誉(Reputation) | IP地址在安全社区中的信誉评分 | 0-100的数值 | 越高越好 |
| | 信任得分(Trust Score) | IP地址的可信任程度评分 | 0-100的数值 | 越高越好 |
| | VPN得分(VPN Score) | IP被识别为VPN的可能性评分 | 0-100的数值 | 越低越好 |
| | 代理得分(Proxy Score) | IP被识别为代理的可能性评分 | 0-100的数值 | 越低越好 |
| 安全得分 | 声誉 | IP地址在安全社区中的信誉评分 | 0-100的数值 | 越高越好 |
| | 信任得分 | IP地址的可信任程度评分 | 0-100的数值 | 越高越好 |
| | VPN得分 | IP被识别为VPN的可能性评分 | 0-100的数值 | 越低越好 |
| | 代理得分 | IP被识别为代理的可能性评分 | 0-100的数值 | 越低越好 |
| | 社区投票-无害 | 社区成员投票认为该IP无害的分数 | 非负整数 | 越高越好 |
| | 社区投票-恶意 | 社区成员投票认为该IP恶意的分数 | 非负整数 | 越低越好 |
| | 威胁得分(Threat Score) | IP地址的整体威胁程度评分 | 0-100的数值 | 越低越好 |
| | 欺诈得分(Fraud Score) | IP地址涉及欺诈活动的可能性评分 | 0-100的数值 | 越低越好 |
| | 滥用得分(Abuse Score) | IP地址被报告滥用行为的评分 | 0-100的数值 | 越低越好 |
| | 威胁得分 | IP地址的整体威胁程度评分 | 0-100的数值 | 越低越好 |
| | 欺诈得分 | IP地址涉及欺诈活动的可能性评分 | 0-100的数值 | 越低越好 |
| | 滥用得分 | IP地址被报告滥用行为的评分 | 0-100的数值 | 越低越好 |
| | ASN滥用得分 | 该IP所属ASN(自治系统)的滥用评分 | 0-1的小数可能带有风险等级标注(Low/Medium/High) | 越低越好 |
| | 公司滥用得分 | 该IP所属公司的滥用评分 | 0-1的小数可能带有风险等级标注(Low/Medium/High) | 越低越好 |
| | 威胁级别(Threat Level) | IP地址的威胁等级分类 | low/medium/high/critical等文本描述 | low为最佳 |
| 黑名单记录 | 无害记录数(Harmless) | 在各黑名单数据库中被标记为无害的次数 | 非负整数 | 数值本身无好坏 |
| | 恶意记录数(Malicious) | 在各黑名单数据库中被标记为恶意的次数 | 非负整数 | 越低越好 |
| | 可疑记录数(Suspicious) | 在各黑名单数据库中被标记为可疑的次数 | 非负整数 | 越低越好 |
| | 记录数(Undetected) | 在各黑名单数据库中无任何记录的次数 | 非负整数 | 数值本身无好坏 |
| | 威胁级别 | IP地址的威胁等级分类 | low/medium/high/critical等文本描述 | low为最佳 |
| | 流量占比 | 真人和机器人在本机IP的ASN所在国家的占比 | 百分数 | 真人比越高越好 |
| 黑名单记录 | 无害记录数 | 在各黑名单数据库中被标记为无害的次数 | 非负整数 | 数值本身无好坏 |
| | 恶意记录数 | 在各黑名单数据库中被标记为恶意的次数 | 非负整数 | 越低越好 |
| | 可疑记录数 | 在各黑名单数据库中被标记为可疑的次数 | 非负整数 | 越低越好 |
| | 无记录数 | 在各黑名单数据库中无任何记录的次数 | 非负整数 | 数值本身无好坏 |
| | DNS黑名单-总检查数 | 检查的DNS黑名单数据库总数量 | 正整数 | 数值本身无好坏 |
| | DNS黑名单-干净 | 在DNS黑名单中显示为干净(未列入)的数量 | 非负整数 | 越高越好 |
| | DNS黑名单-已列入 | 在DNS黑名单中已被列入的数量 | 非负整数 | 越低越好 |
| | DNS黑名单-其他 | 在DNS黑名单检查中返回其他状态的数量 | 非负整数 | 数值本身无好坏 |
当本机的IP所在的ASN拥有的IP数量比较少时流量占比可以给你提供网络邻居中有多少是真实流量的占比目前全球的互联网流量的占比约是70%真人30%机器人(IPV4)如果需要比较你就按这个基准对比就行了就知道是不是当前IP的ASN在本国的使用达到了互联网平均水平。如果需要具体国家的基准查询可使用 https://trafficbenchmark.spiritlhl.net/ 自行搜索查找对比。
一般来说看下面的使用类型公司类型还有安全信息的判别足矣,上面的安全得分只有多个数据库确认一致才可信,不看也没啥问题。(IDC: 一般买服务器识别成这个的多,就是正常的在数据中心机房广播使用的类型)
| 使用类型 | 说明 |
| ----------- | ---------- |
| hosting | 数据中心网络(IDC) |
| residential | 家庭/住宅网络(家宽) |
| FixedLineISPISP | 固定线路互联网服务提供商(家宽) |
| isp | 固定线路互联网服务提供商(家宽) |
| business | 企业办公网络(商宽) |
| cellular | 移动运营商网络(家宽) |
| education | 教育机构网络(教育网) |
| government | 政府机构网络(政府网) |
| military | 军事网络(政府网) |
| DataCenter/WebHosting/Transit | 数据中心网络(IDC) |
| CDN | 内容分发网络(IDC) |
| 公司类型 | 说明 |
| ------------ | ------------ |
| business | 企业公司(商宽) |
| hosting | 主机/数据中心公司(IDC) |
| FixedLineISPISP | 固定线路互联网服务提供商(家宽) |
| business | 企业公司(商宽) |
| isp | 固定线路互联网服务提供商(家宽) |
| education | 教育机构(教育网) |
| government | 政府机构(政府网) |
@@ -297,6 +299,9 @@ AMD的7950x单核满血性能得分在6500左右AMD的5950x单核满血性能
| 字段类别 | 字段名称 | 字段说明 | 可能的值 | 评分规则 |
|---------|---------|---------|---------|---------|
| 浏览器类型 | 是否为主流浏览器 | 本机IP的ASN所在国家的占比 | 百分比 | 主流的越多越好 |
| 设备类型 | 是否为桌面移动设备 | 本机IP的ASN所在国家的占比 | 百分比 | 桌面移动设备占比越多越好 |
| 操作系统类型 | 是否为主流操作系统 | 本机IP的ASN所在国家的占比 | 百分比 | 主流的越多越好 |
| 云提供商 | 是否云提供商(Cloud Provider) | 该IP是否属于云服务提供商 | Yes/No | 无好坏之分,仅标识 |
| 数据中心 | 是否数据中心(Data Center) | 该IP是否位于数据中心 | Yes/No | 如果关注解锁No为最佳 |
| 移动设备 | 是否移动设备(Mobile) | 该IP是否来自移动设备网络 | Yes/No | 如果关注解锁Yes为最佳 |
@@ -399,8 +404,7 @@ Abuser 或 Abuse 的滥用得分会直接影响机器的正常使用(中国境
| 中国电信 | 163 | ChinaNet (原163骨干网) | 普通国际出口,延迟高易绕路 | 一般 |
| 中国电信 | CN2 GT | ChinaNet Next Carrying Network (GT) | 较优于163偶有拥堵 | 良好 |
| 中国电信 | CN2 GIA | Global Internet Access(GT) | 直连国际POP低延迟低丢包 | 优质(最好) |
| 中国联通 | 169 | China169骨干网 | 老主干网,常经港美出口 | 一般(少部分优质) |
| 中国联通 | 4837 | Unicom International (AS4837) | 常见国际出口,覆盖广 | 良好 |
| 中国联通 | 4837 | Unicom International (AS4837) | 常见国际出口,覆盖广 | 一般到良好 |
| 中国联通 | 9929 | Unicom Premium / CU-IX | 精品网直连主要IXP延迟低 | 优质 |
| 中国移动 | CMI (AS58453) | China Mobile International | 节点多,对两广(广东广西)优化好 | 两广良好,其他一般 |
| 中国移动 | CMIN2 (AS58807) | China Mobile International N2 | 高质量专线低延迟低丢包对标CN2 | 优质 |
@@ -429,7 +433,7 @@ Abuser 或 Abuse 的滥用得分会直接影响机器的正常使用(中国境
| 中国电信 | CN2 BGP | CN2混合BGP(GIA+GT) | 混合路由性能略低于纯GIA | 良好至优质 |
| 中国电信 | CUII | ChinaNet United International Internet | 面向直连美国的专线 | 优质 |
| 中国电信 | 163+CUII混线 | 163国内段+国际专线出口 | 价格低,性能一般 | 一般 |
| 中国联通 | 169 | China169骨干网 | 老主干网,常经港美出口 | 一般(少部分优质) |
| 中国联通 | 169 | China169骨干网 | 老主干网,一般对接4837 | 一般(少部分优质) |
| 中国联通 | 4837 | Unicom International (AS4837) | 常见国际出口,覆盖广 | 良好 |
| 中国联通 | 9929 | Unicom Premium / CU-IX | 精品网直连IXP低延迟 | 优质 |
| 中国联通 | 9929+4837混BGP | 混合出口(IDC常见优化) | 性能平衡 | 良好 |
@@ -478,6 +482,8 @@ Abuser 或 Abuse 的滥用得分会直接影响机器的正常使用(中国境
先测的官方推荐的测速点然后测有代表性的国际测速点最后测国内三大运营商ping值最低的测速点。
由于 speedtest.net 和 speedtest.cn 平台公开的测速节点被刷BTPT的刷烂了(他们为了对等上传PCDN的流量狂刷下载)所以这块本人独家融合的境内私有测速节点不再公开优先使用私有的境内运营商测速节点进行测速且写死限制每个IP每日仅支持获取测速数据10次超限自动降级为使用公共测速节点进行测速
境内使用为主就看境内测速即可,境外使用看境外测速,官方测速点可以代表受测的宿主机本地带宽基准。
一般来说中国境外的服务器的带宽100Mbps起步中国境内的服务器1Mbps带宽起步具体看线路优劣带宽特别大有时候未必用得上够用就行了。
@@ -683,7 +689,7 @@ Dependency project: [https://github.com/oneclickvirt/securityCheck](https://gith
Detect IP-related information from 18 databases. Multiple platforms comparing corresponding detection items all show corresponding values, proving that the current IP is indeed as such. Do not only trust information from a single database source:
[ipinfo.io](https://ipinfo.io) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) [ipfighter.com](https://ipfighter.com/) [getipintel.net](http://check.getipintel.net/) [fraudlogix.com](https://fraudlogix.com)
[ipinfo.io](https://ipinfo.io) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) [ipfighter.com](https://ipfighter.com/) [getipintel.net](http://check.getipintel.net/) [fraudlogix.com](https://fraudlogix.com) [cloudflare.com](https://www.cloudflare.com/)
The following are the meanings corresponding to each field
@@ -701,6 +707,7 @@ The following are the meanings corresponding to each field
| | ASN Abuse Score | Abuse score of the ASN (Autonomous System) to which this IP belongs | Decimal from 0-1, may include risk level notation (Low/Medium/High) | Lower is better |
| | Company Abuse Score | Abuse score of the company to which this IP belongs | Decimal from 0-1, may include risk level notation (Low/Medium/High) | Lower is better |
| | Threat Level | Threat level classification of IP address | Text descriptions such as low/medium/high/critical | low is best |
| | Traffic Proportion | Proportion of humans versus bots within the ASN country of the local IP address | Percentage | Higher human proportion is preferable |
| Blacklist Records | Harmless Count | Number of times marked as harmless in various blacklist databases | Non-negative integer | Value itself has no good or bad |
| | Malicious Count | Number of times marked as malicious in various blacklist databases | Non-negative integer | Lower is better |
| | Suspicious Count | Number of times marked as suspicious in various blacklist databases | Non-negative integer | Lower is better |
@@ -710,26 +717,27 @@ The following are the meanings corresponding to each field
| | DNS Blacklist-Listed | Number already listed in DNS blacklists | Non-negative integer | Lower is better |
| | DNS Blacklist-Other | Number returning other statuses in DNS blacklist checks | Non-negative integer | Value itself has no good or bad |
When the ASN to which this device's IP belongs has a relatively small number of IP addresses, the traffic proportion can indicate what percentage of your network neighbors constitute genuine traffic. Currently, global internet traffic is roughly 70% human and 30% bot (IPV4). If you need a comparison, use this benchmark to determine whether the ASN of your current IP has reached the internet average usage level within your country. For country-specific benchmark inquiries, you may use https://trafficbenchmark.spiritlhl.net/ to conduct your own searches and comparisons.
Generally speaking, checking the usage type, company type, and security information below is sufficient. The security score above is only reliable when confirmed by multiple databases, so it's not a problem to skip it. (IDC: generally buy vps identified as this much, is normal in the data center room broadcasting the type of use)
| Usage Type | Description |
| ----------- | ---------- |
| hosting | Data center network (IDC) |
| residential | Home/Residential network (Home broadband) |
| FixedLineISP, ISP | Fixed-line Internet Service Provider (Home broadband) |
| isp | Fixed-line Internet Service Provider (Home broadband) |
| business | Enterprise office network (Business broadband) |
| cellular | Mobile carrier network (Home broadband) |
| education | Educational institution network (Education network) |
| government | Government institution network (Government network) |
| military | Military network (Government network) |
| DataCenter/WebHosting/Transit | Data center network (IDC) |
| CDN | Content Delivery Network (IDC) |
| Company Type | Description |
| ------------ | ------------ |
| business | Business company (Business broadband) |
| hosting | Hosting/Data center company (IDC) |
| FixedLineISP, ISP | Fixed-line Internet Service Provider (Home broadband) |
| business | Business company (Business broadband) |
| isp | Fixed-line Internet Service Provider (Home broadband) |
| education | Educational institution (Education network) |
| government | Government institution (Government network) |
@@ -737,6 +745,9 @@ The above type descriptions represent the original query information types. Duri
| Field Category | Field Name | Field Description | Possible Values | Scoring Rules |
|---------|---------|---------|---------|---------|
| BrowserType | Mainstream Browser | Proportion of ASN Country for Local IP | Percentage | Higher mainstream proportion preferable |
| DeviceType | Desktop or Mobile Device | Percentage of ASN Country for Local IP | Percentage | Higher proportion of desktop/mobile devices is preferable |
| OSType | Mainstream Operating System | Percentage of ASN Country for Local IP | Percentage | Higher proportion of mainstream systems is preferable |
| Cloud Provider | Is Cloud Provider | Whether this IP belongs to a cloud service provider | Yes/No | No good or bad, identification only |
| Data Center | Is Data Center | Whether this IP is located in a data center | Yes/No | No is best if concerned about unblocking |
| Mobile | Is Mobile | Whether this IP is from a mobile device network | Yes/No | Yes is best if concerned about unblocking |
@@ -1017,7 +1028,7 @@ IP品質によるアクセス制限に敏感なのは、実際には主要なAI
18個のデータベースのIP関連情報を検出し、複数のプラットフォームで対応する検出項目がすべて対応する値である場合、現在のIPが確かにそうであることを証明します。1つのデータベースソースの情報のみを信じないでください:
[ipinfo.io](https://ipinfo.io) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) [ipfighter.com](https://ipfighter.com/) [getipintel.net](http://check.getipintel.net/) [fraudlogix.com](https://fraudlogix.com)
[ipinfo.io](https://ipinfo.io) [scamalytics.com](https://scamalytics.com) [abuseipdb.com](https://www.abuseipdb.com/) [ip2location.com](https://ip2location.com/) [ip-api.com](https://ip-api.com) [ipregistry.co](https://ipregistry.co/) [ipdata.co](https://ipdata.co/) [ipgeolocation.io](https://ipgeolocation.io) [ipwhois.io](https://ipwhois.io) [ipapi.com](https://ipapi.com/) [ipapi.is](https://ipapi.is/) [ipqualityscore.com](https://www.ipqualityscore.com/) [bigdatacloud.com](https://www.bigdatacloud.com/) [dkly.net](https://data.dkly.net) [virustotal.com](https://www.virustotal.com/) [ipfighter.com](https://ipfighter.com/) [getipintel.net](http://check.getipintel.net/) [fraudlogix.com](https://fraudlogix.com) [cloudflare.com](https://www.cloudflare.com/)
以下は各フィールドの対応する意味です
@@ -1035,6 +1046,7 @@ IP品質によるアクセス制限に敏感なのは、実際には主要なAI
| | ASN不正使用スコア | このIPが属するASN(自律システム)の不正使用スコア | 0-1の小数、リスクレベル表記付き(Low/Medium/High)の場合あり | 低いほど良い |
| | 企業不正使用スコア | このIPが属する企業の不正使用スコア | 0-1の小数、リスクレベル表記付き(Low/Medium/High)の場合あり | 低いほど良い |
| | 脅威レベル(Threat Level) | IPアドレスの脅威レベル分類 | low/medium/high/criticalなどのテキスト記述 | lowが最良 |
| | トラフィック比率 | 本機IPのASN所在国における人間とボットの比率 | パーセンテージ | 人間比率が高いほど良い |
| ブラックリスト記録 | 無害記録数(Harmless) | 各ブラックリストデータベースで無害とマークされた回数 | 非負整数 | 数値自体に良し悪しなし |
| | 悪意記録数(Malicious) | 各ブラックリストデータベースで悪意があるとマークされた回数 | 非負整数 | 低いほど良い |
| | 疑わしい記録数(Suspicious) | 各ブラックリストデータベースで疑わしいとマークされた回数 | 非負整数 | 低いほど良い |
@@ -1044,26 +1056,27 @@ IP品質によるアクセス制限に敏感なのは、実際には主要なAI
| | DNSブラックリスト-掲載済み | DNSブラックリストに既に掲載されている数 | 非負整数 | 低いほど良い |
| | DNSブラックリスト-その他 | DNSブラックリストチェックで他のステータスを返した数 | 非負整数 | 数値自体に良し悪しなし |
本機のIPが属するASNが保有するIP数が少ない場合、トラフィック比率からネットワーク内の実際のトラフィック割合を把握できます。現在の全世界インターネットトラフィックの割合は約70%が人間、30%がボットです(IPV4)。比較が必要な場合はこの基準値を基に照らし合わせれば、当該IPのASNが自国内でインターネット平均水準に達しているか判断できます。 特定の国の基準を照会する必要がある場合は、https://trafficbenchmark.spiritlhl.net/ で自ら検索し比較することができます。
一般的に以下の使用タイプ、会社タイプ、そしてセキュリティ情報の判別で十分です。上記のセキュリティスコアは複数のデータベースで一致が確認された場合のみ信頼できるため、見なくても特に問題ありません。(IDC: サーバーを購入する際、一般的にこの識別されることが多い。データセンターのサーバールームでブロードキャストに使用される通常のタイプである)
| 使用タイプ | 説明 |
| ----------- | ---------- |
| hosting | データセンターネットワーク(IDC) |
| residential | 家庭/住宅ネットワーク(家庭用回線) |
| FixedLineISP、ISP | 固定回線インターネットサービスプロバイダー(家庭用回線) |
| isp | 固定回線インターネットサービスプロバイダー(家庭用回線) |
| business | 企業オフィスネットワーク(ビジネス回線) |
| cellular | モバイル通信事業者ネットワーク(家庭用回線) |
| education | 教育機関ネットワーク(教育ネットワーク) |
| government | 政府機関ネットワーク(政府ネットワーク) |
| military | 軍事ネットワーク(政府ネットワーク) |
| DataCenter/WebHosting/Transit | データセンターネットワーク(IDC) |
| CDN | コンテンツ配信ネットワーク(IDC) |
| 会社タイプ | 説明 |
| ------------ | ------------ |
| business | 企業会社(ビジネス回線) |
| hosting | ホスト/データセンター会社(IDC) |
| FixedLineISP、ISP | 固定回線インターネットサービスプロバイダー(家庭用回線) |
| business | 企業会社(ビジネス回線) |
| isp | 固定回線インターネットサービスプロバイダー(家庭用回線) |
| education | 教育機関(教育ネットワーク) |
| government | 政府機関(政府ネットワーク) |
@@ -1071,6 +1084,9 @@ IP品質によるアクセス制限に敏感なのは、実際には主要なAI
| フィールドカテゴリ | フィールド名 | フィールド説明 | 可能な値 | 評価ルール |
|---------|---------|---------|---------|---------|
| ブラウザタイプ | 主流ブラウザかどうか | 本機IPのASN所在国の割合 | パーセンテージ | 主流であるほど良い |
| デバイスタイプ | デスクトップ/モバイルデバイスか | 本機IPのASN所在国の割合 | パーセンテージ | デスクトップとモバイルデバイスの割合が高いほど良い |
| オペレーティングシステムタイプ | 主流OSか | 本機IPのASN所在国の割合 | パーセンテージ | 主流OSが多いほど良い |
| クラウドプロバイダー | クラウドプロバイダーかどうか(Cloud Provider) | このIPがクラウドサービスプロバイダーに属しているか | Yes/No | 良し悪しはなく、識別のみ |
| データセンター | データセンターかどうか(Data Center) | このIPがデータセンターに位置しているか | Yes/No | アンブロックを重視する場合はNoが最適 |
| モバイルデバイス | モバイルデバイスかどうか(Mobile) | このIPがモバイルデバイスネットワークからのものか | Yes/No | アンブロックを重視する場合はYesが最適 |

51
go.mod
View File

@@ -1,21 +1,22 @@
module github.com/oneclickvirt/ecs
go 1.25.3
go 1.25.4
require (
github.com/imroc/req/v3 v3.54.0
github.com/oneclickvirt/UnlockTests v0.0.30-20251109035206
github.com/oneclickvirt/backtrace v0.0.8-20251102140847
github.com/oneclickvirt/basics v0.0.16-20251030093657
github.com/oneclickvirt/cputest v0.0.12-20250720122317
github.com/oneclickvirt/UnlockTests v0.0.34-20260130055000
github.com/oneclickvirt/backtrace v0.0.8-20251109090457
github.com/oneclickvirt/basics v0.0.16-20251112033526
github.com/oneclickvirt/cputest v0.0.12-20251111095842
github.com/oneclickvirt/defaultset v0.0.2-20240624082446
github.com/oneclickvirt/disktest v0.0.10-20250924030424
github.com/oneclickvirt/gostun v0.0.5-20250727155022
github.com/oneclickvirt/memorytest v0.0.10-20250924154648
github.com/oneclickvirt/nt3 v0.0.10-20251104114914
github.com/oneclickvirt/memorytest v0.0.10-20251218032900
github.com/oneclickvirt/nt3 v0.0.11-20260112140912
github.com/oneclickvirt/pingtest v0.0.9-20251104112920
github.com/oneclickvirt/portchecker v0.0.3-20250728015900
github.com/oneclickvirt/security v0.0.7-20251106060213
github.com/oneclickvirt/privatespeedtest v0.0.1-20260112130218
github.com/oneclickvirt/security v0.0.8-20260104113003
github.com/oneclickvirt/speedtest v0.0.11-20251102151740
)
@@ -28,7 +29,7 @@ require (
github.com/ebitengine/purego v0.8.4 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/gofrs/uuid/v5 v5.2.0 // indirect
github.com/google/gopacket v1.1.19 // indirect
@@ -41,12 +42,12 @@ require (
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jaypipes/ghw v0.17.0 // indirect
github.com/jaypipes/pcidb v1.0.1 // indirect
github.com/jsdelivr/globalping-cli v1.5.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/libp2p/go-nat v0.2.0 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/lionsoul2014/ip2region v2.11.2+incompatible // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
@@ -56,7 +57,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxtrace/NTrace-core v1.4.3-rc.1 // indirect
github.com/nxtrace/NTrace-core v1.5.0 // 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
@@ -72,41 +73,39 @@ require (
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus-community/pro-bing v0.4.1 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.53.0 // indirect
github.com/quic-go/quic-go v0.55.0 // indirect
github.com/refraction-networking/utls v1.7.3 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rodaine/table v1.3.0 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/schollz/progressbar/v3 v3.14.4 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/schollz/progressbar/v3 v3.17.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/shirou/gopsutil/v4 v4.25.6 // indirect
github.com/showwin/speedtest-go v1.7.10 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/viper v1.21.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/match v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.8.0 // indirect
github.com/tklauser/numcpus v0.9.0 // indirect
github.com/tsosunchia/powclient v0.2.0 // indirect
github.com/xjasonlyu/windivert-go v0.0.0-20201010013527-4239d0afa76f // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/mock v0.5.2 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/mod v0.27.0 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/term v0.35.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/tools v0.36.0 // indirect
golang.org/x/crypto v0.45.0 // indirect
golang.org/x/mod v0.29.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sync v0.18.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/tools v0.38.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
howett.net/plist v1.0.0 // indirect
)

104
go.sum
View File

@@ -6,6 +6,8 @@ github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwTo
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM=
github.com/chengxilo/virtualterm v1.0.4/go.mod h1:DyxxBZz/x1iqJjFxTFcr6/x+jSpqN0iwWCOK1q10rlY=
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -21,8 +23,9 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/gofrs/uuid/v5 v5.2.0 h1:qw1GMx6/y8vhVsx626ImfKMuS5CvJmhIKKtuyvfajMM=
@@ -56,9 +59,10 @@ github.com/jaypipes/ghw v0.17.0/go.mod h1:In8SsaDqlb1oTyrbmTC14uy+fbBMvp+xdqX51M
github.com/jaypipes/pcidb v1.0.1 h1:WB2zh27T3nwg8AE8ei81sNRb9yWBii3JGNJtT7K9Oic=
github.com/jaypipes/pcidb v1.0.1/go.mod h1:6xYUz/yYEyOkIkUt2t2J2folIuZ4Yg6uByCGFXMCeE4=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jsdelivr/globalping-cli v1.5.1 h1:7RZNmIljSBXe0xBeOoGQHXZNwHo6zDuQ0BI9hF12gLY=
github.com/jsdelivr/globalping-cli v1.5.1/go.mod h1:Gw70OWvN6hIt0t4hftyUhcHuJQMTn4CvoobJiaTU0qg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0=
@@ -71,8 +75,6 @@ github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk=
github.com/libp2p/go-nat v0.2.0/go.mod h1:3MJr+GRpRkyT65EpVPBstXLvOlAPzUVlG6Pwg9ohLJk=
github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU=
github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ=
github.com/lionsoul2014/ip2region v2.11.2+incompatible h1:+VRsGcrHz8ewXI/2UzTptJlACsxD/p4xCxuql4u2nKU=
github.com/lionsoul2014/ip2region v2.11.2+incompatible/go.mod h1:+ZBN7PBoh5gG6/y0ZQ85vJDBe21WnfbRrQQwTfliJJI=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
@@ -92,16 +94,16 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nxtrace/NTrace-core v1.4.3-rc.1 h1:V19tkw3kKAMQOOh7Ibb/jZFBk4kMUfQYmpxxtsOfYWo=
github.com/nxtrace/NTrace-core v1.4.3-rc.1/go.mod h1:lGhfZ916pEUJh+VzWZTYu7bKBo06pAn+/gXb0A/7gGg=
github.com/oneclickvirt/UnlockTests v0.0.30-20251109035206 h1:c5mUPst0P0K54N5bNbNdme8C2wajSCJxZ/5+p42s7ZY=
github.com/oneclickvirt/UnlockTests v0.0.30-20251109035206/go.mod h1:oOa6wj/qECtRMxwBO6D7o0L0F0Q/5sQ747OCnFQqoGE=
github.com/oneclickvirt/backtrace v0.0.8-20251102140847 h1:OiwD06+Mql3pYP8jJFFdP3OUlCrx/qJT7y2YCd/OMiI=
github.com/oneclickvirt/backtrace v0.0.8-20251102140847/go.mod h1:mj9TSow7FNszBb3bQj2Hhm41LwBo7HQP6sgaPtovKdM=
github.com/oneclickvirt/basics v0.0.16-20251030093657 h1:6SWWILNjJfMTXbspqYRpktUEOe/QIVhGonKO8ODC7n4=
github.com/oneclickvirt/basics v0.0.16-20251030093657/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/nxtrace/NTrace-core v1.5.0 h1:n+a/FObw/+CcqvhuSQiWcm1q+ODtfo7Wt3VmaIx504I=
github.com/nxtrace/NTrace-core v1.5.0/go.mod h1:/jME48iJ7QaVTzsrTPQyTJ+yExhjeWjax2L6uBd4ckk=
github.com/oneclickvirt/UnlockTests v0.0.34-20260130055000 h1:amgZH8QyTmgZ09t6j0Fi0SbSU03vhZIFjW/1/sOT70M=
github.com/oneclickvirt/UnlockTests v0.0.34-20260130055000/go.mod h1:oOa6wj/qECtRMxwBO6D7o0L0F0Q/5sQ747OCnFQqoGE=
github.com/oneclickvirt/backtrace v0.0.8-20251109090457 h1:599/R/qMAtfPCPG1bPoi6KbjNJzVkKtxm8dvVIdtn5o=
github.com/oneclickvirt/backtrace v0.0.8-20251109090457/go.mod h1:mj9TSow7FNszBb3bQj2Hhm41LwBo7HQP6sgaPtovKdM=
github.com/oneclickvirt/basics v0.0.16-20251112033526 h1:bgoLaqStV3a6mbPiM++0mYizd278GVa6J6yeIiusV+A=
github.com/oneclickvirt/basics v0.0.16-20251112033526/go.mod h1:2PV+1ge01zb0Sqzj2V2I7P0wAdFSLF1XgAiumchJJbg=
github.com/oneclickvirt/cputest v0.0.12-20251111095842 h1:ixZUvIkSlsIZfsg+dNDKq/FTofEtUjfA2LtpTrNr/6s=
github.com/oneclickvirt/cputest v0.0.12-20251111095842/go.mod h1:vjlH8tkPFft1tlLOpeNskXVvurxkHaJ3+dgFxQGLXY4=
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=
@@ -114,16 +116,18 @@ github.com/oneclickvirt/gostun v0.0.5-20250727155022 h1:/e3gSUrOp1tg/1NTRx+P8B51
github.com/oneclickvirt/gostun v0.0.5-20250727155022/go.mod h1:pfp7MFZJK9n/KTLAVqqFcCAns4xqMykmjI+1UeF/vdE=
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.10-20250924154648 h1:trk6oZ7xs1eVtr+6oIv5IX8LDVtEMG+E6GVzQ810BtU=
github.com/oneclickvirt/memorytest v0.0.10-20250924154648/go.mod h1:4kiHsEWkW9r3/1ZcV5xIweU0smiKP0IRfQj74AUIiVI=
github.com/oneclickvirt/nt3 v0.0.10-20251104114914 h1:P4nbdKcIA7+FH4feLLxfiJVf1f3ENi/oo37EsdyX9oI=
github.com/oneclickvirt/nt3 v0.0.10-20251104114914/go.mod h1:yo1ufkduFt9QjqG7nqSUf1D3YlQOmFpdlTYniJfclQI=
github.com/oneclickvirt/memorytest v0.0.10-20251218032900 h1:SmRFfPLyGfTVWIgC50lEGgOpbqahtMHIlyOMSbrhj9Y=
github.com/oneclickvirt/memorytest v0.0.10-20251218032900/go.mod h1:4kiHsEWkW9r3/1ZcV5xIweU0smiKP0IRfQj74AUIiVI=
github.com/oneclickvirt/nt3 v0.0.11-20260112140912 h1:e3tgkEmydsML6ziOdWwsVGwysTRYS82SuWrP0HnIw9g=
github.com/oneclickvirt/nt3 v0.0.11-20260112140912/go.mod h1:u/y3sMhyt4wiQlR7yS68CudwjXCa/4V6ozWI7awsCws=
github.com/oneclickvirt/pingtest v0.0.9-20251104112920 h1:j3Fjhy0YHT/VF7iuAVVELaRXkquvRd64tWWfFLJs01o=
github.com/oneclickvirt/pingtest v0.0.9-20251104112920/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.7-20251106060213 h1:vBCEFvuWpScXZ9O7Y7cW1zp1V2AfjzMN+YSBcYfpjYs=
github.com/oneclickvirt/security v0.0.7-20251106060213/go.mod h1:YfDilPFW22szjdUNgv4VOuSwHnZzsFsdPOfRYiMoc3I=
github.com/oneclickvirt/privatespeedtest v0.0.1-20260112130218 h1:h2k2fHtrsIIP/x/apEWkQGlTKuIumz8GrUR/df41YhE=
github.com/oneclickvirt/privatespeedtest v0.0.1-20260112130218/go.mod h1:IXOlKKX4DUNqxOaW/K9bcdrBiWxo0jGSLXeBeo7NrTo=
github.com/oneclickvirt/security v0.0.8-20260104113003 h1:NfmI83E+BAla+6ruFVDJIM5wsIi3ENH7FIcdn/kRhUI=
github.com/oneclickvirt/security v0.0.8-20260104113003/go.mod h1:aPMIwqsz7wiUH1cqvtRr9+QcQRkKzlUWecDM6SGVddc=
github.com/oneclickvirt/speedtest v0.0.11-20251102151740 h1:1NUrNt5ay6/xVNC5x62UrQjPqK8jgbKtyjBml/3boZg=
github.com/oneclickvirt/speedtest v0.0.11-20251102151740/go.mod h1:fy0II2Wo7kDWVBKTwcHdodZwyfmJo0g8N9V02EwQDZE=
github.com/oneclickvirt/stream v0.0.2-20250924154001 h1:GuJWdiPkoK84+y/+oHKr2Ghl3c/MzS9Z5m1nM+lMmy4=
@@ -153,8 +157,8 @@ github.com/prometheus-community/pro-bing v0.4.1 h1:aMaJwyifHZO0y+h8+icUz0xbToHbi
github.com/prometheus-community/pro-bing v0.4.1/go.mod h1:aLsw+zqCaDoa2RLVVSX3+UiCkBBXTMtZC3c7EkfWnAE=
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
github.com/quic-go/quic-go v0.53.0 h1:QHX46sISpG2S03dPeZBgVIZp8dGagIaiu2FiVYvpCZI=
github.com/quic-go/quic-go v0.53.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
github.com/quic-go/quic-go v0.55.0 h1:zccPQIqYCXDt5NmcEabyYvOnomjs8Tlwl7tISjJh9Mk=
github.com/quic-go/quic-go v0.55.0/go.mod h1:DR51ilwU1uE164KuWXhinFcKWGlEjzys2l8zUl5Ss1U=
github.com/refraction-networking/utls v1.7.3 h1:L0WRhHY7Oq1T0zkdzVZMR6zWZv+sXbHB9zcuvsAEqCo=
github.com/refraction-networking/utls v1.7.3/go.mod h1:TUhh27RHMGtQvjQq+RyO11P6ZNQNBb3N0v7wsEjKAIQ=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
@@ -164,18 +168,16 @@ github.com/rodaine/table v1.3.0 h1:4/3S3SVkHnVZX91EHFvAMV7K42AnJ0XuymRR2C5HlGE=
github.com/rodaine/table v1.3.0/go.mod h1:47zRsHar4zw0jgxGxL9YtFfs7EGN6B/TaS+/Dmk4WxU=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74=
github.com/schollz/progressbar/v3 v3.14.4/go.mod h1:aT3UQ7yGm+2ZjeXPqsjTenwL3ddUiuZ0kfQ/2tHlyNI=
github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
github.com/schollz/progressbar/v3 v3.17.1 h1:bI1MTaoQO+v5kzklBjYNRQLoVpe0zbyRZNK6DFkVC5U=
github.com/schollz/progressbar/v3 v3.17.1/go.mod h1:RzqpnsPQNjUyIgdglUjRLgD7sVnxN1wpmBMV+UiEbL4=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil/v4 v4.25.6 h1:kLysI2JsKorfaFPcYmcJqbzROzsBWEOAtw6A7dIfqXs=
github.com/shirou/gopsutil/v4 v4.25.6/go.mod h1:PfybzyydfZcN+JMMjkF6Zb8Mq1A/VcogFFg7hj50W9c=
github.com/showwin/speedtest-go v1.7.10 h1:9o5zb7KsuzZKn+IE2//z5btLKJ870JwO6ETayUkqRFw=
github.com/showwin/speedtest-go v1.7.10/go.mod h1:Ei7OCTmNPdWofMadzcfgq1rUO7mvJy9Jycj//G7vyfA=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
@@ -200,15 +202,16 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM=
github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU=
github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY=
github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY=
github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE=
github.com/tklauser/numcpus v0.9.0 h1:lmyCHtANi8aRUgkckBgoDk1nHCux3n2cgkJLXdQGPDo=
github.com/tklauser/numcpus v0.9.0/go.mod h1:SN6Nq1O3VychhC1npsWostA+oW+VOQTxZrS604NSRyI=
github.com/tsosunchia/powclient v0.2.0 h1:BDrI3O69CbzarbD+CnnY10Kuwn8xlmtQR0m5tBp+BG8=
github.com/tsosunchia/powclient v0.2.0/go.mod h1:fkb7tTW+HMH3ZWZzQUgwvvFKMj/8Ys+C8Sm/uGQzDA0=
github.com/xjasonlyu/windivert-go v0.0.0-20201010013527-4239d0afa76f h1:glX3VZCYwW1/OmFxOjazfCtBLxXB3YNZk9LF2lYx+Lw=
@@ -220,8 +223,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko=
go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o=
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
@@ -233,14 +236,14 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
@@ -249,14 +252,14 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -266,38 +269,37 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ=
golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA=
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@@ -27,7 +27,7 @@ import (
)
var (
ecsVersion = "v0.1.101" // 融合怪版本号
ecsVersion = "v0.1.113" // 融合怪版本号
configs = params.NewConfig(ecsVersion) // 全局配置实例
userSetFlags = make(map[string]bool) // 用于跟踪哪些参数是用户显式设置的
)
@@ -83,6 +83,7 @@ func main() {
basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string
output, tempOutput string
outputMutex sync.Mutex
infoMutex sync.Mutex // 保护并发字符串写入
)
startTime := time.Now()
uploadDone := make(chan bool, 1)
@@ -91,9 +92,9 @@ func main() {
go runner.HandleSignalInterrupt(sig, configs, &startTime, &output, tempOutput, uploadDone, &outputMutex)
switch configs.Language {
case "zh":
runner.RunChineseTests(preCheck, configs, &wg1, &wg2, &wg3, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, &output, tempOutput, startTime, &outputMutex)
runner.RunChineseTests(preCheck, configs, &wg1, &wg2, &wg3, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, &output, tempOutput, startTime, &outputMutex, &infoMutex)
case "en":
runner.RunEnglishTests(preCheck, configs, &wg1, &wg2, &wg3, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, &output, tempOutput, startTime, &outputMutex)
runner.RunEnglishTests(preCheck, configs, &wg1, &wg2, &wg3, &basicInfo, &securityInfo, &emailInfo, &mediaInfo, &ptInfo, &output, tempOutput, startTime, &outputMutex, &infoMutex)
default:
fmt.Println("Unsupported language")
}

View File

@@ -152,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.100"
ECS_VERSION="0.1.112"
for api in \
"https://api.github.com/repos/oneclickvirt/ecs/releases/latest" \
"https://githubapi.spiritlhl.workers.dev/repos/oneclickvirt/ecs/releases/latest" \
@@ -164,8 +164,8 @@ goecs_check() {
sleep 1
done
if [ -z "$ECS_VERSION" ]; then
_yellow "Unable to get version info, using default version 0.1.100"
ECS_VERSION="0.1.100"
_yellow "Unable to get version info, using default version 0.1.112"
ECS_VERSION="0.1.112"
fi
version_output=""
for cmd_path in "goecs" "./goecs" "/usr/bin/goecs" "/usr/local/bin/goecs"; do

View File

@@ -21,7 +21,7 @@ func GetMenuChoice(language string) string {
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
defer signal.Stop(sigChan)
inputChan := make(chan string, 1)
go func() {
select {
case <-sigChan:
@@ -31,43 +31,33 @@ func GetMenuChoice(language string) string {
return
}
}()
for {
go func() {
var input string
fmt.Print("请输入选项 / Please enter your choice: ")
fmt.Scanln(&input)
input = strings.TrimSpace(input)
input = strings.TrimRight(input, "\n")
select {
case inputChan <- input:
case <-ctx.Done():
return
}
}()
select {
case input := <-inputChan:
re := regexp.MustCompile(`^\d+$`)
if re.MatchString(input) {
inChoice := input
switch inChoice {
case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
return inChoice
default:
if language == "zh" {
fmt.Println("无效的选项")
} else {
fmt.Println("Invalid choice")
}
}
} else {
var input string
fmt.Print("请输入选项 / Please enter your choice: ")
fmt.Scanln(&input)
input = strings.TrimSpace(input)
input = strings.TrimRight(input, "\n")
re := regexp.MustCompile(`^\d+$`)
if re.MatchString(input) {
inChoice := input
switch inChoice {
case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
return inChoice
default:
if language == "zh" {
fmt.Println("输入错误,请输入一个纯数字")
fmt.Println("无效的选项")
} else {
fmt.Println("Invalid input, please enter a number")
fmt.Println("Invalid choice")
}
}
case <-ctx.Done():
return ""
} else {
if language == "zh" {
fmt.Println("输入错误,请输入一个纯数字")
} else {
fmt.Println("Invalid input, please enter a number")
}
}
}
}

View File

@@ -53,11 +53,19 @@ func NewConfig(version string) *Config {
return &Config{
EcsVersion: version,
MenuMode: true,
OnlyChinaTest: false,
Input: "",
Choice: "",
ShowVersion: false,
EnableLogger: false,
Language: "zh",
CpuTestMethod: "sysbench",
CpuTestThreadMode: "multi",
MemoryTestMethod: "stream",
DiskTestMethod: "fio",
DiskTestPath: "",
DiskMultiCheck: false,
Nt3CheckType: "ipv4",
SpNum: 2,
Width: 82,
BasicStatus: true,
@@ -70,11 +78,15 @@ func NewConfig(version string) *Config {
BacktraceStatus: true,
Nt3Status: true,
SpeedTestStatus: true,
Nt3Location: "GZ",
Nt3CheckType: "ipv4",
PingTestStatus: false,
TgdcTestStatus: false,
WebTestStatus: false,
AutoChangeDiskMethod: true,
FilePath: "goecs.txt",
EnableUpload: true,
OnlyIpInfoCheck: false,
Help: false,
Finish: false,
UserSetFlags: make(map[string]bool),
GoecsFlag: flag.NewFlagSet("goecs", flag.ContinueOnError),
}
@@ -87,6 +99,7 @@ func (c *Config) ParseFlags(args []string) {
c.GoecsFlag.BoolVar(&c.ShowVersion, "v", false, "Display version information")
c.GoecsFlag.BoolVar(&c.ShowVersion, "version", false, "Display version information")
c.GoecsFlag.BoolVar(&c.MenuMode, "menu", true, "Enable/Disable menu mode, disable example: -menu=false")
c.GoecsFlag.StringVar(&c.Language, "lang", "zh", "Set language (supported: en, zh)")
c.GoecsFlag.StringVar(&c.Language, "l", "zh", "Set language (supported: en, zh)")
c.GoecsFlag.BoolVar(&c.BasicStatus, "basic", true, "Enable/Disable basic test")
c.GoecsFlag.BoolVar(&c.CpuTestStatus, "cpu", true, "Enable/Disable CPU test")
@@ -102,13 +115,19 @@ func (c *Config) ParseFlags(args []string) {
c.GoecsFlag.BoolVar(&c.TgdcTestStatus, "tgdc", false, "Enable/Disable Telegram DC test")
c.GoecsFlag.BoolVar(&c.WebTestStatus, "web", false, "Enable/Disable popular websites test")
c.GoecsFlag.StringVar(&c.CpuTestMethod, "cpum", "sysbench", "Set CPU test method (supported: sysbench, geekbench, winsat)")
c.GoecsFlag.StringVar(&c.CpuTestMethod, "cpu-method", "sysbench", "Set CPU test method (supported: sysbench, geekbench, winsat)")
c.GoecsFlag.StringVar(&c.CpuTestThreadMode, "cput", "multi", "Set CPU test thread mode (supported: single, multi)")
c.GoecsFlag.StringVar(&c.CpuTestThreadMode, "cpu-thread", "multi", "Set CPU test thread mode (supported: single, multi)")
c.GoecsFlag.StringVar(&c.MemoryTestMethod, "memorym", "stream", "Set memory test method (supported: stream, sysbench, dd, winsat, auto)")
c.GoecsFlag.StringVar(&c.MemoryTestMethod, "memory-method", "stream", "Set memory test method (supported: stream, sysbench, dd, winsat, auto)")
c.GoecsFlag.StringVar(&c.DiskTestMethod, "diskm", "fio", "Set disk test method (supported: fio, dd, winsat)")
c.GoecsFlag.StringVar(&c.DiskTestMethod, "disk-method", "fio", "Set disk test method (supported: fio, dd, winsat)")
c.GoecsFlag.StringVar(&c.DiskTestPath, "diskp", "", "Set disk test path, e.g., -diskp /root")
c.GoecsFlag.BoolVar(&c.DiskMultiCheck, "diskmc", false, "Enable/Disable multiple disk checks, e.g., -diskmc=false")
c.GoecsFlag.StringVar(&c.Nt3Location, "nt3loc", "GZ", "Specify NT3 test location (supported: GZ, SH, BJ, CD, ALL for Guangzhou, Shanghai, Beijing, Chengdu and all)")
c.GoecsFlag.StringVar(&c.Nt3Location, "nt3-location", "GZ", "Specify NT3 test location (supported: GZ, SH, BJ, CD, ALL for Guangzhou, Shanghai, Beijing, Chengdu and all)")
c.GoecsFlag.StringVar(&c.Nt3CheckType, "nt3t", "ipv4", "Set NT3 test type (supported: both, ipv4, ipv6)")
c.GoecsFlag.StringVar(&c.Nt3CheckType, "nt3-type", "ipv4", "Set NT3 test type (supported: both, ipv4, ipv6)")
c.GoecsFlag.IntVar(&c.SpNum, "spnum", 2, "Set the number of servers per operator for speed test")
c.GoecsFlag.BoolVar(&c.EnableLogger, "log", false, "Enable/Disable logging in the current path")
c.GoecsFlag.BoolVar(&c.EnableUpload, "upload", true, "Enable/Disable upload the result")
@@ -176,16 +195,16 @@ func (c *Config) SaveUserSetParams() map[string]interface{} {
if c.UserSetFlags["web"] {
saved["web"] = c.WebTestStatus
}
if c.UserSetFlags["cpum"] {
if c.UserSetFlags["cpum"] || c.UserSetFlags["cpu-method"] {
saved["cpum"] = c.CpuTestMethod
}
if c.UserSetFlags["cput"] {
if c.UserSetFlags["cput"] || c.UserSetFlags["cpu-thread"] {
saved["cput"] = c.CpuTestThreadMode
}
if c.UserSetFlags["memorym"] {
if c.UserSetFlags["memorym"] || c.UserSetFlags["memory-method"] {
saved["memorym"] = c.MemoryTestMethod
}
if c.UserSetFlags["diskm"] {
if c.UserSetFlags["diskm"] || c.UserSetFlags["disk-method"] {
saved["diskm"] = c.DiskTestMethod
}
if c.UserSetFlags["diskp"] {
@@ -194,10 +213,10 @@ func (c *Config) SaveUserSetParams() map[string]interface{} {
if c.UserSetFlags["diskmc"] {
saved["diskmc"] = c.DiskMultiCheck
}
if c.UserSetFlags["nt3loc"] {
if c.UserSetFlags["nt3loc"] || c.UserSetFlags["nt3-location"] {
saved["nt3loc"] = c.Nt3Location
}
if c.UserSetFlags["nt3t"] {
if c.UserSetFlags["nt3t"] || c.UserSetFlags["nt3-type"] {
saved["nt3t"] = c.Nt3CheckType
}
if c.UserSetFlags["spnum"] {
@@ -210,72 +229,116 @@ func (c *Config) SaveUserSetParams() map[string]interface{} {
// RestoreUserSetParams restores user-set parameters
func (c *Config) RestoreUserSetParams(saved map[string]interface{}) {
if val, ok := saved["basic"]; ok {
c.BasicStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.BasicStatus = boolVal
}
}
if val, ok := saved["cpu"]; ok {
c.CpuTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.CpuTestStatus = boolVal
}
}
if val, ok := saved["memory"]; ok {
c.MemoryTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.MemoryTestStatus = boolVal
}
}
if val, ok := saved["disk"]; ok {
c.DiskTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.DiskTestStatus = boolVal
}
}
if val, ok := saved["ut"]; ok {
c.UtTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.UtTestStatus = boolVal
}
}
if val, ok := saved["security"]; ok {
c.SecurityTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.SecurityTestStatus = boolVal
}
}
if val, ok := saved["email"]; ok {
c.EmailTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.EmailTestStatus = boolVal
}
}
if val, ok := saved["backtrace"]; ok {
c.BacktraceStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.BacktraceStatus = boolVal
}
}
if val, ok := saved["nt3"]; ok {
c.Nt3Status = val.(bool)
if boolVal, ok := val.(bool); ok {
c.Nt3Status = boolVal
}
}
if val, ok := saved["speed"]; ok {
c.SpeedTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.SpeedTestStatus = boolVal
}
}
if val, ok := saved["ping"]; ok {
c.PingTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.PingTestStatus = boolVal
}
}
if val, ok := saved["tgdc"]; ok {
c.TgdcTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.TgdcTestStatus = boolVal
}
}
if val, ok := saved["web"]; ok {
c.WebTestStatus = val.(bool)
if boolVal, ok := val.(bool); ok {
c.WebTestStatus = boolVal
}
}
if val, ok := saved["cpum"]; ok {
c.CpuTestMethod = val.(string)
if strVal, ok := val.(string); ok {
c.CpuTestMethod = strVal
}
}
if val, ok := saved["cput"]; ok {
c.CpuTestThreadMode = val.(string)
if strVal, ok := val.(string); ok {
c.CpuTestThreadMode = strVal
}
}
if val, ok := saved["memorym"]; ok {
c.MemoryTestMethod = val.(string)
if strVal, ok := val.(string); ok {
c.MemoryTestMethod = strVal
}
}
if val, ok := saved["diskm"]; ok {
c.DiskTestMethod = val.(string)
if strVal, ok := val.(string); ok {
c.DiskTestMethod = strVal
}
}
if val, ok := saved["diskp"]; ok {
c.DiskTestPath = val.(string)
if strVal, ok := val.(string); ok {
c.DiskTestPath = strVal
}
}
if val, ok := saved["diskmc"]; ok {
c.DiskMultiCheck = val.(bool)
if boolVal, ok := val.(bool); ok {
c.DiskMultiCheck = boolVal
}
}
if val, ok := saved["nt3loc"]; ok {
if c.Choice != "10" {
c.Nt3Location = val.(string)
if strVal, ok := val.(string); ok {
c.Nt3Location = strVal
}
}
}
if val, ok := saved["nt3t"]; ok {
c.Nt3CheckType = val.(string)
if strVal, ok := val.(string); ok {
c.Nt3CheckType = strVal
}
}
if val, ok := saved["spnum"]; ok {
c.SpNum = val.(int)
if intVal, ok := val.(int); ok {
c.SpNum = intVal
}
}
c.ValidateParams()

View File

@@ -2,6 +2,7 @@ package runner
import (
"bufio"
"context"
"fmt"
"os"
"runtime"
@@ -17,7 +18,7 @@ import (
)
// RunChineseTests runs all tests in Chinese mode
func RunChineseTests(preCheck utils.NetCheckResult, config *params.Config, wg1, wg2, wg3 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo *string, output *string, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) {
func RunChineseTests(preCheck utils.NetCheckResult, config *params.Config, wg1, wg2, wg3 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo *string, output *string, tempOutput string, startTime time.Time, outputMutex *sync.Mutex, infoMutex *sync.Mutex) {
*output = RunBasicTests(preCheck, config, basicInfo, securityInfo, *output, tempOutput, outputMutex)
*output = RunCPUTest(config, *output, tempOutput, outputMutex)
*output = RunMemoryTest(config, *output, tempOutput, outputMutex)
@@ -29,30 +30,39 @@ func RunChineseTests(preCheck utils.NetCheckResult, config *params.Config, wg1,
wg1.Add(1)
go func() {
defer wg1.Done()
*mediaInfo = tests.MediaTest(config.Language)
result := tests.MediaTest(config.Language)
infoMutex.Lock()
*mediaInfo = result
infoMutex.Unlock()
}()
}
if config.EmailTestStatus && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
wg2.Add(1)
go func() {
defer wg2.Done()
*emailInfo = email.EmailCheck()
result := email.EmailCheck()
infoMutex.Lock()
*emailInfo = result
infoMutex.Unlock()
}()
}
if (config.OnlyChinaTest || config.PingTestStatus) && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
wg3.Add(1)
go func() {
defer wg3.Done()
*ptInfo = pt.PingTest()
result := pt.PingTest()
infoMutex.Lock()
*ptInfo = result
infoMutex.Unlock()
}()
}
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
*output = RunStreamingTests(config, wg1, mediaInfo, *output, tempOutput, outputMutex)
*output = RunStreamingTests(config, wg1, mediaInfo, *output, tempOutput, outputMutex, infoMutex)
*output = RunSecurityTests(config, *securityInfo, *output, tempOutput, outputMutex)
*output = RunEmailTests(config, wg2, emailInfo, *output, tempOutput, outputMutex)
*output = RunEmailTests(config, wg2, emailInfo, *output, tempOutput, outputMutex, infoMutex)
}
if runtime.GOOS != "windows" && preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
*output = RunNetworkTests(config, wg3, ptInfo, *output, tempOutput, outputMutex)
*output = RunNetworkTests(config, wg3, ptInfo, *output, tempOutput, outputMutex, infoMutex)
}
if preCheck.Connected && preCheck.StackType != "" && preCheck.StackType != "None" {
*output = RunSpeedTests(config, *output, tempOutput, outputMutex)
@@ -61,7 +71,7 @@ func RunChineseTests(preCheck utils.NetCheckResult, config *params.Config, wg1,
}
// RunEnglishTests runs all tests in English mode
func RunEnglishTests(preCheck utils.NetCheckResult, config *params.Config, wg1, wg2, wg3 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo *string, output *string, tempOutput string, startTime time.Time, outputMutex *sync.Mutex) {
func RunEnglishTests(preCheck utils.NetCheckResult, config *params.Config, wg1, wg2, wg3 *sync.WaitGroup, basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo *string, output *string, tempOutput string, startTime time.Time, outputMutex *sync.Mutex, infoMutex *sync.Mutex) {
*output = RunBasicTests(preCheck, config, basicInfo, securityInfo, *output, tempOutput, outputMutex)
*output = RunCPUTest(config, *output, tempOutput, outputMutex)
*output = RunMemoryTest(config, *output, tempOutput, outputMutex)
@@ -74,19 +84,25 @@ func RunEnglishTests(preCheck utils.NetCheckResult, config *params.Config, wg1,
wg1.Add(1)
go func() {
defer wg1.Done()
*mediaInfo = tests.MediaTest(config.Language)
result := tests.MediaTest(config.Language)
infoMutex.Lock()
*mediaInfo = result
infoMutex.Unlock()
}()
}
if config.EmailTestStatus {
wg2.Add(1)
go func() {
defer wg2.Done()
*emailInfo = email.EmailCheck()
result := email.EmailCheck()
infoMutex.Lock()
*emailInfo = result
infoMutex.Unlock()
}()
}
*output = RunStreamingTests(config, wg1, mediaInfo, *output, tempOutput, outputMutex)
*output = RunStreamingTests(config, wg1, mediaInfo, *output, tempOutput, outputMutex, infoMutex)
*output = RunSecurityTests(config, *securityInfo, *output, tempOutput, outputMutex)
*output = RunEmailTests(config, wg2, emailInfo, *output, tempOutput, outputMutex)
*output = RunEmailTests(config, wg2, emailInfo, *output, tempOutput, outputMutex, infoMutex)
*output = RunEnglishNetworkTests(config, wg3, ptInfo, *output, tempOutput, outputMutex)
*output = RunEnglishSpeedTests(config, *output, tempOutput, outputMutex)
}
@@ -218,7 +234,7 @@ func RunDiskTest(config *params.Config, output, tempOutput string, outputMutex *
}
// RunStreamingTests runs platform unlock tests
func RunStreamingTests(config *params.Config, wg1 *sync.WaitGroup, mediaInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
func RunStreamingTests(config *params.Config, wg1 *sync.WaitGroup, mediaInfo *string, output, tempOutput string, outputMutex *sync.Mutex, infoMutex *sync.Mutex) string {
outputMutex.Lock()
defer outputMutex.Unlock()
return utils.PrintAndCapture(func() {
@@ -229,7 +245,10 @@ func RunStreamingTests(config *params.Config, wg1 *sync.WaitGroup, mediaInfo *st
} else {
utils.PrintCenteredTitle("Cross-Border-Platform-Unlock", config.Width)
}
fmt.Printf("%s", *mediaInfo)
infoMutex.Lock()
info := *mediaInfo
infoMutex.Unlock()
fmt.Printf("%s", info)
}
}, tempOutput, output)
}
@@ -251,7 +270,7 @@ func RunSecurityTests(config *params.Config, securityInfo, output, tempOutput st
}
// RunEmailTests runs email port tests
func RunEmailTests(config *params.Config, wg2 *sync.WaitGroup, emailInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
func RunEmailTests(config *params.Config, wg2 *sync.WaitGroup, emailInfo *string, output, tempOutput string, outputMutex *sync.Mutex, infoMutex *sync.Mutex) string {
outputMutex.Lock()
defer outputMutex.Unlock()
return utils.PrintAndCapture(func() {
@@ -262,13 +281,16 @@ func RunEmailTests(config *params.Config, wg2 *sync.WaitGroup, emailInfo *string
} else {
utils.PrintCenteredTitle("Email-Port-Check", config.Width)
}
fmt.Println(*emailInfo)
infoMutex.Lock()
info := *emailInfo
infoMutex.Unlock()
fmt.Println(info)
}
}, tempOutput, output)
}
// RunNetworkTests runs network tests (Chinese mode)
func RunNetworkTests(config *params.Config, wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput string, outputMutex *sync.Mutex) string {
func RunNetworkTests(config *params.Config, wg3 *sync.WaitGroup, ptInfo *string, output, tempOutput string, outputMutex *sync.Mutex, infoMutex *sync.Mutex) string {
outputMutex.Lock()
defer outputMutex.Unlock()
return utils.PrintAndCapture(func() {
@@ -280,15 +302,18 @@ func RunNetworkTests(config *params.Config, wg3 *sync.WaitGroup, ptInfo *string,
utils.PrintCenteredTitle("三网回程路由检测", config.Width)
tests.NextTrace3Check(config.Language, config.Nt3Location, config.Nt3CheckType)
}
if config.OnlyChinaTest && *ptInfo != "" {
infoMutex.Lock()
info := *ptInfo
infoMutex.Unlock()
if config.OnlyChinaTest && info != "" {
wg3.Wait()
utils.PrintCenteredTitle("PING值检测", config.Width)
fmt.Println(*ptInfo)
fmt.Println(info)
}
if config.PingTestStatus && *ptInfo != "" {
if config.PingTestStatus && info != "" {
wg3.Wait()
utils.PrintCenteredTitle("PING值检测", config.Width)
fmt.Println(*ptInfo)
fmt.Println(info)
if config.TgdcTestStatus {
fmt.Println(pt.TelegramDCTest())
}
@@ -305,6 +330,8 @@ func RunNetworkTests(config *params.Config, wg3 *sync.WaitGroup, ptInfo *string,
fmt.Println(pt.WebsiteTest())
}
}
// 等待第三方库的输出完全刷新到标准输出
time.Sleep(300 * time.Millisecond)
}, tempOutput, output)
}
@@ -323,10 +350,22 @@ func RunSpeedTests(config *params.Config, output, tempOutput string, outputMutex
tests.CustomSP("net", "ct", config.SpNum, config.Language)
tests.CustomSP("net", "cmcc", config.SpNum, config.Language)
} else if config.Choice == "2" || config.Choice == "3" || config.Choice == "4" || config.Choice == "5" {
tests.CustomSP("net", "global", 4, config.Language)
// 中文模式:就近测速 + 三网各1个 + Other 1个带回退
if config.Language == "zh" {
tests.NearbySP()
tests.CustomSP("net", "other", 1, config.Language)
tests.CustomSP("net", "cu", 1, config.Language)
tests.CustomSP("net", "ct", 1, config.Language)
tests.CustomSP("net", "cmcc", 1, config.Language)
} else {
// 英文模式保持原有逻辑测4个global节点
tests.CustomSP("net", "global", 4, config.Language)
}
} else if config.Choice == "6" {
tests.CustomSP("net", "global", 11, config.Language)
}
// 等待第三方库的输出完全刷新到标准输出
time.Sleep(500 * time.Millisecond)
}
}, tempOutput, output)
}
@@ -345,6 +384,8 @@ func RunEnglishNetworkTests(config *params.Config, wg3 *sync.WaitGroup, ptInfo *
fmt.Println(pt.WebsiteTest())
}
}
// 等待第三方库的输出完全刷新到标准输出
time.Sleep(300 * time.Millisecond)
}, tempOutput, output)
}
@@ -358,6 +399,8 @@ func RunEnglishSpeedTests(config *params.Config, output, tempOutput string, outp
tests.ShowHead(config.Language)
tests.NearbySP()
tests.CustomSP("net", "global", -1, config.Language)
// 等待第三方库的输出完全刷新到标准输出
time.Sleep(500 * time.Millisecond)
}
}, tempOutput, output)
}
@@ -414,16 +457,26 @@ func HandleSignalInterrupt(sig chan os.Signal, config *params.Config, startTime
httpsURL string
}, 1)
if config.EnableUpload {
// 使用context来控制上传goroutine
uploadCtx, uploadCancel := context.WithTimeout(context.Background(), 30*time.Second)
defer uploadCancel()
go func() {
httpURL, httpsURL := utils.ProcessAndUpload(finalOutput, config.FilePath, config.EnableUpload)
resultChan <- struct {
select {
case resultChan <- struct {
httpURL string
httpsURL string
}{httpURL, httpsURL}
uploadDone <- true
}{httpURL, httpsURL}:
case <-uploadCtx.Done():
// 上传被取消或超时,直接返回
return
}
}()
select {
case result := <-resultChan:
uploadCancel() // 成功完成取消context
if result.httpURL != "" || result.httpsURL != "" {
if config.Language == "en" {
fmt.Printf("Upload successfully!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL)
@@ -437,7 +490,7 @@ func HandleSignalInterrupt(sig chan os.Signal, config *params.Config, startTime
fmt.Scanln()
}
os.Exit(0)
case <-time.After(30 * time.Second):
case <-uploadCtx.Done():
if config.Language == "en" {
fmt.Println("Upload timeout, program exit")
} else {

View File

@@ -1,6 +1,8 @@
package tests
import (
"fmt"
"os"
"runtime"
"strings"
@@ -8,6 +10,14 @@ import (
)
func CpuTest(language, testMethod, testThread string) (realTestMethod, res string) {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] CpuTest panic: %v\n", r)
res = fmt.Sprintf("\nCPU test failed: %v\n", r)
realTestMethod = "error"
}
}()
if runtime.GOOS == "windows" {
if testMethod != "winsat" && testMethod != "" {
// res = "Detected host is Windows, using Winsat for testing.\n"

View File

@@ -1,6 +1,8 @@
package tests
import (
"fmt"
"os"
"runtime"
"strings"
@@ -8,6 +10,14 @@ import (
)
func DiskTest(language, testMethod, testPath string, isMultiCheck bool, autoChange bool) (realTestMethod, res string) {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] DiskTest panic: %v\n", r)
res = fmt.Sprintf("\nDisk test failed: %v\n", r)
realTestMethod = "error"
}
}()
switch testMethod {
case "fio":
res = disk.FioTest(language, isMultiCheck, testPath)

View File

@@ -1,6 +1,8 @@
package tests
import (
"fmt"
"os"
"runtime"
"strings"
@@ -8,6 +10,14 @@ import (
)
func MemoryTest(language, testMethod string) (realTestMethod, res string) {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] MemoryTest panic: %v\n", r)
res = fmt.Sprintf("\nMemory test failed: %v\n", r)
realTestMethod = "error"
}
}()
testMethod = strings.ToLower(testMethod)
if testMethod == "" {
testMethod = "auto"
@@ -15,51 +25,132 @@ func MemoryTest(language, testMethod string) (realTestMethod, res string) {
if runtime.GOOS == "windows" {
switch testMethod {
case "stream":
res = memory.WinsatTest(language)
realTestMethod = "winsat"
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.WinsatTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.WindowsDDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "dd"
}
} else {
realTestMethod = "winsat"
}
} else {
realTestMethod = "stream"
}
case "dd":
res = memory.WindowsDDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res += memory.WinsatTest(language)
realTestMethod = "winsat"
res = memory.WinsatTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "stream"
}
} else {
realTestMethod = "winsat"
}
} else {
realTestMethod = "dd"
}
case "sysbench":
// Windows下不支持sysbench使用stream → winsat → dd
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.WinsatTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.WindowsDDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "dd"
}
} else {
realTestMethod = "winsat"
}
} else {
realTestMethod = "stream"
}
case "auto":
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.WinsatTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.WindowsDDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "dd"
}
} else {
realTestMethod = "winsat"
}
} else {
realTestMethod = "stream"
}
case "winsat":
res = memory.WinsatTest(language)
realTestMethod = "winsat"
case "auto", "winsat":
res = memory.WinsatTest(language)
realTestMethod = "winsat"
if res == "" || strings.TrimSpace(res) == "" {
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.WindowsDDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "dd"
}
} else {
realTestMethod = "stream"
}
} else {
realTestMethod = "winsat"
}
default:
res = memory.WinsatTest(language)
realTestMethod = "winsat"
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.WinsatTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.WindowsDDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "dd"
}
} else {
realTestMethod = "winsat"
}
} else {
realTestMethod = "stream"
}
}
} else {
switch testMethod {
case "stream":
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res += memory.DDTest(language)
realTestMethod = "dd"
res = memory.SysBenchTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.DDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "dd"
}
} else {
realTestMethod = "sysbench"
}
} else {
realTestMethod = "stream"
}
case "dd":
res = memory.DDTest(language)
realTestMethod = "dd"
case "sysbench":
res = memory.SysBenchTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res += memory.DDTest(language)
realTestMethod = "dd"
} else {
realTestMethod = "sysbench"
}
case "auto":
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.DDTest(language)
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.SysBenchTest(language)
if res == "" || strings.TrimSpace(res) == "" {
@@ -68,15 +159,68 @@ func MemoryTest(language, testMethod string) (realTestMethod, res string) {
realTestMethod = "sysbench"
}
} else {
realTestMethod = "dd"
realTestMethod = "stream"
}
} else {
realTestMethod = "dd"
}
case "sysbench":
res = memory.SysBenchTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.SysBenchTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.DDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "dd"
}
} else {
realTestMethod = "sysbench"
}
} else {
realTestMethod = "stream"
}
} else {
realTestMethod = "sysbench"
}
case "auto":
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.SysBenchTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.DDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "dd"
}
} else {
realTestMethod = "sysbench"
}
} else {
realTestMethod = "stream"
}
case "winsat":
// winsat 仅 Windows 支持,非 Windows fallback 到 dd
res = memory.DDTest(language)
realTestMethod = "dd"
// winsat 仅 Windows 支持,非 Windows fallback 到 stream → sysbench → dd
res = memory.StreamTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.SysBenchTest(language)
if res == "" || strings.TrimSpace(res) == "" {
res = memory.DDTest(language)
if res == "" || strings.TrimSpace(res) == "" {
realTestMethod = ""
} else {
realTestMethod = "dd"
}
} else {
realTestMethod = "sysbench"
}
} else {
realTestMethod = "stream"
}
default:
res = "Unsupported test method"
realTestMethod = ""

View File

@@ -2,14 +2,55 @@ package tests
import (
"fmt"
"net"
"os"
"strings"
"github.com/oneclickvirt/nt3/nt"
)
func NextTrace3Check(language, nt3Location, nt3CheckType string) {
// 先检查 ICMP 权限
conn, err := net.ListenPacket("ip4:icmp", "0.0.0.0")
if err != nil {
// 没有权限,显示友好提示并跳过
if language == "zh" {
fmt.Println("路由追踪测试需要 root 权限或 CAP_NET_RAW 能力,已跳过")
fmt.Fprintf(os.Stderr, "[WARN] ICMP权限不足: %v\n", err)
} else {
fmt.Println("Route tracing test requires root privileges or CAP_NET_RAW capability, skipped")
fmt.Fprintf(os.Stderr, "[WARN] Insufficient ICMP permission: %v\n", err)
}
return
}
conn.Close()
defer func() {
if r := recover(); r != nil {
if language == "zh" {
fmt.Println("路由追踪测试出现错误,已跳过")
fmt.Fprintf(os.Stderr, "[WARN] 路由追踪panic: %v\n", r)
} else {
fmt.Println("Route tracing test failed, skipped")
fmt.Fprintf(os.Stderr, "[WARN] Route tracing panic: %v\n", r)
}
}
}()
resultChan := make(chan nt.TraceResult, 100)
go nt.TraceRoute(language, nt3Location, nt3CheckType, resultChan)
errorOccurred := false
go func() {
defer func() {
if r := recover(); r != nil {
errorOccurred = true
resultChan <- nt.TraceResult{
Index: -1,
ISPName: "Error",
Output: []string{fmt.Sprintf("Route tracing error: %v", r)},
}
close(resultChan)
}
}()
nt.TraceRoute(language, nt3Location, nt3CheckType, resultChan)
}()
for result := range resultChan {
if result.Index == -1 {
for index, res := range result.Output {
@@ -21,12 +62,18 @@ func NextTrace3Check(language, nt3Location, nt3CheckType string) {
continue
}
if result.ISPName == "Error" {
if language == "zh" {
fmt.Println("路由追踪测试失败(可能因为权限不足),已跳过")
} else {
fmt.Println("Route tracing test failed (possibly due to insufficient permissions), skipped")
}
for _, res := range result.Output {
res = strings.TrimSpace(res)
if res != "" {
fmt.Println(res)
fmt.Fprintf(os.Stderr, "[WARN] %s\n", res)
}
}
errorOccurred = true
continue
}
for _, res := range result.Output {
@@ -41,4 +88,11 @@ func NextTrace3Check(language, nt3Location, nt3CheckType string) {
}
}
}
if errorOccurred {
if language == "zh" {
fmt.Println("提示: 路由追踪需要 root 权限或 CAP_NET_RAW 能力")
} else {
fmt.Println("Hint: Route tracing requires root privileges or CAP_NET_RAW capability")
}
}
}

View File

@@ -1,18 +1,32 @@
package tests
import (
"fmt"
"os"
"runtime"
"strings"
"time"
"github.com/oneclickvirt/privatespeedtest/pst"
"github.com/oneclickvirt/speedtest/model"
"github.com/oneclickvirt/speedtest/sp"
)
func ShowHead(language string) {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] ShowHead panic: %v\n", r)
}
}()
sp.ShowHead(language)
}
func NearbySP() {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] NearbySP panic: %v\n", r)
}
}()
if runtime.GOOS == "windows" || sp.OfficialAvailableTest() != nil {
sp.NearbySpeedTest()
} else {
@@ -20,7 +34,209 @@ func NearbySP() {
}
}
// formatString 格式化字符串到指定宽度
func formatString(s string, width int) string {
return fmt.Sprintf("%-*s", width, s)
}
// printTableRow 打印表格行
func printTableRow(result pst.SpeedTestResult) {
location := result.City
if result.CarrierType != "" {
carrier := result.CarrierType
switch carrier {
case "Telecom":
carrier = "电信"
case "Unicom":
carrier = "联通"
case "Mobile":
carrier = "移动"
case "Other":
carrier = "其他"
}
location = fmt.Sprintf("%s%s", carrier, result.City)
}
if len(location) > 15 {
location = location[:15]
}
upload := "N/A"
if result.UploadMbps > 0 {
upload = fmt.Sprintf("%.2f Mbps", result.UploadMbps)
}
download := "N/A"
if result.DownloadMbps > 0 {
download = fmt.Sprintf("%.2f Mbps", result.DownloadMbps)
}
latency := fmt.Sprintf("%.2f ms", result.PingLatency.Seconds()*1000)
packetLoss := "N/A"
fmt.Print(formatString(location, 15))
fmt.Print(formatString(upload, 16))
fmt.Print(formatString(download, 16))
fmt.Print(formatString(latency, 16))
fmt.Print(formatString(packetLoss, 16))
fmt.Println()
}
// privateSpeedTest 使用 privatespeedtest 进行单个运营商测速
// operator 参数:只支持 "cmcc"、"cu"、"ct"、"other"
// 返回值:实际测试的节点数量和错误信息
func privateSpeedTest(num int, operator string) (int, error) {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] privateSpeedTest panic: %v\n", r)
}
}()
*pst.NoProgress = true
*pst.Quiet = true
*pst.NoHeader = true
*pst.NoProjectURL = true
// 加载服务器列表
serverList, err := pst.LoadServerList()
if err != nil {
return 0, fmt.Errorf("加载自定义服务器列表失败")
}
// 使用三网测速模式(每个运营商选择指定数量的最低延迟节点)
serversPerISP := num
if serversPerISP <= 0 || serversPerISP > 5 {
serversPerISP = 2
}
// 单个运营商测速:先过滤服务器列表
var carrierType string
switch strings.ToLower(operator) {
case "cmcc":
carrierType = "Mobile"
case "cu":
carrierType = "Unicom"
case "ct":
carrierType = "Telecom"
case "other":
carrierType = "Other"
default:
return 0, fmt.Errorf("不支持的运营商类型: %s", operator)
}
// 过滤出指定运营商的服务器
filteredServers := pst.FilterServersByISP(serverList.Servers, carrierType)
// 先找足够多的候选服务器用于去重(找 serversPerISP * 3 个,确保去重后还能剩下足够的服务器)
candidateCount := serversPerISP * 3
if candidateCount > len(filteredServers) {
candidateCount = len(filteredServers)
}
// 使用 FindBestServers 选择最佳服务器
candidateServers, err := pst.FindBestServers(
filteredServers,
candidateCount, // 选择更多候选节点用于去重
5*time.Second, // ping 超时
true, // 显示进度条
true, // 静默
)
if err != nil {
return 0, fmt.Errorf("分组查找失败")
}
// 去重:确保同一运营商内城市不重复
seenCities := make(map[string]bool)
var bestServers []pst.ServerWithLatencyInfo
// 保留更多备用节点,以应对测速失败的情况(保留 serversPerISP * 2 个备用节点)
maxBackupServers := serversPerISP * 2
for _, serverInfo := range candidateServers {
city := serverInfo.Server.City
if city == "" {
city = "Unknown"
}
if !seenCities[city] {
seenCities[city] = true
bestServers = append(bestServers, serverInfo)
// 去重后保留足够的备用节点
if len(bestServers) >= maxBackupServers {
break
}
}
}
if len(bestServers) == 0 {
return 0, fmt.Errorf("去重后没有可用的服务器")
}
// 执行测速并逐个打印结果(不打印表头)
// 统计成功输出的节点数
successCount := 0
for i, serverInfo := range bestServers {
// 如果已经成功输出了足够的节点,则停止测试
if successCount >= serversPerISP {
break
}
result := pst.RunSpeedTest(
serverInfo.Server,
false, // 不禁用下载测试
false, // 不禁用上传测试
6, // 并发线程数
12*time.Second, // 超时时间
&serverInfo,
false, // 不显示进度条
)
// 只要测试成功且有任意一个速度值有效,就输出结果(部分成功也显示)
if result.Success && (result.UploadMbps > 0 || result.DownloadMbps > 0) {
printTableRow(result)
// 只有上传和下载都成功时才计入成功数
if result.UploadMbps > 0 && result.DownloadMbps > 0 {
successCount++
}
}
// 在测试之间暂停(如果还需要继续测试的话)
if successCount < serversPerISP && i < len(bestServers)-1 {
time.Sleep(1 * time.Second)
}
}
// 返回实际成功输出的节点数量
return successCount, nil
}
// privateSpeedTestWithFallback 使用私有测速,如果失败则回退到 global 节点
// 主要用于 Other 类型的测速
func privateSpeedTestWithFallback(num int, operator, language string) {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] privateSpeedTestWithFallback panic: %v\n", r)
}
}()
// 先尝试私有节点测速
testedCount, err := privateSpeedTest(num, operator)
if err != nil || testedCount == 0 {
// 私有节点失败,回退到 global 节点
var url, parseType string
url = model.NetGlobal
parseType = "id"
if runtime.GOOS == "windows" || sp.OfficialAvailableTest() != nil {
sp.CustomSpeedTest(url, parseType, num, language)
} else {
sp.OfficialCustomSpeedTest(url, parseType, num, language)
}
}
}
func CustomSP(platform, operator string, num int, language string) {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] CustomSP panic: %v\n", r)
}
}()
// 对于三网测速cmcc、cu、ct和 other优先使用 privatespeedtest 进行私有测速
opLower := strings.ToLower(operator)
if opLower == "cmcc" || opLower == "cu" || opLower == "ct" || opLower == "other" {
testedCount, err := privateSpeedTest(num, opLower)
if err != nil {
fmt.Fprintf(os.Stderr, "[WARN] privatespeedtest failed: %v\n", err)
// 全部失败,继续使用原有的公共节点兜底方案
} else if testedCount >= num {
// 私有节点测速成功且数量达标,直接返回
return
} else if testedCount > 0 {
// 部分私有节点测速成功,但数量不足,用公共节点补充
fmt.Fprintf(os.Stderr, "[INFO] 私有节点仅测试了 %d 个,补充 %d 个公共节点\n", testedCount, num-testedCount)
num = num - testedCount // 只测剩余数量的公共节点
// 继续执行下面的公共节点测速逻辑
} else {
// testedCount == 0继续使用公共节点
}
}
var url, parseType string
if strings.ToLower(platform) == "cn" {
if strings.ToLower(operator) == "cmcc" {
@@ -54,7 +270,8 @@ func CustomSP(platform, operator string, num int, language string) {
url = model.NetJP
} else if strings.ToLower(operator) == "sg" {
url = model.NetSG
} else if strings.ToLower(operator) == "global" {
} else if strings.ToLower(operator) == "global" || strings.ToLower(operator) == "other" {
// other 类型回退到 global 节点
url = model.NetGlobal
}
parseType = "id"

View File

@@ -1,12 +1,21 @@
package tests
import (
"fmt"
"os"
"github.com/oneclickvirt/UnlockTests/executor"
"github.com/oneclickvirt/UnlockTests/utils"
"github.com/oneclickvirt/defaultset"
)
func MediaTest(language string) string {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] MediaTest panic: %v\n", r)
}
}()
var res string
readStatus := executor.ReadSelect(language, "0")
if !readStatus {

View File

@@ -2,6 +2,7 @@ package tests
import (
"fmt"
"os"
"sync"
"time"
@@ -29,12 +30,25 @@ type ConcurrentResults struct {
var IPV4, IPV6 string
func UpstreamsCheck() {
// 添加panic恢复机制
defer func() {
if r := recover(); r != nil {
fmt.Println("\n上游检测出现错误已跳过")
fmt.Fprintf(os.Stderr, "[WARN] Upstream check panic: %v\n", r)
}
}()
results := ConcurrentResults{}
var wg sync.WaitGroup
if IPV4 != "" {
wg.Add(1)
go func() {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] BGP info panic: %v\n", r)
}
}()
for i := 0; i < 2; i++ {
result, err := bgptools.GetPoPInfo(IPV4)
results.bgpError = err
@@ -51,6 +65,11 @@ func UpstreamsCheck() {
wg.Add(1)
go func() {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "[WARN] Backtrace panic: %v\n", r)
}
}()
result := backtrace.BackTrace(executor.IPV6)
results.backtraceResult = result
}()

View File

@@ -203,19 +203,10 @@ func CaptureOutput(f func()) string {
// 替换标准输出和标准错误输出为管道写入端
os.Stdout = stdoutPipeW
os.Stderr = stderrPipeW
// 恢复标准输出和标准错误输出
defer func() {
os.Stdout = oldStdout
os.Stderr = oldStderr
stdoutPipeW.Close()
stderrPipeW.Close()
stdoutPipeR.Close()
stderrPipeR.Close()
}()
// 缓冲区
var stdoutBuf, stderrBuf bytes.Buffer
// 并发读取 stdout 和 stderr
done := make(chan struct{})
done := make(chan struct{}, 2)
go func() {
multiWriter := io.MultiWriter(&stdoutBuf, oldStdout)
io.Copy(multiWriter, stdoutPipeR)
@@ -228,12 +219,22 @@ func CaptureOutput(f func()) string {
}()
// 执行函数
f()
// 确保所有输出都已经刷新
os.Stdout.Sync()
os.Stderr.Sync()
// 等待一小段时间确保后台goroutine的输出完成
time.Sleep(100 * time.Millisecond)
// 关闭管道写入端,让管道读取端可以读取所有数据
stdoutPipeW.Close()
stderrPipeW.Close()
// 等待两个 goroutine 完成
<-done
<-done
// 恢复标准输出和标准错误输出,并关闭管道读取端
os.Stdout = oldStdout
os.Stderr = oldStderr
stdoutPipeR.Close()
stderrPipeR.Close()
// 返回捕获的输出字符串
// stderrBuf.String()
return stdoutBuf.String()
@@ -317,7 +318,9 @@ func ProcessAndUpload(output string, filePath string, enableUplaod bool) (string
// 使用 defer 来处理 panic
defer func() {
if r := recover(); r != nil {
fmt.Printf("处理上传时发生错误: %v\n", r)
fmt.Fprintf(os.Stderr, "[ERROR] 处理上传时发生严重错误: %v\n", r)
// 可以选择打印堆栈信息以便调试
// debug.PrintStack()
}
}()
// 检查文件是否存在
@@ -425,6 +428,8 @@ func CheckPublicAccess(timeout time.Duration) NetCheckResult {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
// 记录panic但不影响其他检查输出到stderr避免污染主输出
fmt.Fprintf(os.Stderr, "[WARN] Panic in network check for %s (%s): %v\n", tag, addr, r)
}
}()
switch kind {