diff --git a/src/ss-nat b/src/ss-nat index 4b2183f4..8ba122e7 100755 --- a/src/ss-nat +++ b/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)