mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-01-10 16:07:25 +03:00
0ea224a9e4
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
30 lines
617 B
Awk
30 lines
617 B
Awk
/^[^[:space:]]/ { is_dns = /^dns:/ }
|
|
|
|
/^[[:space:]]+bind_hosts:/ { if (is_dns) prev_line = FNR }
|
|
|
|
/^[[:space:]]+- .+/ {
|
|
if (FNR - prev_line == 1) {
|
|
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 (addr in addrs) {
|
|
if (match(addr, ":")) {
|
|
print "[" addr "]:" port
|
|
} else {
|
|
print addr ":" port
|
|
}
|
|
}
|
|
}
|