ss-nat: use ping to lookup dns A records

This commit is contained in:
Jerry
2019-03-02 20:52:09 +08:00
parent 6734e12172
commit 1d5f250032
+2 -14
View File
@@ -175,13 +175,7 @@ while getopts ":s:l:S:L:i:I:e:a:b:w:ouUfh" arg; do
then
server=$OPTARG
else
if command -v dig > /dev/null
then
server=$(dig +short $OPTARG)
else
loger 3 "Hostname detected for server but no dig present to resolve!"
exit 1
fi
server=$(ping -4 -q -c 1 -s 0 -W 1 -w 1 $OPTARG| head -n 1 | sed -n 's/[^(]*(\([^)]*\)).*/\1/p')
fi
;;
l)
@@ -192,13 +186,7 @@ while getopts ":s:l:S:L:i:I:e:a:b:w:ouUfh" arg; do
then
SERVER=$OPTARG
else
if command -v dig > /dev/null
then
SERVER=$(dig +short $OPTARG)
else
loger 3 "Hostname detected for UDP server but no dig present to resolve!"
exit 1
fi
SERVER=$(ping -4 -q -c 1 -s 0 -W 1 -w 1 $OPTARG| head -n 1 | sed -n 's/[^(]*(\([^)]*\)).*/\1/p')
fi
;;
L)