Browse Source

ss-nat: use ping to lookup dns A records

pull/2304/head
Jerry 5 years ago
parent
commit
1d5f250032
No known key found for this signature in database GPG Key ID: 9D9CE43650FF2BAA
1 changed files with 2 additions and 14 deletions
  1. 16
      src/ss-nat

16
src/ss-nat

@ -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)

Loading…
Cancel
Save