Pull request 1826: 5714 fix-docker-health

Merge in DNS/adguard-home from 5714-fix-docker-health to master

Updates #5714.

Squashed commit of the following:

commit 61251bffd7a21f1ceb867cc89de0a171645ca4c2
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Apr 13 16:45:41 2023 +0300

    docker: use localhost for unspecified
This commit is contained in:
Eugene Burkov 2023-04-13 17:40:45 +03:00
parent d78a3edb22
commit 0ea224a9e4
1 changed files with 13 additions and 5 deletions

View File

@ -4,19 +4,27 @@
/^[[:space:]]+- .+/ {
if (FNR - prev_line == 1) {
addrs[addrsnum++] = $2
addrs[$2] = true
prev_line = FNR
if ($2 == "0.0.0.0" || $2 == "::") {
delete addrs
addrs["localhost"] = true
# Drop all the other addresses.
prev_line = -1
}
}
}
/^[[:space:]]+port:/ { if (is_dns) port = $2 }
END {
for (i in addrs) {
if (match(addrs[i], ":")) {
print "[" addrs[i] "]:" port
for (addr in addrs) {
if (match(addr, ":")) {
print "[" addr "]:" port
} else {
print addrs[i] ":" port
print addr ":" port
}
}
}