deployment: Try to autodiscover Public IP via HTTP if DNS outgoing traffic is not enabled

pull/678/head
cruizba 2021-12-24 14:17:51 +01:00
parent e6b4f23fcf
commit 3a59b7b921
3 changed files with 8 additions and 4 deletions

View File

@ -2,7 +2,7 @@ FROM coturn/coturn:4.5.2-alpine
USER root USER root
RUN apk add --no-cache bind-tools grep RUN apk add --no-cache bind-tools grep curl
# Override detect-external-ip.sh script # Override detect-external-ip.sh script
COPY ./detect-external-ip.sh /usr/local/bin/detect-external-ip.sh COPY ./detect-external-ip.sh /usr/local/bin/detect-external-ip.sh

View File

@ -85,7 +85,8 @@ if [ "$CFG_IPV4" = "true" ]; then
COMMANDS='dig @resolver1.opendns.com myip.opendns.com A -4 +short COMMANDS='dig @resolver1.opendns.com myip.opendns.com A -4 +short
dig @ns1.google.com o-o.myaddr.l.google.com TXT -4 +short | tr -d \" dig @ns1.google.com o-o.myaddr.l.google.com TXT -4 +short | tr -d \"
dig @1.1.1.1 whoami.cloudflare TXT CH -4 +short | tr -d \" dig @1.1.1.1 whoami.cloudflare TXT CH -4 +short | tr -d \"
dig @ns1-1.akamaitech.net whoami.akamai.net A -4 +short' dig @ns1-1.akamaitech.net whoami.akamai.net A -4 +short
curl -4 ifconfig.co'
is_valid_ip() { is_valid_ip() {
# Check if the input looks like an IPv4 address. # Check if the input looks like an IPv4 address.
@ -95,7 +96,8 @@ if [ "$CFG_IPV4" = "true" ]; then
else else
COMMANDS='dig @resolver1.opendns.com myip.opendns.com AAAA -6 +short COMMANDS='dig @resolver1.opendns.com myip.opendns.com AAAA -6 +short
dig @ns1.google.com o-o.myaddr.l.google.com TXT -6 +short | tr -d \" dig @ns1.google.com o-o.myaddr.l.google.com TXT -6 +short | tr -d \"
dig @2606:4700:4700::1111 whoami.cloudflare TXT CH -6 +short | tr -d \"' dig @2606:4700:4700::1111 whoami.cloudflare TXT CH -6 +short | tr -d \"
curl -6 ifconfig.co'
is_valid_ip() { is_valid_ip() {
# Check if the input looks like an IPv6 address. # Check if the input looks like an IPv6 address.

View File

@ -83,6 +83,7 @@ if [[ "$CFG_IPV4" == "true" ]]; then
'dig @ns1.google.com o-o.myaddr.l.google.com TXT -4 +short | tr -d \"' 'dig @ns1.google.com o-o.myaddr.l.google.com TXT -4 +short | tr -d \"'
'dig @1.1.1.1 whoami.cloudflare TXT CH -4 +short | tr -d \"' 'dig @1.1.1.1 whoami.cloudflare TXT CH -4 +short | tr -d \"'
'dig @ns1-1.akamaitech.net whoami.akamai.net A -4 +short' 'dig @ns1-1.akamaitech.net whoami.akamai.net A -4 +short'
'curl -4 ifconfig.co'
) )
function is_valid_ip() { function is_valid_ip() {
@ -95,6 +96,7 @@ elif [[ "$CFG_IPV6" == "true" ]]; then
'dig @resolver1.opendns.com myip.opendns.com AAAA -6 +short' 'dig @resolver1.opendns.com myip.opendns.com AAAA -6 +short'
'dig @ns1.google.com o-o.myaddr.l.google.com TXT -6 +short | tr -d \"' 'dig @ns1.google.com o-o.myaddr.l.google.com TXT -6 +short | tr -d \"'
'dig @2606:4700:4700::1111 whoami.cloudflare TXT CH -6 +short | tr -d \"' 'dig @2606:4700:4700::1111 whoami.cloudflare TXT CH -6 +short | tr -d \"'
'curl -6 ifconfig.co'
) )
function is_valid_ip() { function is_valid_ip() {
@ -113,4 +115,4 @@ for COMMAND in "${COMMANDS[@]}"; do
done done
echo "[getmyip] All providers failed" >&2 echo "[getmyip] All providers failed" >&2
exit 1 exit 1