mirror of
https://github.com/gaoyifan/china-operator-ip.git
synced 2025-07-13 12:52:36 +08:00
Reformat code
This commit is contained in:
parent
6f9976598d
commit
052696c5b5
30
common.sh
30
common.sh
@ -3,7 +3,7 @@
|
|||||||
[[ $DEBUG == true ]] && set -x
|
[[ $DEBUG == true ]] && set -x
|
||||||
|
|
||||||
log_info(){
|
log_info(){
|
||||||
>&2 echo "INFO>" $@
|
>&2 echo "INFO>" $@
|
||||||
}
|
}
|
||||||
|
|
||||||
get_asn(){
|
get_asn(){
|
||||||
@ -35,21 +35,21 @@ prepare_data_v6(){
|
|||||||
log_info "finish bgpdump v6"
|
log_info "finish bgpdump v6"
|
||||||
}
|
}
|
||||||
prepare_data(){
|
prepare_data(){
|
||||||
curl -sSL https://bgp.potaroo.net/cidr/autnums.html | awk '-F[<>]' '{print $3,$5}' | grep '^AS' > asnames.txt &
|
curl -sSL https://bgp.potaroo.net/cidr/autnums.html | awk '-F[<>]' '{print $3,$5}' | grep '^AS' > asnames.txt &
|
||||||
prepare_data_v4 &
|
prepare_data_v4 &
|
||||||
prepare_data_v6 &
|
prepare_data_v6 &
|
||||||
wait_exit
|
wait_exit
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_exit(){
|
wait_exit(){
|
||||||
local oldstate=$(set +o)
|
local oldstate=$(set +o)
|
||||||
set +e
|
set +e
|
||||||
local s=0
|
local s=0
|
||||||
while [[ $s -ne 127 ]]; do
|
while [[ $s -ne 127 ]]; do
|
||||||
[[ $s -ne 0 ]] && exit $s
|
[[ $s -ne 0 ]] && exit $s
|
||||||
wait -n
|
wait -n
|
||||||
s=$?
|
s=$?
|
||||||
done
|
done
|
||||||
eval "$oldstate"
|
eval "$oldstate"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
10
stat.sh
10
stat.sh
@ -5,11 +5,11 @@ cd result
|
|||||||
for file in *.txt; do
|
for file in *.txt; do
|
||||||
echo ${file%.*}
|
echo ${file%.*}
|
||||||
if [[ $file == *6.txt ]]; then
|
if [[ $file == *6.txt ]]; then
|
||||||
#statistics IPv6 /48 blocks
|
#statistics IPv6 /48 blocks
|
||||||
base=48
|
base=48
|
||||||
else
|
else
|
||||||
base=32
|
base=32
|
||||||
fi
|
fi
|
||||||
cat $file |
|
cat $file |
|
||||||
awk -F\/ '{print $2}' |
|
awk -F\/ '{print $2}' |
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user