Merge branch 'master' of github.com:OpenVidu/openvidu

pull/447/head
OscarSotoSanchez 2020-04-21 13:44:53 +02:00
commit bee2ad0de6
3 changed files with 24 additions and 21 deletions

View File

@ -9,7 +9,7 @@ function valid_ip()
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
ip=("$ip")
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
&& ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
@ -20,23 +20,24 @@ function valid_ip()
# Services to get public ip
SERVICES=(
"curl --silent -sw :%{http_code} ipv4.icanhazip.com"
"curl --silent -sw :%{http_code} ifconfig.me"
"curl --silent -sw :%{http_code} -4 ifconfig.co"
"curl --silent -sw :%{http_code} ipecho.net/plain"
"curl --silent -sw :%{http_code} ipinfo.io/ip"
"curl --silent -sw :%{http_code} checkip.amazonaws.com"
"curl --silent -sw :%{http_code} ident.me"
"curl --silent -sw :%{http_code} icanhazip.com"
"curl --silent -sw :%{http_code} v4.ident.me"
)
# Get public ip
for service in "${SERVICES[@]}"; do
RUN_COMMAND=$($service | tr -d '[:space:]')
IP=$(echo $RUN_COMMAND | cut -d':' -f1)
HTTP_CODE=$(echo $RUN_COMMAND | cut -d':' -f2)
IP=$(echo "$RUN_COMMAND" | cut -d':' -f1)
HTTP_CODE=$(echo "$RUN_COMMAND" | cut -d':' -f2)
if [ "$HTTP_CODE" == "200" ]; then
if valid_ip "$IP"; then
printf "$IP"
printf "%s" "$IP"
exit 0
fi
fi

View File

@ -9,7 +9,7 @@ function valid_ip()
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
ip=("$ip")
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
&& ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
@ -20,23 +20,24 @@ function valid_ip()
# Services to get public ip
SERVICES=(
"curl --silent -sw :%{http_code} ipv4.icanhazip.com"
"curl --silent -sw :%{http_code} ifconfig.me"
"curl --silent -sw :%{http_code} -4 ifconfig.co"
"curl --silent -sw :%{http_code} ipecho.net/plain"
"curl --silent -sw :%{http_code} ipinfo.io/ip"
"curl --silent -sw :%{http_code} checkip.amazonaws.com"
"curl --silent -sw :%{http_code} ident.me"
"curl --silent -sw :%{http_code} icanhazip.com"
"curl --silent -sw :%{http_code} v4.ident.me"
)
# Get public ip
for service in "${SERVICES[@]}"; do
RUN_COMMAND=$($service | tr -d '[:space:]')
IP=$(echo $RUN_COMMAND | cut -d':' -f1)
HTTP_CODE=$(echo $RUN_COMMAND | cut -d':' -f2)
IP=$(echo "$RUN_COMMAND" | cut -d':' -f1)
HTTP_CODE=$(echo "$RUN_COMMAND" | cut -d':' -f2)
if [ "$HTTP_CODE" == "200" ]; then
if valid_ip "$IP"; then
printf "$IP"
printf "%s" "$IP"
exit 0
fi
fi

View File

@ -9,7 +9,7 @@ function valid_ip()
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
ip=("$ip")
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
&& ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
@ -20,23 +20,24 @@ function valid_ip()
# Services to get public ip
SERVICES=(
"curl --silent -sw :%{http_code} ipv4.icanhazip.com"
"curl --silent -sw :%{http_code} ifconfig.me"
"curl --silent -sw :%{http_code} -4 ifconfig.co"
"curl --silent -sw :%{http_code} ipecho.net/plain"
"curl --silent -sw :%{http_code} ipinfo.io/ip"
"curl --silent -sw :%{http_code} checkip.amazonaws.com"
"curl --silent -sw :%{http_code} ident.me"
"curl --silent -sw :%{http_code} icanhazip.com"
"curl --silent -sw :%{http_code} v4.ident.me"
)
# Get public ip
for service in "${SERVICES[@]}"; do
RUN_COMMAND=$($service | tr -d '[:space:]')
IP=$(echo $RUN_COMMAND | cut -d':' -f1)
HTTP_CODE=$(echo $RUN_COMMAND | cut -d':' -f2)
IP=$(echo "$RUN_COMMAND" | cut -d':' -f1)
HTTP_CODE=$(echo "$RUN_COMMAND" | cut -d':' -f2)
if [ "$HTTP_CODE" == "200" ]; then
if valid_ip "$IP"; then
printf "$IP"
printf "%s" "$IP"
exit 0
fi
fi