mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2024-11-10 10:05:18 +00:00
Update nodeloc_vps_autotest.sh
This commit is contained in:
parent
4ebdc2e145
commit
7ecc083242
@ -62,6 +62,26 @@ install_dependencies() {
|
|||||||
|
|
||||||
echo -e "${GREEN}依赖项检查和安装完成。${NC}"
|
echo -e "${GREEN}依赖项检查和安装完成。${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 函数:运行命令并捕获输出
|
||||||
|
run_and_capture() {
|
||||||
|
local output
|
||||||
|
output=$(eval "$1" 2>&1)
|
||||||
|
echo "$output"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 函数:检测VPS地理位置
|
||||||
|
detect_region() {
|
||||||
|
local country
|
||||||
|
country=$(curl -s ipinfo.io/country)
|
||||||
|
case $country in
|
||||||
|
"US") echo "na" ;; # 北美
|
||||||
|
"CA") echo "na" ;;
|
||||||
|
# 添加更多国家和地区的映射
|
||||||
|
*) echo "default" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# 统计使用次数
|
# 统计使用次数
|
||||||
sum_run_times() {
|
sum_run_times() {
|
||||||
local COUNT
|
local COUNT
|
||||||
@ -75,35 +95,87 @@ sum_run_times() {
|
|||||||
total_count=0
|
total_count=0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# 检测VPS地理位置
|
|
||||||
detect_region() {
|
# 调用函数获取统计数据
|
||||||
local country
|
sum_run_times
|
||||||
country=$(curl -s ipinfo.io/country)
|
|
||||||
case $country in
|
# 输出欢迎信息
|
||||||
"TW") echo "1" ;; # 台湾
|
show_welcome() {
|
||||||
"HK") echo "2" ;; # 香港
|
echo ""
|
||||||
"JP") echo "3" ;; # 日本
|
echo -e "${YELLOW}---------------------------------By'Jensfrank---------------------------------${NC}"
|
||||||
"US" | "CA") echo "4" ;; # 北美
|
echo ""
|
||||||
"BR" | "AR" | "CL") echo "5" ;; # 南美
|
echo "Nodeloc_VPS_自动脚本测试 $VERSION"
|
||||||
"GB" | "DE" | "FR" | "NL" | "SE" | "NO" | "FI" | "DK" | "IT" | "ES" | "CH" | "AT" | "BE" | "IE" | "PT" | "GR" | "PL" | "CZ" | "HU" | "RO" | "BG" | "HR" | "SI" | "SK" | "LT" | "LV" | "EE") echo "6" ;; # 欧洲
|
echo "GitHub地址: https://github.com/everett7623/nodeloc_vps_test"
|
||||||
"AU" | "NZ") echo "7" ;; # 大洋洲
|
echo "VPS选购: https://www.nodeloc.com/vps"
|
||||||
"KR") echo "8" ;; # 韩国
|
echo ""
|
||||||
"SG" | "MY" | "TH" | "ID" | "PH" | "VN") echo "9" ;; # 东南亚
|
echo -e "${colors[0]}# # ##### #### ###### # #### #### # # #### #### ${NC}"
|
||||||
"IN") echo "10" ;; # 印度
|
echo -e "${colors[1]}## # # # # # # # # # # # # # # # # # ${NC}"
|
||||||
"ZA" | "NG" | "EG" | "KE" | "MA" | "TN" | "GH" | "CI" | "SN" | "UG" | "ET" | "MZ" | "ZM" | "ZW" | "BW" | "MW" | "NA" | "RW" | "SD" | "DJ" | "CM" | "AO") echo "11" ;; # 非洲
|
echo -e "${colors[2]}# # # # # # # ##### # # # # # # #### #### ${NC}"
|
||||||
*) echo "0" ;; # 跨国平台
|
echo -e "${colors[3]}# # # # # # # # # # # # # # # # ${NC}"
|
||||||
esac
|
echo -e "${colors[4]}# # # # # # # # # # # # # # # # # # ${NC}"
|
||||||
|
echo -e "${colors[0]}# ## ##### #### ###### ###### #### #### #### # #### ${NC}"
|
||||||
|
echo ""
|
||||||
|
echo "支持Ubuntu/Debian"
|
||||||
|
echo ""
|
||||||
|
echo -e "今日运行次数: ${PURPLE}$daily_count${NC} 次,累计运行次数: ${PURPLE}$total_count${NC} 次"
|
||||||
|
echo ""
|
||||||
|
echo -e "${YELLOW}---------------------------------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 -e "${YELLOW}按任意键开始测试,测试时间较长,请耐心等待...${NC}"
|
||||||
|
read -n 1 -s
|
||||||
|
clear
|
||||||
}
|
}
|
||||||
# 函数:运行命令并捕获输出
|
|
||||||
run_and_capture() {
|
# 运行所有测试
|
||||||
local output
|
run_all_tests() {
|
||||||
output=$(eval "$1" 2>&1)
|
echo "开始运行测试..."
|
||||||
echo "$output"
|
|
||||||
|
# YABS
|
||||||
|
echo "运行${YELLOW}YABS...${NC}"
|
||||||
|
yabs_result=$(run_and_capture "wget -qO- yabs.sh | bash")
|
||||||
|
|
||||||
|
# 融合怪
|
||||||
|
echo "运行${YELLOW}融合怪...${NC}"
|
||||||
|
fusion_result=$(run_and_capture "curl -L https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && echo '1' | bash ecs.sh")
|
||||||
|
|
||||||
|
# IP质量
|
||||||
|
echo "运行${YELLOW}IP质量测试...${NC}"
|
||||||
|
ip_quality_result=$(run_and_capture "bash <(curl -Ls IP.Check.Place)")
|
||||||
|
|
||||||
|
# 流媒体解锁
|
||||||
|
echo "运行${YELLOW}流媒体解锁测试...${NC}"
|
||||||
|
region=$(detect_region)
|
||||||
|
streaming_result=$(run_and_capture "echo '$region' | bash <(curl -L -s media.ispvps.com)")
|
||||||
|
|
||||||
|
# 响应测试
|
||||||
|
echo "运行${YELLOW}响应测试...${NC}"
|
||||||
|
response_result=$(run_and_capture "bash <(curl -sL https://nodebench.mereith.com/scripts/curltime.sh)")
|
||||||
|
|
||||||
|
# 三网测速
|
||||||
|
echo "运行${YELLOW}三网测速(多线程/单线程)...${NC}"
|
||||||
|
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)")
|
||||||
|
|
||||||
|
# AutoTrace三网回程路由
|
||||||
|
echo "运行${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")
|
||||||
|
|
||||||
|
# 格式化结果
|
||||||
|
format_results
|
||||||
}
|
}
|
||||||
# Markdown输出结果
|
|
||||||
format_results()
|
# 格式化结果为 Markdown
|
||||||
{
|
format_results() {
|
||||||
echo -e "${YELLOW}此报告由Nodeloc_VPS_自动脚本测试生成...${NC}"
|
|
||||||
result="[tabs]
|
result="[tabs]
|
||||||
[tab=\"YABS\"]
|
[tab=\"YABS\"]
|
||||||
\`\`\`
|
\`\`\`
|
||||||
@ -142,6 +214,7 @@ $speedtest_single_result
|
|||||||
[/tab]
|
[/tab]
|
||||||
[tab=\"iperf3\"]
|
[tab=\"iperf3\"]
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|
||||||
\`\`\`
|
\`\`\`
|
||||||
[/tab]
|
[/tab]
|
||||||
[tab=\"回程路由\"]
|
[tab=\"回程路由\"]
|
||||||
@ -150,25 +223,23 @@ $autotrace_result
|
|||||||
\`\`\`
|
\`\`\`
|
||||||
[/tab]
|
[/tab]
|
||||||
[tab=\"去程路由\"]
|
[tab=\"去程路由\"]
|
||||||
\`\`\`
|
|
||||||
\`\`\`
|
|
||||||
[/tab]
|
[/tab]
|
||||||
[tab=\"Ping.pe\"]
|
[tab=\"Ping.pe\"]
|
||||||
\`\`\`
|
|
||||||
\`\`\`
|
|
||||||
[/tab]
|
[/tab]
|
||||||
[tab=\"哪吒 ICMP\"]
|
[tab=\"哪吒 ICMP\"]
|
||||||
\`\`\`
|
|
||||||
\`\`\`
|
|
||||||
[/tab]
|
[/tab]
|
||||||
[tab=\"其他\"]
|
[tab=\"其他\"]
|
||||||
\`\`\`
|
|
||||||
\`\`\`
|
|
||||||
[/tab]
|
[/tab]
|
||||||
[/tabs]"
|
[/tabs]"
|
||||||
|
|
||||||
echo "$result" > results.md
|
echo "$result" > results.md
|
||||||
echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}"
|
echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 复制结果到剪贴板
|
# 复制结果到剪贴板
|
||||||
copy_to_clipboard() {
|
copy_to_clipboard() {
|
||||||
if [ -f results.md ]; then
|
if [ -f results.md ]; then
|
||||||
@ -185,84 +256,12 @@ copy_to_clipboard() {
|
|||||||
echo -e "${RED}results.md 文件不存在。${NC}"
|
echo -e "${RED}results.md 文件不存在。${NC}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# 输出欢迎信息
|
|
||||||
show_welcome() {
|
|
||||||
echo ""
|
|
||||||
echo -e "${YELLOW}---------------------------------By'Jensfrank---------------------------------${NC}"
|
|
||||||
echo ""
|
|
||||||
echo "Nodeloc_VPS_自动脚本测试 $VERSION"
|
|
||||||
echo "GitHub地址: https://github.com/everett7623/nodeloc_vps_test"
|
|
||||||
echo "VPS选购: https://www.nodeloc.com/vps"
|
|
||||||
echo ""
|
|
||||||
echo -e "${colors[0]}# # ##### #### ###### # #### #### # # #### #### ${NC}"
|
|
||||||
echo -e "${colors[1]}## # # # # # # # # # # # # # # # # # ${NC}"
|
|
||||||
echo -e "${colors[2]}# # # # # # # ##### # # # # # # #### #### ${NC}"
|
|
||||||
echo -e "${colors[3]}# # # # # # # # # # # # # # # # ${NC}"
|
|
||||||
echo -e "${colors[4]}# # # # # # # # # # # # # # # # # # ${NC}"
|
|
||||||
echo -e "${colors[0]}# ## ##### #### ###### ###### #### #### #### # #### ${NC}"
|
|
||||||
echo ""
|
|
||||||
echo "支持Ubuntu/Debian"
|
|
||||||
echo ""
|
|
||||||
echo -e "今日运行次数: ${PURPLE}$daily_count${NC} 次,累计运行次数: ${PURPLE}$total_count${NC} 次"
|
|
||||||
echo ""
|
|
||||||
echo -e "${YELLOW}---------------------------------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 -e "${YELLOW}按任意键开始测试,测试时间较长,请耐心等待...${NC}"
|
|
||||||
read -n 1 -s
|
|
||||||
clear
|
|
||||||
}
|
|
||||||
# 运行所有测试
|
|
||||||
run_all_tests() {
|
|
||||||
echo "开始运行测试..."
|
|
||||||
|
|
||||||
# YABS
|
|
||||||
echo -e "运行${YELLOW}YABS...${NC}"
|
|
||||||
yabs_result=$(run_and_capture "wget -qO- yabs.sh | bash")
|
|
||||||
|
|
||||||
# 融合怪
|
|
||||||
echo -e "运行${YELLOW}融合怪...${NC}"
|
|
||||||
fusion_result=$(run_and_capture "curl -L https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && echo '1' | bash ecs.sh")
|
|
||||||
|
|
||||||
# IP质量
|
|
||||||
echo -e "运行${YELLOW}IP质量测试...${NC}"
|
|
||||||
ip_quality_result=$(run_and_capture "bash <(curl -Ls IP.Check.Place)")
|
|
||||||
|
|
||||||
# 流媒体解锁
|
|
||||||
echo -e "运行${YELLOW}流媒体解锁测试...${NC}"
|
|
||||||
local region
|
|
||||||
region=$(detect_region)
|
|
||||||
streaming_result=$(run_and_capture "echo '$region' | bash <(curl -L -s media.ispvps.com)")
|
|
||||||
|
|
||||||
# 响应测试
|
|
||||||
echo -e "运行${YELLOW}响应测试...${NC}"
|
|
||||||
response_result=$(run_and_capture "bash <(curl -sL https://nodebench.mereith.com/scripts/curltime.sh)")
|
|
||||||
|
|
||||||
# 三网测速
|
|
||||||
echo -e "运行${YELLOW}三网测速(多线程/单线程)...${NC}"
|
|
||||||
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)")
|
|
||||||
|
|
||||||
# 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 && echo '1' | bash AutoTrace.sh)
|
|
||||||
}
|
|
||||||
# 主函数
|
# 主函数
|
||||||
main() {
|
main() {
|
||||||
install_dependencies
|
install_dependencies
|
||||||
sum_run_times
|
|
||||||
show_welcome
|
show_welcome
|
||||||
run_all_tests
|
run_all_tests
|
||||||
format_results
|
|
||||||
echo -e "${GREEN}所有测试完成。点击屏幕任意位置复制结果。${NC}"
|
echo -e "${GREEN}所有测试完成。点击屏幕任意位置复制结果。${NC}"
|
||||||
read -n 1 -s
|
read -n 1 -s
|
||||||
copy_to_clipboard
|
copy_to_clipboard
|
||||||
|
Loading…
Reference in New Issue
Block a user