Skip to content

Commit

Permalink
add UNBOUND MODE TEST.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkkgo committed Dec 26, 2023
1 parent 2e0ee9e commit ce125e4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 28 deletions.
7 changes: 7 additions & 0 deletions src/debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,26 @@ echo "[TEST]" IP ROUTE
blank
echo CN IP URL:
mosdns curl http://test.ipw.cn | grep -Eo "$IPREX4" | tail -1
echo -
mosdns curl http://ipsu.03k.org/cdn-cgi/trace | grep -Eo "$IPREX4" | tail -1
echo --
mosdns curl https://cf-ns.com/cdn-cgi/trace | grep -Eo "$IPREX4" | tail -1
echo CN RAW-IP URL:
mosdns curl http://115.231.186.225/ | grep -Eo "$IPREX4" | grep -v "115.231.186.225" | tail -1
echo ------------------
echo Non-CN IP URL:
mosdns curl https://www.cloudflare.com/cdn-cgi/trace | grep -Eo "$IPREX4" | tail -1
echo -
mosdns curl http://checkip.synology.com/ | grep -Eo "$IPREX4" | tail -1
echo --
mosdns curl https://v4.ident.me/ | grep -Eo "$IPREX4" | tail -1
echo Non-CN RAW-IP URL:
mosdns curl https://1.1.1.1/cdn-cgi/trace | grep -Eo "$IPREX4" | tail -1
echo -
mosdns curl https://1.0.0.3/cdn-cgi/trace | grep -Eo "$IPREX4" | tail -1
echo --
mosdns curl https://1.0.0.2/cdn-cgi/trace | grep -Eo "$IPREX4" | tail -1
echo ---
mosdns curl https://1.0.0.1/cdn-cgi/trace | grep -Eo "$IPREX4" | tail -1
echo ------------------
#sleep 5
Expand Down
70 changes: 42 additions & 28 deletions src/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,33 @@ v4check() {
exit
fi
}
if ps -ef | grep -v grep | grep -q mosdns.yaml; then
blank
echo "-> test start \`$(date +%s)\`"
echo "\`\`\`rust"
if [ -w /data ]; then
t1=y
else
t1="[ERROR]DATA_not_writeable"
fi
blank
echo "-> test start \`$(date +%s)\`"
echo "\`\`\`rust"
if [ -w /data ]; then
t1=y
else
t1="[ERROR]DATA_not_writeable"
fi

if [ -r /data ]; then
t2=y
else
t2="[ERROR]DATA_not_readable"
fi
if dig +short whether.114dns.com @114.114.114.114 | grep -q "127.0.0.1"; then
t3="[DNS hijack]"
else
t3=y
fi
if dig +short whoami.ds.akahelp.net @9.8.7.6 txt -p53 +retry=0 +timeout=1 | grep -q timed; then
t4=y
else
t4="[DNS hijack]"
fi
t5t=$(dig www.taobao.com @127.0.0.1 -p53 A +short)
t5=$(v4check "$t5t" CN-53)
if [ -r /data ]; then
t2=y
else
t2="[ERROR]DATA_not_readable"
fi
if dig +short whether.114dns.com @114.114.114.114 | grep -q "127.0.0.1"; then
t3="[DNS hijack]"
else
t3=y
fi
if dig +short whoami.ds.akahelp.net @9.8.7.6 txt -p53 +retry=0 +timeout=1 | grep -q timed; then
t4=y
else
t4="[DNS hijack]"
fi
t5t=$(dig www.taobao.com @127.0.0.1 -p53 A +short)
t5=$(v4check "$t5t" CN-53)
if ps -ef | grep -v grep | grep -q mosdns.yaml; then
t6t=$(dig www.taobao.com @127.0.0.1 -p5301 A +short)
t6=$(v4check "$t6t" CN-5301)
t7t=$(dig www.taobao.com @127.0.0.1 -p5302 A +short)
Expand All @@ -61,13 +61,27 @@ if ps -ef | grep -v grep | grep -q mosdns.yaml; then
if echo $result | grep -q "yyyyyyyyyyyy"; then
echo "[INFO]" ALL TEST PASS.
else
echo $result
echo $result
echo "[INFO]" TEST FAIL.
fi
echo "\`\`\`"
echo "-> test end \`$(date +%s)\`"
echo
else
echo "DNS NOT READY."
if [ "$CNAUTO" != "no" ]; then
echo "DNS NOT READY."
else
echo "UNBOUND MODE TEST."
result=$t1$t2$t3$t4$t5
if echo $result | grep -q "yyyyy"; then
echo "[INFO]" ALL TEST PASS.
else
echo $result
echo "[INFO]" TEST FAIL.
fi
echo "\`\`\`"
echo "-> test end \`$(date +%s)\`"
echo
fi
fi
blank

0 comments on commit ce125e4

Please sign in to comment.