Update Nlbench_pro.sh

This commit is contained in:
Jensfrank 2024-07-02 22:05:45 +08:00 committed by GitHub
parent 806751ecb8
commit 35a65c763a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# 定义版本 # 定义版本
VERSION="2.2.0" VERSION="2.3.0"
# 定义颜色 # 定义颜色
RED='\033[0;31m' RED='\033[0;31m'
@ -199,54 +199,71 @@ generate_markdown() {
echo "- IPv6: $ipv6_address" echo "- IPv6: $ipv6_address"
echo "" echo ""
echo "[tabs]" echo "[tabs]"
echo "[tab=\"YABS\"]"
echo "\`\`\`"
cat yabs_result.txt | escape_markdown
echo "\`\`\`"
echo "[/tab]"
echo "[tab=\"融合怪\"]" [ -f yabs_result.txt ] && {
echo "\`\`\`" echo "[tab=\"YABS\"]"
cat fusion_result.txt | escape_markdown echo "\`\`\`"
echo "\`\`\`" cat yabs_result.txt | escape_markdown
echo "[/tab]" echo "\`\`\`"
echo "[/tab]"
}
echo "[tab=\"IP质量\"]" [ -f fusion_result.txt ] && {
echo "\`\`\`" echo "[tab=\"融合怪\"]"
echo "########################################################################" echo "\`\`\`"
cat ip_quality_result.txt | escape_markdown cat fusion_result.txt | escape_markdown
echo "\`\`\`" echo "\`\`\`"
echo "[/tab]" echo "[/tab]"
}
echo "[tab=\"流媒体\"]" [ -f ip_quality_result.txt ] && {
echo "\`\`\`" echo "[tab=\"IP质量\"]"
cat streaming_result.txt | escape_markdown echo "\`\`\`"
echo "\`\`\`" echo "########################################################################"
echo "[/tab]" cat ip_quality_result.txt | escape_markdown
echo "\`\`\`"
echo "[/tab]"
}
echo "[tab=\"响应\"]" [ -f streaming_result.txt ] && {
echo "\`\`\`" echo "[tab=\"流媒体\"]"
cat response_result.txt | escape_markdown echo "\`\`\`"
echo "\`\`\`" cat streaming_result.txt | escape_markdown
echo "[/tab]" echo "\`\`\`"
echo "[/tab]"
}
echo "[tab=\"多线程测速\"]" [ -f response_result.txt ] && {
echo "\`\`\`" echo "[tab=\"响应\"]"
cat speedtest_multi_result.txt | escape_markdown echo "\`\`\`"
echo "\`\`\`" cat response_result.txt | escape_markdown
echo "[/tab]" echo "\`\`\`"
echo "[/tab]"
}
echo "[tab=\"单线程测速\"]" [ -f speedtest_multi_result.txt ] && {
echo "\`\`\`" echo "[tab=\"多线程测速\"]"
cat speedtest_single_result.txt | escape_markdown echo "\`\`\`"
echo "\`\`\`" cat speedtest_multi_result.txt | escape_markdown
echo "[/tab]" echo "\`\`\`"
echo "[/tab]"
}
echo "[tab=\"回程路由\"]" [ -f speedtest_single_result.txt ] && {
echo "\`\`\`" echo "[tab=\"单线程测速\"]"
cat traceroute_result.txt | escape_markdown echo "\`\`\`"
echo "\`\`\`" cat speedtest_single_result.txt | escape_markdown
echo "[/tab]" echo "\`\`\`"
echo "[/tab]"
}
[ -f traceroute_result.txt ] && {
echo "[tab=\"回程路由\"]"
echo "\`\`\`"
cat traceroute_result.txt | escape_markdown
echo "\`\`\`"
echo "[/tab]"
}
echo "[/tabs]" echo "[/tabs]"
} > "$output_file" } > "$output_file"
@ -277,36 +294,55 @@ main() {
run_streaming run_streaming
run_response run_response
run_speedtest_multi run_speedtest_multi
run_speedtest_single
run_traceroute run_traceroute
generate_markdown
break break
;; ;;
2) 2)
echo "请输入要测试的脚本编号用逗号分隔如1,2,3:" while true; do
echo "1. Yabs" echo "请输入要测试的脚本编号用逗号分隔如1,2,3:"
echo "2. 融合怪" echo "1. Yabs"
echo "3. IP质量" echo "2. 融合怪"
echo "4. 流媒体解锁" echo "3. IP质量"
echo "5. 响应测试" echo "4. 流媒体解锁"
echo "6. 多线程测试" echo "5. 响应测试"
echo "7. 单线程测试" echo "6. 多线程测试"
echo "8. 回程路由" echo "7. 单线程测试"
read -p "输入选择: " scripts echo "8. 回程路由"
IFS=',' read -ra ADDR <<< "$scripts" echo "0. 返回主菜单"
for i in "${ADDR[@]}"; do read -p "输入选择: " scripts
case $i in
1) run_yabs ;; if [ "$scripts" = "0" ]; then
2) run_fusion ;; break
3) run_ip_quality ;; fi
4) run_streaming ;;
5) run_response ;; IFS=',' read -ra ADDR <<< "$scripts"
6) run_speedtest_multi ;; for i in "${ADDR[@]}"; do
7) run_speedtest_single ;; case $i in
8) run_traceroute ;; 1) run_yabs ;;
*) echo "无效的选项: $i" ;; 2) run_fusion ;;
esac 3) run_ip_quality ;;
4) run_streaming ;;
5) run_response ;;
6) run_speedtest_multi ;;
7) run_speedtest_single ;;
8) run_traceroute ;;
*) echo "无效的选项: $i" ;;
esac
done
generate_markdown
# 清理临时文件
rm -f yabs_result.txt fusion_result.txt ip_quality_result.txt streaming_result.txt response_result.txt speedtest_multi_result.txt speedtest_single_result.txt traceroute_result.txt
echo "本次选择的测试已完成并生成报告。"
echo "是否继续选择其他测试?(y/n)"
read -p "输入选择: " continue_choice
if [ "$continue_choice" != "y" ] && [ "$continue_choice" != "Y" ]; then
break
fi
done done
break
;; ;;
0) 0)
echo "感谢使用,再见!" echo "感谢使用,再见!"
@ -318,11 +354,8 @@ main() {
esac esac
done done
# 生成 Markdown 文件 echo "所有测试完成!"
generate_markdown
# 清理临时文件
rm -f yabs_result.txt fusion_result.txt ip_quality_result.txt streaming_result.txt response_result.txt speedtest_multi_result.txt speedtest_single_result.txt traceroute_result.txt
echo "测试完成!结果已保存到 nodeloc_vps_test_$(date +%Y%m%d_%H%M%S).md"
} }
# 执行主函数
main