Commit d4248de8 authored by Yuanle Song's avatar Yuanle Song
Browse files

v0.1.4 allow private ip by default

add option: ALLOW_PRIVATE_IP, set to yes by default.
parent 108a3b0c
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
CONFIG_FILE="$HOME/.ddclient-http"

VERSION="v0.1.3dev"
VERSION="v0.1.4"

# exit codes
GET_MYIP_FAILED=1
@@ -73,6 +73,9 @@ fatal_err() {
	test -z "$FATAL_ERROR_EMAIL" || echo -e "$@" | mail -s "ddclient-http FATAL Error" "$FATAL_ERROR_EMAIL"
}

# default options
ALLOW_PRIVATE_IP=yes

# which host to update and it's credentials.
if [ -f "$CONFIG_FILE" ]; then
	. "$CONFIG_FILE"
@@ -177,10 +180,12 @@ Delete $FATAL_ERROR_FILE when you cleared the issue."
	fi

	# check IP is a public IP.
	if [ "$ALLOW_PRIVATE_IP" = "no" ]; then
		if ! is_public_ip "$MYIP"; then
		err "Error: bad IP address: $MYIP."
			err "Error: ignoring private IP: $MYIP."
			exit $BAD_IP_ADDRESS
		fi
	fi

	# do update
	URL=`printf $UPDATE_URL $MYIP`