Skip to content

Commit

Permalink
增加ping次数
Browse files Browse the repository at this point in the history
  • Loading branch information
badafans committed Mar 15, 2021
1 parent 3f883d5 commit d22994e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 33 deletions.
18 changes: 9 additions & 9 deletions linux/src/cf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ do
file=$(cat data.txt | grep file= | cut -f 2- -d'=')
url=$(cat data.txt | grep url= | cut -f 2- -d'=')
app=$(cat data.txt | grep app= | cut -f 2- -d'=')
if [ "$app" != "20210308" ]
if [ "$app" != "20210315" ]
then
echo 发现新版本程序: $app
echo 更新地址: $url
Expand All @@ -68,7 +68,7 @@ do
echo $i>>ip.txt
done
rm -rf meta.txt data.txt
./fping -f ip.txt -c 10 -i 0 > fping.txt
./fping -f ip.txt -c 20 -i 0 > fping.txt
sort -t/ -n -k 5 -k 8 fping.txt | cut -f 1 -d: | sed '21,$d' > ip.txt
rm -rf fping.txt
echo 选取20个丢包率最少的IP地址下载测速
Expand Down Expand Up @@ -165,9 +165,9 @@ do
echo 峰值速度 $max kB/s
if [ $max1 -ge $max2 ]
then
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210308-$first-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210315-$first-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
else
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210308-$first-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210315-$first-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
fi
echo 第一次测试 $second
curl --resolve $domain:443:$second https://$domain/$file -o /dev/null --connect-timeout 5 --max-time 10 > log.txt 2>&1
Expand Down Expand Up @@ -243,9 +243,9 @@ do
echo 峰值速度 $max kB/s
if [ $max1 -ge $max2 ]
then
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210308-$second-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210315-$second-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
else
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210308-$second-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210315-$second-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
fi
echo 第一次测试 $third
curl --resolve $domain:443:$third https://$domain/$file -o /dev/null --connect-timeout 5 --max-time 10 > log.txt 2>&1
Expand Down Expand Up @@ -321,9 +321,9 @@ do
echo 峰值速度 $max kB/s
if [ $max1 -ge $max2 ]
then
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210308-$third-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210315-$third-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
else
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210308-$third-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210315-$third-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
fi
fi
done
Expand All @@ -336,7 +336,7 @@ done
start_seconds=$(date --date="$starttime" +%s)
end_seconds=$(date --date="$endtime" +%s)
clear
curl --ipv4 --resolve service.udpfile.com:443:$anycast --retry 3 -s -X POST -d ''20210308-$anycast-$max'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o temp.txt
curl --ipv4 --resolve service.udpfile.com:443:$anycast --retry 3 -s -X POST -d ''20210315-$anycast-$max'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o temp.txt
publicip=$(cat temp.txt | grep publicip= | cut -f 2- -d'=')
colo=$(cat temp.txt | grep colo= | cut -f 2- -d'=')
rm -rf temp.txt
Expand Down
19 changes: 10 additions & 9 deletions shell/cf-openwrt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ do
file=$(cat data.txt | grep file= | cut -f 2- -d'=')
url=$(cat data.txt | grep url= | cut -f 2- -d'=')
app=$(cat data.txt | grep app= | cut -f 2- -d'=')
if [ "$app" != "20210308" ]
if [ "$app" != "20210315" ]
then
echo 发现新版本程序: $app
echo 更新地址: $url
Expand All @@ -72,10 +72,11 @@ do
echo $i>>anycast.txt
done
rm -rf meta.txt data.txt
n=0
m=$(cat anycast.txt | wc -l)
for i in `cat anycast.txt`
do
ping -c 10 -i 1 -n -q $i > icmp/$n.log&
ping -c 20 -i 1 -n -q $i > icmp/$n.log&
n=$[$n+1]
per=$n*100/$m
while true
Expand Down Expand Up @@ -199,9 +200,9 @@ do
echo 峰值速度 $max kB/s
if [ $max1 -ge $max2 ]
then
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210308-$first-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210315-$first-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
else
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210308-$first-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210315-$first-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
fi
echo 第一次测试 $second
curl --resolve $domain:443:$second https://$domain/$file -o /dev/null --connect-timeout 5 --max-time 10 > log.txt 2>&1
Expand Down Expand Up @@ -277,9 +278,9 @@ do
echo 峰值速度 $max kB/s
if [ $max1 -ge $max2 ]
then
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210308-$second-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210315-$second-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
else
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210308-$second-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210315-$second-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
fi
echo 第一次测试 $third
curl --resolve $domain:443:$third https://$domain/$file -o /dev/null --connect-timeout 5 --max-time 10 > log.txt 2>&1
Expand Down Expand Up @@ -355,9 +356,9 @@ do
echo 峰值速度 $max kB/s
if [ $max1 -ge $max2 ]
then
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210308-$third-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210315-$third-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
else
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210308-$third-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210315-$third-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
fi
fi
done
Expand All @@ -370,7 +371,7 @@ done
start_seconds=$(date --date="$starttime" +%s)
end_seconds=$(date --date="$endtime" +%s)
clear
curl --ipv4 --resolve service.udpfile.com:443:$anycast --retry 3 -s -X POST -d ''20210308-$anycast-$max'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o temp.txt
curl --ipv4 --resolve service.udpfile.com:443:$anycast --retry 3 -s -X POST -d ''20210315-$anycast-$max'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o temp.txt
publicip=$(cat temp.txt | grep publicip= | cut -f 2- -d'=')
colo=$(cat temp.txt | grep colo= | cut -f 2- -d'=')
rm -rf temp.txt
Expand Down
19 changes: 10 additions & 9 deletions shell/cf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ do
file=$(cat data.txt | grep file= | cut -f 2- -d'=')
url=$(cat data.txt | grep url= | cut -f 2- -d'=')
app=$(cat data.txt | grep app= | cut -f 2- -d'=')
if [ "$app" != "20210308" ]
if [ "$app" != "20210315" ]
then
echo 发现新版本程序: $app
echo 更新地址: $url
Expand All @@ -72,10 +72,11 @@ do
echo $i>>anycast.txt
done
rm -rf meta.txt data.txt
n=0
m=$(cat anycast.txt | wc -l)
for i in `cat anycast.txt`
do
ping -c 10 -i 0.2 -n -q $i > icmp/$n.log&
ping -c 20 -i 0.2 -n -q $i > icmp/$n.log&
n=$[$n+1]
per=$n*100/$m
while true
Expand Down Expand Up @@ -199,9 +200,9 @@ do
echo 峰值速度 $max kB/s
if [ $max1 -ge $max2 ]
then
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210308-$first-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210315-$first-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
else
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210308-$first-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$first --retry 3 -s -X POST -d ''20210315-$first-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
fi
echo 第一次测试 $second
curl --resolve $domain:443:$second https://$domain/$file -o /dev/null --connect-timeout 5 --max-time 10 > log.txt 2>&1
Expand Down Expand Up @@ -277,9 +278,9 @@ do
echo 峰值速度 $max kB/s
if [ $max1 -ge $max2 ]
then
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210308-$second-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210315-$second-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
else
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210308-$second-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$second --retry 3 -s -X POST -d ''20210315-$second-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
fi
echo 第一次测试 $third
curl --resolve $domain:443:$third https://$domain/$file -o /dev/null --connect-timeout 5 --max-time 10 > log.txt 2>&1
Expand Down Expand Up @@ -355,9 +356,9 @@ do
echo 峰值速度 $max kB/s
if [ $max1 -ge $max2 ]
then
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210308-$third-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210315-$third-$max1'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
else
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210308-$third-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
curl --ipv4 --resolve service.udpfile.com:443:$third --retry 3 -s -X POST -d ''20210315-$third-$max2'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o /dev/null --connect-timeout 5 --max-time 10
fi
fi
done
Expand All @@ -370,7 +371,7 @@ done
start_seconds=$(date --date="$starttime" +%s)
end_seconds=$(date --date="$endtime" +%s)
clear
curl --ipv4 --resolve service.udpfile.com:443:$anycast --retry 3 -s -X POST -d ''20210308-$anycast-$max'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o temp.txt
curl --ipv4 --resolve service.udpfile.com:443:$anycast --retry 3 -s -X POST -d ''20210315-$anycast-$max'' "https://service.udpfile.com?asn="$asn"&city="$city"" -o temp.txt
publicip=$(cat temp.txt | grep publicip= | cut -f 2- -d'=')
colo=$(cat temp.txt | grep colo= | cut -f 2- -d'=')
rm -rf temp.txt
Expand Down
12 changes: 6 additions & 6 deletions windows/CF优选IP.bat
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ set url=%%a
)
for /f "tokens=2 delims==" %%a in ('findstr /C:"app" data.txt') do (
set app=%%a
if !app! NEQ 20210308 (echo 发现新版本程序: !app!&echo 更新地址: !url!&title 更新后才可以使用&echo 按任意键退出程序&pause>nul&exit)
if !app! NEQ 20210315 (echo 发现新版本程序: !app!&echo 更新地址: !url!&title 更新后才可以使用&echo 按任意键退出程序&pause>nul&exit)
)
del data.txt
title 测试 ICMP 丢包率
fping -f ip.txt -c 10 --interval=0 -s > ping.csv
fping -f ip.txt -c 20 --interval=0 -s > ping.csv
echo 开始处理丢包率数据
findstr "%%" ping.csv>temp.csv
del ping.csv
Expand Down Expand Up @@ -248,7 +248,7 @@ if !max! GEQ !speed! (cls&set anycast=!a!&goto end) else (goto three)
chcp 936
del CRLF.txt cut.txt speed.txt
cls
if !max1! GEQ !max2! (curl --ipv4 --resolve service.udpfile.com:443:!a! --retry 3 -s -X POST -d "20210308-!a!-!max1!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10) else (curl --ipv4 --resolve service.udpfile.com:443:!a! --retry 3 -s -X POST -d "20210308-!a!-!max2!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10)
if !max1! GEQ !max2! (curl --ipv4 --resolve service.udpfile.com:443:!a! --retry 3 -s -X POST -d "20210315-!a!-!max1!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10) else (curl --ipv4 --resolve service.udpfile.com:443:!a! --retry 3 -s -X POST -d "20210315-!a!-!max2!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10)
echo 第二次测试 !a! 不满足带宽需求,峰值速度 !max! kB/s
echo 第一次测试 !b!
curl --resolve !domain!:443:!b! https://!domain!/!file! -o nul --connect-timeout 5 --max-time 10 > CR.txt 2>&1
Expand Down Expand Up @@ -333,7 +333,7 @@ if !max! GEQ !speed! (cls&set anycast=!b!&goto end) else (goto five)
chcp 936
del CRLF.txt cut.txt speed.txt
cls
if !max1! GEQ !max2! (curl --ipv4 --resolve service.udpfile.com:443:!b! --retry 3 -s -X POST -d "20210308-!b!-!max1!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10) else (curl --ipv4 --resolve service.udpfile.com:443:!b! --retry 3 -s -X POST -d "20210308-!b!-!max2!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10)
if !max1! GEQ !max2! (curl --ipv4 --resolve service.udpfile.com:443:!b! --retry 3 -s -X POST -d "20210315-!b!-!max1!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10) else (curl --ipv4 --resolve service.udpfile.com:443:!b! --retry 3 -s -X POST -d "20210315-!b!-!max2!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10)
echo 第二次测试 !b! 不满足带宽需求,峰值速度 !max! kB/s
echo 第一次测试 !c!
curl --resolve !domain!:443:!c! https://!domain!/!file! -o nul --connect-timeout 5 --max-time 10 > CR.txt 2>&1
Expand Down Expand Up @@ -419,7 +419,7 @@ chcp 936
del CRLF.txt cut.txt speed.txt
cls
echo 第二次测试 !c! 不满足带宽需求,峰值速度 !max! kB/s
if !max1! GEQ !max2! (curl --ipv4 --resolve service.udpfile.com:443:!c! --retry 3 -s -X POST -d "20210308-!c!-!max1!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10) else (curl --ipv4 --resolve service.udpfile.com:443:!c! --retry 3 -s -X POST -d "20210308-!c!-!max2!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10)
if !max1! GEQ !max2! (curl --ipv4 --resolve service.udpfile.com:443:!c! --retry 3 -s -X POST -d "20210315-!c!-!max1!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10) else (curl --ipv4 --resolve service.udpfile.com:443:!c! --retry 3 -s -X POST -d "20210315-!c!-!max2!" https://service.udpfile.com?asn=%asn%^&city=%city% -o nul --connect-timeout 5 --max-time 10)
goto start
:end
set /a realbandwidth=max/128
Expand All @@ -429,7 +429,7 @@ if %time:~6,1% EQU 0 (set /a stopS=%time:~7,1%) else (set /a stopS=%time:~6,2%)
set /a starttime=%startH%*3600+%startM%*60+%startS%
set /a stoptime=%stopH%*3600+%stopM%*60+%stopS%
if %starttime% GTR %stoptime% (set /a alltime=86400-%starttime%+%stoptime%) else (set /a alltime=%stoptime%-%starttime%)
curl --ipv4 --resolve service.udpfile.com:443:!anycast! --retry 3 -s -X POST -d "20210308-!anycast!-!max!" https://service.udpfile.com?asn=%asn%^&city=%city% -o data.txt
curl --ipv4 --resolve service.udpfile.com:443:!anycast! --retry 3 -s -X POST -d "20210315-!anycast!-!max!" https://service.udpfile.com?asn=%asn%^&city=%city% -o data.txt
for /f "tokens=2 delims==" %%a in ('findstr /C:"publicip" data.txt') do (
set publicip=%%a
)
Expand Down

0 comments on commit d22994e

Please sign in to comment.