Check if PROXY variable is IP address or not
This commit is contained in:
@@ -12,6 +12,7 @@ SOURCE=$PROXY
|
||||
TARGET=$TARGET
|
||||
DOMAIN=$DOMAIN
|
||||
LOCATION=$LOCATION
|
||||
ALLOWED_NETWORKS=$ALLOWED_NETWORKS
|
||||
PORT=$PORT
|
||||
PUBLIC_PROXY_PATH=$PUBLIC_PROXY_PATH
|
||||
SMARTHOST_PROXY_PATH=$SMARTHOST_PROXY_PATH
|
||||
@@ -142,19 +143,23 @@ name_resolver() {
|
||||
|
||||
if [ ! -z "$SOURCE" ]; then
|
||||
for i in $(echo $SOURCE) ; do
|
||||
name_resolver $i;
|
||||
debug "source ip is $APP_IP";
|
||||
if [[ -z "$APP_IP" ]]; then
|
||||
debug "No any IP address found for SOURCE: $SOURCE, try again to resolv";
|
||||
if [[ $i =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
SOURCE_IP=$i;
|
||||
else
|
||||
name_resolver $i;
|
||||
debug "Source ip is $APP_IP";
|
||||
|
||||
debug "source ip is $APP_IP";
|
||||
if [[ -z "$APP_IP" ]]; then
|
||||
debug "No any IP address found for SOURCE: $SOURCE, giving up";
|
||||
exit;
|
||||
debug "No any IP address found for SOURCE: $SOURCE, try again to resolv";
|
||||
name_resolver $i;
|
||||
debug "Source ip is $APP_IP";
|
||||
|
||||
if [[ -z "$APP_IP" ]]; then
|
||||
debug "No any IP address found for SOURCE: $SOURCE, giving up";
|
||||
exit;
|
||||
fi
|
||||
fi
|
||||
SOURCE_IP=$APP_IP;
|
||||
fi
|
||||
SOURCE_IP=$APP_IP;
|
||||
done
|
||||
else
|
||||
debug "SOURCE is empty";
|
||||
@@ -250,7 +255,7 @@ if [ "$SMARTHOST_PROXY_PATH" != "" ]; then
|
||||
"LOCAL_PATH": "'$LOCATION'",
|
||||
"LOCAL_NAME": "'$TARGET_IP'",
|
||||
"LOCAL_PORT": "'$PORT'",
|
||||
"LOCAL_ALLOWED_NETWORK": ""
|
||||
"LOCAL_ALLOWED_NETWORK": "'$ALLOWED_NETWORKS'"
|
||||
} ]
|
||||
';
|
||||
else
|
||||
|
Reference in New Issue
Block a user