mirror of https://github.com/OpenVidu/openvidu.git
Merge branch 'master' of github.com:OpenVidu/openvidu
commit
bee2ad0de6
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue