Update nodeloc_vps_autotest_trace.sh

This commit is contained in:
Jensfrank 2024-06-28 01:07:57 +08:00 committed by GitHub
parent e2659b05be
commit 37a5bdc593
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,7 +33,6 @@ install_dependencies() {
local dependencies=(
"curl"
"wget"
"xclip"
"iperf3"
"mtr"
"traceroute"
@ -95,14 +94,7 @@ show_welcome() {
echo -e "${RED}---------------------------------By'Jensfrank---------------------------------${NC}"
echo ""
echo "一键脚本将测试以下项目:"
echo "1. Yabs"
echo "2. 融合怪"
echo "3. IP质量"
echo "4. 流媒体解锁"
echo "5. 响应测试"
echo "6. 多线程测试"
echo "7. 单线程测试"
echo "8. 回程路由"
echo "回程路由"
echo ""
echo -e "${RED}按任意键开始测试...${NC}"
read -n 1 -s
@ -112,13 +104,6 @@ show_welcome() {
# 定义一个数组来存储每个命令的输出
declare -a test_results
# 去除融合怪板块板块ANSI转义码
autotrace_process_output() {
local input="$1"
# 使用更全面的 sed 命令去除所有 ANSI 转义码
echo "$input" | sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g'
}
# 在每个命令执行后保存结果
run_and_capture() {
local command_output
@ -127,13 +112,20 @@ run_and_capture() {
echo "$command_output"
}
# 去除回程路由板块板块ANSI转义码并截取
autotrace_process_output() {
local input="$1"
# 使用更全面的 sed 命令去除所有 ANSI 转义码
echo "$input" | sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g' | awk '/No:1/9 Traceroute/{f=1} f; /[信息] 已删除 Nexttrace 文件/{f=0}'
}
# 运行所有测试
run_all_tests() {
echo -e "${RED}开始测试,测试时间较长,请耐心等待...${NC}"
# AutoTrace三网回程路由
echo -e "运行${YELLOW}AutoTrace三网回程路由...${NC}"
autotrace_result=$(run_and_capture "wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh")
autotrace_result=$(run_and_capture "wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && echo '1' | bash AutoTrace.sh")
# 格式化结果
echo -e "${YELLOW}此报告由Nodeloc_VPS_自动脚本测试生成...${NC}"
@ -142,11 +134,12 @@ run_all_tests() {
# 格式化结果为 Markdown
format_results() {
# 处理回程路由结果
local processed_autotrace_result
processed_autotrace_result=$(autotrace_process_output "$autotrace_result")
result="[tabs]
# 处理回程路由结果
local processed_autotrace_result
processed_autotrace_result=$(autotrace_process_output "$autotrace_result")
result="[tabs]
[tab=\"回程路由\"]
\`\`\`
$processed_autotrace_result