#!/bin/bash
echo "curl --retry 10 --retry-delay 60 --retry-max-time 60 https://raw.hellogithub.com/hosts # -o github_hosts"
curl --retry 10 --retry-delay 60 --retry-max-time 60 https://raw.hellogithub.com/hosts | while read LINE
do
# 去掉无关行
if [[ $LINE == *"#"* ]]
then
echo "注释行,跳过"
else
# 截取DNS中主机名及对应的ip
ip=`echo $LINE | awk '{print $1}'`
dnshost=`echo $LINE | awk '{print $2}'`
delaytime=`curl -o $dnshost -s -w %{time_namelookup} $dnshost`
if [[ $delaytime < 0.3 ]]
then
echo "$dnshost github.com # delaytime=$delaytime"
else
echo "#$dnshost github.com # delaytime=$delaytime"
fi
fi
done
批量测试DNS访问速度的脚本
最新推荐文章于 2024-04-20 16:50:57 发布