mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2024-11-20 15:05:22 +00:00
Update Nlbench_beta.sh
This commit is contained in:
parent
ad59ac5a70
commit
3846a9128f
@ -51,17 +51,27 @@ install_dependencies() {
|
|||||||
clear
|
clear
|
||||||
}
|
}
|
||||||
|
|
||||||
# 获取IP地址
|
# 获取IP地址和ISP信息
|
||||||
ip_address() {
|
ip_address_and_isp() {
|
||||||
ipv4_address=$(curl -s --max-time 5 ipv4.ip.sb)
|
ipv4_address=$(curl -s --max-time 5 ipv4.ip.sb)
|
||||||
if [ -z "$ipv4_address" ]; then
|
if [ -z "$ipv4_address" ]; then
|
||||||
ipv4_address=$(ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' | head -n1)
|
ipv4_address=$(ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' | head -n1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ipv6_address=$(curl -s --max-time 5 ipv6.ip.sb)
|
ipv6_address=$(curl -s --max-time 5 ipv6.ip.sb)
|
||||||
if [ -z "$ipv6_address" ]; then
|
if [ -z "$ipv6_address" ]; then
|
||||||
ipv6_address=$(ip -6 addr show | grep -oP '(?<=inet6\s)[\da-f:]+' | grep -v '^::1' | grep -v '^fe80' | head -n1)
|
ipv6_address=$(ip -6 addr show | grep -oP '(?<=inet6\s)[\da-f:]+' | grep -v '^::1' | grep -v '^fe80' | head -n1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 获取ISP信息
|
||||||
|
isp_info=$(curl -s https://ipapi.co/json/)
|
||||||
|
isp=$(echo "$isp_info" | grep -oP '(?<="org":")[^"]*')
|
||||||
|
asn=$(echo "$isp_info" | grep -oP '(?<="asn":")[^"]*')
|
||||||
|
|
||||||
|
# 检查是否为WARP或Cloudflare
|
||||||
|
is_warp=false
|
||||||
|
if echo "$isp $asn" | grep -iq "cloudflare\|warp\|1.1.1.1"; then
|
||||||
|
is_warp=true
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 检测VPS地理位置
|
# 检测VPS地理位置
|
||||||
@ -189,10 +199,10 @@ run_script() {
|
|||||||
# 多线程测速
|
# 多线程测速
|
||||||
6)
|
6)
|
||||||
echo -e "运行${YELLOW}多线程测速...${NC}"
|
echo -e "运行${YELLOW}多线程测速...${NC}"
|
||||||
if [ -n "$ipv4_address" ]; then
|
if [ "$is_warp" = true ] || [ -z "$ipv4_address" ]; then
|
||||||
bash <(curl -sL bash.icu/speedtest) <<< "1" | tee "$temp_file"
|
|
||||||
else
|
|
||||||
bash <(curl -sL bash.icu/speedtest) <<< "3" | tee "$temp_file"
|
bash <(curl -sL bash.icu/speedtest) <<< "3" | tee "$temp_file"
|
||||||
|
else
|
||||||
|
bash <(curl -sL bash.icu/speedtest) <<< "1" | tee "$temp_file"
|
||||||
fi
|
fi
|
||||||
sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
|
sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
|
||||||
sed -i -r '1,/序号\:/d' "$temp_file"
|
sed -i -r '1,/序号\:/d' "$temp_file"
|
||||||
@ -203,10 +213,10 @@ run_script() {
|
|||||||
# 单线程测速
|
# 单线程测速
|
||||||
7)
|
7)
|
||||||
echo -e "运行${YELLOW}单线程测速...${NC}"
|
echo -e "运行${YELLOW}单线程测速...${NC}"
|
||||||
if [ -n "$ipv4_address" ]; then
|
if [ "$is_warp" = true ] || [ -z "$ipv4_address" ]; then
|
||||||
bash <(curl -sL bash.icu/speedtest) <<< "2" | tee "$temp_file"
|
|
||||||
else
|
|
||||||
bash <(curl -sL bash.icu/speedtest) <<< "17" | tee "$temp_file"
|
bash <(curl -sL bash.icu/speedtest) <<< "17" | tee "$temp_file"
|
||||||
|
else
|
||||||
|
bash <(curl -sL bash.icu/speedtest) <<< "2" | tee "$temp_file"
|
||||||
fi
|
fi
|
||||||
sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
|
sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
|
||||||
sed -i -r '1,/序号\:/d' "$temp_file"
|
sed -i -r '1,/序号\:/d' "$temp_file"
|
||||||
@ -225,10 +235,10 @@ run_script() {
|
|||||||
# 回程路由
|
# 回程路由
|
||||||
9)
|
9)
|
||||||
echo -e "运行${YELLOW}回程路由测试...${NC}"
|
echo -e "运行${YELLOW}回程路由测试...${NC}"
|
||||||
if [ -n "$ipv4_address" ]; then
|
if [ "$is_warp" = true ] || [ -z "$ipv4_address" ]; then
|
||||||
wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file"
|
|
||||||
else
|
|
||||||
wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "3" | tee "$temp_file"
|
wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "3" | tee "$temp_file"
|
||||||
|
else
|
||||||
|
wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file"
|
||||||
fi
|
fi
|
||||||
sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
|
sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
|
||||||
cp "$temp_file" "${output_file}_route"
|
cp "$temp_file" "${output_file}_route"
|
||||||
@ -452,8 +462,8 @@ main() {
|
|||||||
# 检查并安装依赖
|
# 检查并安装依赖
|
||||||
install_dependencies
|
install_dependencies
|
||||||
|
|
||||||
# 调用ip_address函数获取IP地址
|
# 调用ip_address函数获取IP地址和isp
|
||||||
ip_address
|
ip_address_and_isp
|
||||||
|
|
||||||
# 获取统计数据
|
# 获取统计数据
|
||||||
sum_run_times
|
sum_run_times
|
||||||
|
Loading…
Reference in New Issue
Block a user