mirror of
				https://github.com/everett7623/nodeloc_vps_test.git
				synced 2025-11-04 00:17:27 +00:00 
			
		
		
		
	Update Nlbench.sh
This commit is contained in:
		
							parent
							
								
									8f9c4c5c69
								
							
						
					
					
						commit
						e2e9977ce4
					
				
							
								
								
									
										77
									
								
								Nlbench.sh
									
									
									
									
									
								
							
							
						
						
									
										77
									
								
								Nlbench.sh
									
									
									
									
									
								
							@ -50,9 +50,8 @@ install_dependencies() {
 | 
			
		||||
    echo -e "${GREEN}依赖项检查和安装完成。${NC}"
 | 
			
		||||
    clear
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# 获取IP地址
 | 
			
		||||
ip_address() {
 | 
			
		||||
# 获取IP地址和ISP信息
 | 
			
		||||
ip_address_and_isp() {
 | 
			
		||||
    ipv4_address=$(curl -s --max-time 5 ipv4.ip.sb)
 | 
			
		||||
    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)
 | 
			
		||||
@ -62,6 +61,27 @@ ip_address() {
 | 
			
		||||
    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)
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # 获取ISP信息
 | 
			
		||||
    isp_info=$(curl -s ipinfo.io/org)
 | 
			
		||||
 | 
			
		||||
    # 检查是否为WARP或Cloudflare
 | 
			
		||||
    is_warp=false
 | 
			
		||||
    if echo "$isp_info" | grep -iq "cloudflare\|warp\|1.1.1.1"; then
 | 
			
		||||
        is_warp=true
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # 判断使用IPv6还是IPv4
 | 
			
		||||
    use_ipv6=false
 | 
			
		||||
    if [ "$is_warp" = true ] || [ -z "$ipv4_address" ]; then
 | 
			
		||||
        use_ipv6=true
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    echo "IPv4: $ipv4_address"
 | 
			
		||||
    echo "IPv6: $ipv6_address"
 | 
			
		||||
    echo "ISP: $isp_info"
 | 
			
		||||
    echo "Is WARP: $is_warp"
 | 
			
		||||
    echo "Use IPv6: $use_ipv6"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# 检测VPS地理位置
 | 
			
		||||
@ -139,7 +159,8 @@ run_script() {
 | 
			
		||||
    local script_number=$1
 | 
			
		||||
    local output_file=$2
 | 
			
		||||
    local temp_file=$(mktemp)
 | 
			
		||||
    PUBLIC_IP=$(curl -s ip.sb)
 | 
			
		||||
    # 调用ip_address_and_isp函数获取IP地址和ISP信息
 | 
			
		||||
    ip_address_and_isp
 | 
			
		||||
    case $script_number in
 | 
			
		||||
        # YABS
 | 
			
		||||
        1)
 | 
			
		||||
@ -157,7 +178,7 @@ run_script() {
 | 
			
		||||
            curl -L https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && bash ecs.sh -m 1 <<< "y" | tee "$temp_file"
 | 
			
		||||
            sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
 | 
			
		||||
            sed -i 's/\.\.\.\.\.\./\.\.\.\.\.\.\n/g' "$temp_file"
 | 
			
		||||
            sed -n '/--------------------- A Bench Script By spiritlhl ----------------------/,$p' "$temp_file"
 | 
			
		||||
            sed -i '1,/\.\.\.\.\.\./d' "$temp_file"
 | 
			
		||||
            cp "$temp_file" "${output_file}_fusion"
 | 
			
		||||
            ;;
 | 
			
		||||
        # IP质量
 | 
			
		||||
@ -189,13 +210,14 @@ run_script() {
 | 
			
		||||
            ;;
 | 
			
		||||
        # 多线程测速
 | 
			
		||||
        6)
 | 
			
		||||
            if [ "$PUBLIC_IP" != ${1#*:[0-9a-fA-F]} ]; then
 | 
			
		||||
                bash <(curl -sL bash.icu/speedtest) <<< "1" |tee "$temp_file"
 | 
			
		||||
            else
 | 
			
		||||
                bash <(curl -sL bash.icu/speedtest) <<< "16" |tee "$temp_file"
 | 
			
		||||
            fi
 | 
			
		||||
            echo -e "运行${YELLOW}多线程测速...${NC}"
 | 
			
		||||
            
 | 
			
		||||
            if [ "$use_ipv6" = true ]; then
 | 
			
		||||
            echo "使用IPv6测试选项"
 | 
			
		||||
            bash <(curl -sL bash.icu/speedtest) <<< "3" | tee "$temp_file"
 | 
			
		||||
            else
 | 
			
		||||
            echo "使用IPv4测试选项"
 | 
			
		||||
             bash <(curl -sL bash.icu/speedtest) <<< "1" | tee "$temp_file"
 | 
			
		||||
            fi
 | 
			
		||||
            sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
 | 
			
		||||
            sed -i -r '1,/序号\:/d' "$temp_file"
 | 
			
		||||
            sed -i -r 's/(⠋|⠙|⠹|⠸|⠼|⠴|⠦|⠧|⠇|⠏)/\n/g' "$temp_file"
 | 
			
		||||
@ -204,18 +226,19 @@ run_script() {
 | 
			
		||||
            ;;
 | 
			
		||||
        # 单线程测速
 | 
			
		||||
        7)
 | 
			
		||||
            if [ "$PUBLIC_IP" != "${1#*:[0-9a-fA-F]}" ]; then
 | 
			
		||||
                echo -e "运行${YELLOW}单线程测速...${NC}"
 | 
			
		||||
                bash <(curl -sL bash.icu/speedtest) <<< "2" |tee "$temp_file"
 | 
			
		||||
                sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
 | 
			
		||||
                sed -i -r '1,/序号\:/d' "$temp_file"
 | 
			
		||||
                sed -i -r 's/(⠋|⠙|⠹|⠸|⠼|⠴|⠦|⠧|⠇|⠏)/\n/g' "$temp_file"
 | 
			
		||||
                sed -i -r '/测试进行中/d' "$temp_file"
 | 
			
		||||
                cp "$temp_file" "${output_file}_single_thread"
 | 
			
		||||
            echo -e "运行${YELLOW}单线程测速...${NC}"
 | 
			
		||||
            if [ "$use_ipv6" = true ]; then
 | 
			
		||||
            echo "使用IPv6测试选项"
 | 
			
		||||
            bash <(curl -sL bash.icu/speedtest) <<< "17" | tee "$temp_file"
 | 
			
		||||
            else
 | 
			
		||||
                echo "该脚本无IPv6单线程测速"
 | 
			
		||||
                touch "${output_file}_single_thread"
 | 
			
		||||
            echo "使用IPv4测试选项"
 | 
			
		||||
            bash <(curl -sL bash.icu/speedtest) <<< "2" | tee "$temp_file"
 | 
			
		||||
            fi
 | 
			
		||||
            sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
 | 
			
		||||
            sed -i -r '1,/序号\:/d' "$temp_file"
 | 
			
		||||
            sed -i -r 's/(⠋|⠙|⠹|⠸|⠼|⠴|⠦|⠧|⠇|⠏)/\n/g' "$temp_file"
 | 
			
		||||
            sed -i -r '/测试进行中/d' "$temp_file"
 | 
			
		||||
            cp "$temp_file" "${output_file}_single_thread"
 | 
			
		||||
            ;;
 | 
			
		||||
        # iperf3测试
 | 
			
		||||
        8)
 | 
			
		||||
@ -225,13 +248,15 @@ run_script() {
 | 
			
		||||
            sed -i -r '1,/\[ ID\] /d' "$temp_file"
 | 
			
		||||
            cp "$temp_file" "${output_file}_iperf3"
 | 
			
		||||
            ;;
 | 
			
		||||
       # 回程路由
 | 
			
		||||
        # 回程路由
 | 
			
		||||
        9)
 | 
			
		||||
            echo -e "运行${YELLOW}回程路由测试...${NC}"
 | 
			
		||||
            if [ "$PUBLIC_IP" != "${1#*:[0-9a-fA-F]}" ]; 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"
 | 
			
		||||
            if [ "$use_ipv6" = true ]; then
 | 
			
		||||
            echo "使用IPv6测试选项"
 | 
			
		||||
            wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "4" | 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"
 | 
			
		||||
            echo "使用IPv4测试选项"
 | 
			
		||||
            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
 | 
			
		||||
            sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
 | 
			
		||||
            cp "$temp_file" "${output_file}_route"
 | 
			
		||||
@ -454,7 +479,7 @@ show_welcome() {
 | 
			
		||||
main() {
 | 
			
		||||
    # 检查并安装依赖
 | 
			
		||||
    install_dependencies
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    # 获取统计数据
 | 
			
		||||
    sum_run_times
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user