mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-01-10 16:07:25 +03:00
aeec9a86e2
Merge in DNS/adguard-home from 5714-handle-zeroes-health to master Updates #5714. Squashed commit of the following: commit 24faab01faf723e313050294b3a35e249c3cd3e3 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Apr 19 13:10:24 2023 +0300 docker: add curly brackets commit 67365d02856200685551a79aa23cf59df4a3484b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Apr 18 20:16:12 2023 +0300 docker: imp zeroes check
29 lines
625 B
Awk
29 lines
625 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 == "\"\"" || $2 == "'::'") {
|
|
# Drop all the other addresses.
|
|
delete addrs
|
|
addrs[""] = true
|
|
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
|
|
}
|
|
}
|
|
}
|