Browse Source
ss-nat: use ping to lookup dns A records
pull/2304/head
Jerry
5 years ago
No known key found for this signature in database
GPG Key ID: 9D9CE43650FF2BAA
1 changed files with
2 additions and
14 deletions
-
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) |
|
|
|