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]"
[ -f yabs_result.txt ] && {
echo "[tab=\"YABS\"]" echo "[tab=\"YABS\"]"
echo "\`\`\`" echo "\`\`\`"
cat yabs_result.txt | escape_markdown cat yabs_result.txt | escape_markdown
echo "\`\`\`" echo "\`\`\`"
echo "[/tab]" echo "[/tab]"
}
[ -f fusion_result.txt ] && {
echo "[tab=\"融合怪\"]" echo "[tab=\"融合怪\"]"
echo "\`\`\`" echo "\`\`\`"
cat fusion_result.txt | escape_markdown cat fusion_result.txt | escape_markdown
echo "\`\`\`" echo "\`\`\`"
echo "[/tab]" echo "[/tab]"
}
[ -f ip_quality_result.txt ] && {
echo "[tab=\"IP质量\"]" echo "[tab=\"IP质量\"]"
echo "\`\`\`" echo "\`\`\`"
echo "########################################################################" echo "########################################################################"
cat ip_quality_result.txt | escape_markdown cat ip_quality_result.txt | escape_markdown
echo "\`\`\`" echo "\`\`\`"
echo "[/tab]" echo "[/tab]"
}
[ -f streaming_result.txt ] && {
echo "[tab=\"流媒体\"]" echo "[tab=\"流媒体\"]"
echo "\`\`\`" echo "\`\`\`"
cat streaming_result.txt | escape_markdown cat streaming_result.txt | escape_markdown
echo "\`\`\`" echo "\`\`\`"
echo "[/tab]" echo "[/tab]"
}
[ -f response_result.txt ] && {
echo "[tab=\"响应\"]" echo "[tab=\"响应\"]"
echo "\`\`\`" echo "\`\`\`"
cat response_result.txt | escape_markdown cat response_result.txt | escape_markdown
echo "\`\`\`" echo "\`\`\`"
echo "[/tab]" echo "[/tab]"
}
[ -f speedtest_multi_result.txt ] && {
echo "[tab=\"多线程测速\"]" echo "[tab=\"多线程测速\"]"
echo "\`\`\`" echo "\`\`\`"
cat speedtest_multi_result.txt | escape_markdown cat speedtest_multi_result.txt | escape_markdown
echo "\`\`\`" echo "\`\`\`"
echo "[/tab]" echo "[/tab]"
}
[ -f speedtest_single_result.txt ] && {
echo "[tab=\"单线程测速\"]" echo "[tab=\"单线程测速\"]"
echo "\`\`\`" echo "\`\`\`"
cat speedtest_single_result.txt | escape_markdown cat speedtest_single_result.txt | escape_markdown
echo "\`\`\`" echo "\`\`\`"
echo "[/tab]" echo "[/tab]"
}
[ -f traceroute_result.txt ] && {
echo "[tab=\"回程路由\"]" echo "[tab=\"回程路由\"]"
echo "\`\`\`" echo "\`\`\`"
cat traceroute_result.txt | escape_markdown cat traceroute_result.txt | escape_markdown
echo "\`\`\`" echo "\`\`\`"
echo "[/tab]" echo "[/tab]"
}
echo "[/tabs]" echo "[/tabs]"
} > "$output_file" } > "$output_file"
@ -277,11 +294,12 @@ 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)
while true; do
echo "请输入要测试的脚本编号用逗号分隔如1,2,3:" echo "请输入要测试的脚本编号用逗号分隔如1,2,3:"
echo "1. Yabs" echo "1. Yabs"
echo "2. 融合怪" echo "2. 融合怪"
@ -291,7 +309,13 @@ main() {
echo "6. 多线程测试" echo "6. 多线程测试"
echo "7. 单线程测试" echo "7. 单线程测试"
echo "8. 回程路由" echo "8. 回程路由"
echo "0. 返回主菜单"
read -p "输入选择: " scripts read -p "输入选择: " scripts
if [ "$scripts" = "0" ]; then
break
fi
IFS=',' read -ra ADDR <<< "$scripts" IFS=',' read -ra ADDR <<< "$scripts"
for i in "${ADDR[@]}"; do for i in "${ADDR[@]}"; do
case $i in case $i in
@ -306,7 +330,19 @@ main() {
*) echo "无效的选项: $i" ;; *) echo "无效的选项: $i" ;;
esac esac
done 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 break
fi
done
;; ;;
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