Skip to content
Snippets Groups Projects
Verified Commit a7884e2c authored by Recolic Keghart's avatar Recolic Keghart
Browse files

better ping, add rocket, remove ddns-usa

parent f78b7061
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ tests = [
('./do.bash mc', 'Minecraft Server'),
('./do.bash push-httpdb-agent', 'httpdb'),
('./do.bash ddns-wuhan', 'DDNS WuHan'),
('./do.bash ddns-us', 'DDNS USA'),
('./do.bash rocket', 'Recolic Rocket Chat'),
('./do.bash dl', 'Download Site'),
('./do.bash shortlink', 'Short Link'),
]
......
#!/bin/bash
[[ $1 == '' ]] && echo -e 'Usage: '"$0 <operation> ...\n operation := rproxy | drive | ss-tw | ss-us1 | ss-us5 | ss-us6 | ovpn-tw | www | mail | tm | git | zhixiang | mc | push-httpdb-agent | ddns-wuhan | ddns-us | dl | shortlink | all" && exit 1
[[ $1 == '' ]] && echo -e 'Usage: '"$0 <operation> ...\n operation := rproxy | drive | ss-tw | ss-us1 | ss-us5 | ss-us6 | ovpn-tw | www | mail | tm | git | zhixiang | mc | push-httpdb-agent | ddns-wuhan | rocket | dl | shortlink | all" && exit 1
function confirm_alive () {
local host="$1"
timeout 4s ping "$host" -c 2
timeout 4s ping "$host" -c 1
local ret="$?"
[[ $ret != 124 ]] && return $ret
[[ $ret != 124 ]] && [[ $ret != 2 ]] && return $ret
for i in {1..4}; do
timeout 2s ping "$host" -c 1 && return 0
timeout 3s ping "$host" -c 1 && return 0
sleep 1
done
return 124
}
......@@ -69,23 +70,36 @@ function do_test () {
curl -s -L http://recolic.net/ | grep 'Follow me on github' || return $?
;;
mail )
confirm_alive smtp.recolic.net &&
confirm_alive imap.recolic.net &&
confirm_alive mail.recolic.net &&
confirm_alive pop3.recolic.net || return $?
# Fucking DigitalOcean
# test_tcp smtp.recolic.net 25 | grep 220 || return $?
test_tcp smtp.recolic.net 587 | grep 220 || return $?
# test_tcp imap.recolic.net 143 | grep OK || return $?
if test_tcp smtp-mail.outlook.com 25 | grep 220; then
test_tcp smtp.recolic.net 25 | grep 220 || return $?
fi
test_tcp smtp.recolic.net 587 || return $?
if test_tcp imap-mail.outlook.com 143 | grep OK; then
test_tcp imap.recolic.net 143 | grep OK || return $?
fi
test_tcp imap.recolic.net 993 || return $?
# test_tcp pop3.recolic.net 110 | grep OK || return $?
if test_tcp pop3.live.com 110 | grep OK; then
test_tcp pop3.recolic.net 110 | grep OK || return $?
fi
test_tcp pop3.recolic.net 995 || return $?
curl -s https://mail.recolic.net/mail/ | grep 'Welcome to Roundcube' || return $?
curl http://mail.recolic.net/ -vv 2>&1 | grep 'https://mail.recolic.net/' || return $?
;;
tm )
confirm_alive tm.recolic.net &&
curl -s https://tm.recolic.net/ | grep inputButtonCss &&
curl -s http://tm.recolic.net/ -L | grep inputButtonCss || return $?
curl -s 'https://tm.recolic.net/addtask?openid=23251fc131e118d07fc9932f3c3de92c&N=30.508914&E=114.40718&key=FUCKYOU' | grep 'invalid key' || return $?
;;
git )
confirm_alive git.recolic.net &&
curl -s https://git.recolic.net/ | grep 'users/sign_in' &&
curl -s http://git.recolic.net/ -L | grep 'users/sign_in' || return $?
;;
......@@ -95,30 +109,39 @@ function do_test () {
curl -k -X POST -s 'https://api.anjie-elec.cn/api/usewater/Add?accessToken=FUCKYOU' | grep '104871845A503324' || return $?
;;
mc )
confirm_alive mc.recolic.net &&
test_tcp mc.recolic.net 25565 || return $?
;;
push-httpdb-agent )
local r="$RANDOM"
confirm_alive git.recolic.net &&
curl -s "https://git.recolic.net/_r_testing/set/_status_test|$r" &&
local result=$(curl -s "https://git.recolic.net/_r_testing/get/_status_test") || return $?
[[ $r = $result ]]
return $?
;;
ddns-wuhan )
confirm_alive base.ddns1.recolic.net &&
test_tcp base.ddns1.recolic.net 22 || return $?
;;
ddns-us )
test_tcp base.ddns2.recolic.net 22 | grep SSH &&
test_tcp base.ddns2.recolic.net 80 &&
test_tcp nohsts.ddns2.recolic.org 22 | grep SSH &&
test_tcp nohsts.ddns2.recolic.org 80 || return $?
;;
#ddns-us )
# test_tcp base.ddns2.recolic.net 22 | grep SSH &&
# test_tcp base.ddns2.recolic.net 80 &&
# test_tcp nohsts.ddns2.recolic.org 22 | grep SSH &&
# test_tcp nohsts.ddns2.recolic.org 80 || return $?
# ;;
dl )
confirm_alive dl.recolic.net &&
curl -s -L https://dl.recolic.net/ | grep 'Home page is not provided for this download site' || return $?
;;
shortlink )
confirm_alive recolic.net &&
curl -s 'https://recolic.net/go/index.php' --data 'target=https%3A%2F%2Fwww.google.com&name=google&super=' | grep Success || return $?
;;
rocket )
confirm_alive rocket.recolic.net &&
curl -s https://rocket.recolic.net/api/info | grep 'success":true' || return $?
;;
esac
}
......@@ -143,7 +166,7 @@ if [[ "$1" = all ]]; then
do_test_twice mc &&
do_test_twice push-httpdb-agent &&
do_test_twice ddns-wuhan &&
do_test_twice ddns-us &&
do_test_twice rocket &&
do_test_twice shortlink &&
do_test_twice dl
exit $?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment