Update nodeloc_vps_autotest.sh

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

View File

@ -122,7 +122,7 @@ show_welcome() {
echo "5. 响应测试" echo "5. 响应测试"
echo "6. 多线程测试" echo "6. 多线程测试"
echo "7. 单线程测试" echo "7. 单线程测试"
# echo "8. 回程路由(调试中)" echo "8. 回程路由(调试中)"
echo "" echo ""
echo -e "${RED}按任意键开始测试...${NC}" echo -e "${RED}按任意键开始测试...${NC}"
read -n 1 -s read -n 1 -s
@ -189,6 +189,13 @@ speedtest_single_process_output() {
echo "$input" | sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g' | grep -v "测试进行中" | awk '/大陆三网+教育网 IPv4 单线程测速v/{f=1} f; /北京时间: /{f=0}' echo "$input" | sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g' | grep -v "测试进行中" | awk '/大陆三网+教育网 IPv4 单线程测速v/{f=1} f; /北京时间: /{f=0}'
} }
# 去除回程路由板块板块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() { run_all_tests() {
echo -e "${RED}开始测试,测试时间较长,请耐心等待...${NC}" echo -e "${RED}开始测试,测试时间较长,请耐心等待...${NC}"
@ -221,9 +228,9 @@ run_all_tests() {
speedtest_multi_result=$(run_and_capture "echo '1' | bash <(curl -sL bash.icu/speedtest)") speedtest_multi_result=$(run_and_capture "echo '1' | bash <(curl -sL bash.icu/speedtest)")
speedtest_single_result=$(run_and_capture "echo '2' | bash <(curl -sL bash.icu/speedtest)") speedtest_single_result=$(run_and_capture "echo '2' | bash <(curl -sL bash.icu/speedtest)")
# # AutoTrace三网回程路由 # AutoTrace三网回程路由
# echo -e "运行${YELLOW}AutoTrace三网回程路由...${NC}" 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}" echo -e "${YELLOW}此报告由Nodeloc_VPS_自动脚本测试生成...${NC}"
@ -255,6 +262,10 @@ local processed_speedtest_single_result
processed_speedtest_multi_result=$(speedtest_multi_process_output "$speedtest_multi_result") processed_speedtest_multi_result=$(speedtest_multi_process_output "$speedtest_multi_result")
processed_speedtest_single_result=$(speedtest_single_process_output "$speedtest_single_result") processed_speedtest_single_result=$(speedtest_single_process_output "$speedtest_single_result")
# 处理回程路由结果
local processed_autotrace_result
processed_autotrace_result=$(autotrace_process_output "$autotrace_result")
# Tabs分栏输出结果用于复制到Nodeloc论坛 # Tabs分栏输出结果用于复制到Nodeloc论坛
result="[tabs] result="[tabs]
[tab=\"YABS\"] [tab=\"YABS\"]
@ -291,20 +302,20 @@ $processed_speedtest_multi_result
[tab=\"单线程测速\"] [tab=\"单线程测速\"]
\`\`\` \`\`\`
$processed_speedtest_single_result $processed_speedtest_single_result
\`\`\`
[/tab]
[tab=\"iperf3\"]
\`\`\`
\`\`\` \`\`\`
[/tab] [/tab]
[tab=\"回程路由\"] [tab=\"回程路由\"]
\`\`\` \`\`\`
$autotrace_result $processed_autotrace_result
\`\`\` \`\`\`
[/tab] [/tab]
[tab=\"去程路由\"] [tab=\"去程路由\"]
[/tab]
[tab=\"iperf3\"]
\`\`\`
\`\`\`
[/tab] [/tab]
[tab=\"Ping.pe\"] [tab=\"Ping.pe\"]