Unverified Commit d8b58a10 authored by Paróczai Olivér's avatar Paróczai Olivér Committed by GitHub

Only use DNS if public_ip_host option is empty (#1737)

In config: public_ip_host="" -> uses DNS for getting public IP public_ip_host="http://example.com/ip" -> uses wget/curl for getting public IP
parent cd6c4334
......@@ -3807,12 +3807,12 @@ get_local_ip() {
}
get_public_ip() {
if type -p dig >/dev/null; then
if [[ ! -n "$public_ip_host" ]] && type -p dig >/dev/null; then
public_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com)"
[[ "$public_ip" =~ ^\; ]] && unset public_ip
fi
if [[ -z "$public_ip" ]] && type -p drill >/dev/null; then
if [[ ! -n "$public_ip_host" ]] && [[ -z "$public_ip" ]] && type -p drill >/dev/null; then
public_ip="$(drill myip.opendns.com @resolver1.opendns.com | \
awk '/^myip\./ && $3 == "IN" {print $5}')"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment