2023-03-26 21:12:24 +01:00
|
|
|
/^[^[:space:]]/ { is_dns = /^dns:/ }
|
|
|
|
|
|
|
|
/^[[:space:]]+bind_hosts:/ { if (is_dns) prev_line = FNR }
|
|
|
|
|
|
|
|
/^[[:space:]]+- .+/ {
|
|
|
|
if (FNR - prev_line == 1) {
|
2023-04-13 15:40:45 +01:00
|
|
|
addrs[$2] = true
|
2023-03-26 21:12:24 +01:00
|
|
|
prev_line = FNR
|
2023-04-13 15:40:45 +01:00
|
|
|
|
2023-04-21 16:57:53 +01:00
|
|
|
if ($2 == "0.0.0.0" || $2 == "'::'") {
|
2023-04-13 15:40:45 +01:00
|
|
|
# Drop all the other addresses.
|
2023-04-19 11:48:59 +01:00
|
|
|
delete addrs
|
|
|
|
addrs[""] = true
|
2023-04-13 15:40:45 +01:00
|
|
|
prev_line = -1
|
|
|
|
}
|
2023-03-26 21:12:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/^[[:space:]]+port:/ { if (is_dns) port = $2 }
|
|
|
|
|
|
|
|
END {
|
2023-04-13 15:40:45 +01:00
|
|
|
for (addr in addrs) {
|
|
|
|
if (match(addr, ":")) {
|
|
|
|
print "[" addr "]:" port
|
2023-03-26 21:12:24 +01:00
|
|
|
} else {
|
2023-04-13 15:40:45 +01:00
|
|
|
print addr ":" port
|
2023-03-26 21:12:24 +01:00
|
|
|
}
|
|
|
|
}
|
2023-04-06 12:21:46 +01:00
|
|
|
}
|