mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2024-11-10 10:05:18 +00:00
Compare commits
18 Commits
12b15e12d7
...
3cec8b14f9
Author | SHA1 | Date | |
---|---|---|---|
|
3cec8b14f9 | ||
|
735b635490 | ||
|
c5732df15a | ||
|
90b2807070 | ||
|
2fcff740b5 | ||
|
fb3b27a67a | ||
|
2da6546e4d | ||
|
6f41c63ba4 | ||
|
8eeda69163 | ||
|
688c07899d | ||
|
514909f411 | ||
|
7b4120350c | ||
|
6911d821db | ||
|
98c7c4abf4 | ||
|
ea01c5d727 | ||
|
0b7ae16285 | ||
|
169c63e49b | ||
|
3095f30989 |
66
Nlbench.sh
66
Nlbench.sh
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# 定义版本
|
# 定义版本
|
||||||
CURRENT_VERSION="2024-09-07 v1.2.0" # 最新版本号
|
CURRENT_VERSION="2024-09-07 v1.2.3" # 最新版本号
|
||||||
SCRIPT_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh"
|
SCRIPT_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh"
|
||||||
VERSION_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/version.sh"
|
VERSION_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/version.sh"
|
||||||
PASTE_SERVICE_URL="http://nodeloc.uukk.de/test/"
|
PASTE_SERVICE_URL="http://nodeloc.uukk.de/test/"
|
||||||
@ -322,22 +322,6 @@ detect_region() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# 服务器 VPS 信息
|
|
||||||
AUXILIARY_VPS="107.189.11.25"
|
|
||||||
IPERF_PORT=5201
|
|
||||||
TEST_DURATION=30
|
|
||||||
|
|
||||||
run_iperf3_test() {
|
|
||||||
echo -e "${GREEN}服务端VPS位于卢森堡${NC}"
|
|
||||||
echo -e "${GREEN}连接到服务端进行iperf3测试。。。${NC}"
|
|
||||||
timeout ${TEST_DURATION}s iperf3 -c $AUXILIARY_VPS -p $IPERF_PORT -t $TEST_DURATION
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo -e "${YELLOW}iperf3 测试完成${NC}"
|
|
||||||
else
|
|
||||||
echo -e "${RED}iperf3 测试失败或超时${NC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# 统计使用次数
|
# 统计使用次数
|
||||||
sum_run_times() {
|
sum_run_times() {
|
||||||
local COUNT=$(wget --no-check-certificate -qO- --tries=2 --timeout=2 "https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Feverett7623%2Fnodeloc_vps_test%2Fblob%2Fmain%2FNlbench.sh" 2>&1 | grep -m1 -oE "[0-9]+[ ]+/[ ]+[0-9]+")
|
local COUNT=$(wget --no-check-certificate -qO- --tries=2 --timeout=2 "https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Feverett7623%2Fnodeloc_vps_test%2Fblob%2Fmain%2FNlbench.sh" 2>&1 | grep -m1 -oE "[0-9]+[ ]+/[ ]+[0-9]+")
|
||||||
@ -442,17 +426,8 @@ run_script() {
|
|||||||
sed -i '/^$/d' "$temp_file"
|
sed -i '/^$/d' "$temp_file"
|
||||||
cp "$temp_file" "${output_file}_single_thread"
|
cp "$temp_file" "${output_file}_single_thread"
|
||||||
;;
|
;;
|
||||||
# iperf3测试
|
|
||||||
8)
|
|
||||||
echo -e "运行${YELLOW}iperf3测试...${NC}"
|
|
||||||
run_iperf3_test | tee "$temp_file"
|
|
||||||
sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
|
|
||||||
sed -i -r '1,/\[ ID\] /d' "$temp_file"
|
|
||||||
sed -i '/^$/d' "$temp_file"
|
|
||||||
cp "$temp_file" "${output_file}_iperf3"
|
|
||||||
;;
|
|
||||||
# 回程路由
|
# 回程路由
|
||||||
9)
|
8)
|
||||||
echo -e "运行${YELLOW}回程路由测试...${NC}"
|
echo -e "运行${YELLOW}回程路由测试...${NC}"
|
||||||
if [ "$use_ipv6" = true ]; then
|
if [ "$use_ipv6" = true ]; then
|
||||||
echo "使用IPv6测试选项"
|
echo "使用IPv6测试选项"
|
||||||
@ -473,20 +448,21 @@ run_script() {
|
|||||||
generate_markdown_output() {
|
generate_markdown_output() {
|
||||||
local base_output_file=$1
|
local base_output_file=$1
|
||||||
local temp_output_file="${base_output_file}.md"
|
local temp_output_file="${base_output_file}.md"
|
||||||
local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由")
|
local sections=("YABS" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "回程路由")
|
||||||
local file_suffixes=("yabs" "gb5" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "iperf3" "route")
|
local file_suffixes=("yabs" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "route")
|
||||||
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
|
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
|
||||||
|
|
||||||
echo "[tabs]" > "$temp_output_file"
|
# 修改这里,添加 UTF-8 编码设置
|
||||||
|
echo "[tabs]" | iconv -f UTF-8 -t UTF-8//IGNORE > "$temp_output_file"
|
||||||
|
|
||||||
# 输出有内容的标签
|
# 输出有内容的标签
|
||||||
for i in "${!sections[@]}"; do
|
for i in "${!sections[@]}"; do
|
||||||
section="${sections[$i]}"
|
section="${sections[$i]}"
|
||||||
suffix="${file_suffixes[$i]}"
|
suffix="${file_suffixes[$i]}"
|
||||||
if [ -f "${base_output_file}_${suffix}" ]; then
|
if [ -f "${base_output_file}_${suffix}" ]; then
|
||||||
echo "[tab=\"$section\"]" >> "$temp_output_file"
|
echo "[tab=\"$section\"]" | iconv -f UTF-8 -t UTF-8//IGNORE >> "$temp_output_file"
|
||||||
echo "\`\`\`" >> "$temp_output_file"
|
echo "\`\`\`" >> "$temp_output_file"
|
||||||
cat "${base_output_file}_${suffix}" >> "$temp_output_file"
|
cat "${base_output_file}_${suffix}" | iconv -f UTF-8 -t UTF-8//IGNORE >> "$temp_output_file"
|
||||||
echo "\`\`\`" >> "$temp_output_file"
|
echo "\`\`\`" >> "$temp_output_file"
|
||||||
echo "[/tab]" >> "$temp_output_file"
|
echo "[/tab]" >> "$temp_output_file"
|
||||||
rm "${base_output_file}_${suffix}"
|
rm "${base_output_file}_${suffix}"
|
||||||
@ -507,17 +483,17 @@ generate_markdown_output() {
|
|||||||
local filename="${timestamp}${random_chars}.txt"
|
local filename="${timestamp}${random_chars}.txt"
|
||||||
|
|
||||||
# 构造完整的URL
|
# 构造完整的URL
|
||||||
local url="${PASTE_SERVICE_URL}${filename}"
|
local url="http://nodeloc.uukk.de/test/${filename}"
|
||||||
|
|
||||||
# 上传文件
|
# 上传文件
|
||||||
if curl -s -X PUT --data-binary @"$temp_output_file" "$url"; then
|
if curl -H "Content-Type: text/plain; charset=utf-8" -s -X PUT --data-binary @"$temp_output_file" "$url"; then
|
||||||
echo "测试结果已上传。您可以在以下链接查看:"
|
echo "测试结果已上传。您可以在以下链接查看:"
|
||||||
echo "$url"
|
echo "$url"
|
||||||
echo "结果链接已保存到 $base_output_file.url"
|
echo "结果链接已保存到 $base_output_file.url"
|
||||||
echo "$url" > "$base_output_file.url"
|
echo "$url" > "$base_output_file.url"
|
||||||
else
|
else
|
||||||
echo "上传失败。结果已保存在本地文件 $temp_output_file"
|
echo "上传失败。结果已保存在本地文件 $temp_output_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm "$temp_output_file"
|
rm "$temp_output_file"
|
||||||
read -p "按回车键继续..."
|
read -p "按回车键继续..."
|
||||||
@ -547,13 +523,12 @@ run_selected_scripts() {
|
|||||||
echo "5. 响应测试"
|
echo "5. 响应测试"
|
||||||
echo "6. 多线程测试"
|
echo "6. 多线程测试"
|
||||||
echo "7. 单线程测试"
|
echo "7. 单线程测试"
|
||||||
echo "8. iperf3"
|
echo "8. 回程路由"
|
||||||
echo "9. 回程路由"
|
|
||||||
echo "0. 返回"
|
echo "0. 返回"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "请输入要执行的脚本编号(用英文逗号分隔,例如:1,2,3):" script_numbers
|
read -p "请输入要执行的脚本编号(用英文逗号分隔,例如:1,2,3):" script_numbers
|
||||||
if [[ "$script_numbers" =~ ^(0|10|[1-9])(,(0|10|[1-9]))*$ ]]; then
|
if [[ "$script_numbers" =~ ^(0|10|[1-8])(,(0|10|[1-8]))*$ ]]; then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo -e "${RED}无效输入,请输入0-9之间的数字,用英文逗号分隔。${NC}"
|
echo -e "${RED}无效输入,请输入0-9之间的数字,用英文逗号分隔。${NC}"
|
||||||
@ -576,8 +551,7 @@ run_selected_scripts() {
|
|||||||
|
|
||||||
# 主菜单
|
# 主菜单
|
||||||
main_menu() {
|
main_menu() {
|
||||||
echo -e "${GREEN}测试项目:${NC}Yabs,融合怪,IP质量,流媒体解锁,响应测试,多线程测试,"
|
echo -e "${GREEN}测试项目:${NC}Yabs,融合怪,IP质量,流媒体解锁,响应测试,多线程测试,单线程测试,回程路由。"
|
||||||
echo " 单线程测试,iperf3,回程路由。"
|
|
||||||
echo -e "${YELLOW}1. 执行所有测试脚本${NC}"
|
echo -e "${YELLOW}1. 执行所有测试脚本${NC}"
|
||||||
echo -e "${YELLOW}2. 选择特定测试脚本${NC}"
|
echo -e "${YELLOW}2. 选择特定测试脚本${NC}"
|
||||||
echo -e "${YELLOW}0. 退出${NC}"
|
echo -e "${YELLOW}0. 退出${NC}"
|
||||||
|
@ -17,4 +17,7 @@
|
|||||||
# 2024-08-13 v1.1.2 - 优化tab标签。
|
# 2024-08-13 v1.1.2 - 优化tab标签。
|
||||||
# 2024-08-19 v1.1.3 - 优化系统更新代码。
|
# 2024-08-19 v1.1.3 - 优化系统更新代码。
|
||||||
# 2024-08-28 v1.1.4 - 优化系统更新代码。
|
# 2024-08-28 v1.1.4 - 优化系统更新代码。
|
||||||
# 2024-09-07 v1.2.0 - 优化系统更新代码。
|
# 2024-09-07 v1.2.0 - 优化代码。
|
||||||
|
# 2024-09-07 v1.2.1 - 优化代码。
|
||||||
|
# 2024-09-07 v1.2.2 - 优化代码。
|
||||||
|
# 2024-09-07 v1.2.3 - 优化代码。
|
||||||
|
Loading…
Reference in New Issue
Block a user