+ control: use the list of IP addresses instead of single string in "dns_address"
"dns_address":"0.0.0.0" -> "dns_addresses":["127.0.0.1", "::1", ...]
This commit is contained in:
parent
6f56eb4c12
commit
b5eb840d22
19
control.go
19
control.go
|
@ -79,8 +79,25 @@ func httpUpdateConfigReloadDNSReturnOK(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
func handleStatus(w http.ResponseWriter, r *http.Request) {
|
||||
log.Tracef("%s %v", r.Method, r.URL)
|
||||
|
||||
dnsAddresses := []string{}
|
||||
if config.DNS.BindHost == "0.0.0.0" {
|
||||
ifaces, e := getValidNetInterfacesForWeb()
|
||||
if e != nil {
|
||||
log.Error("Couldn't get network interfaces: %v", e)
|
||||
}
|
||||
for _, iface := range ifaces {
|
||||
for _, addr := range iface.Addresses {
|
||||
dnsAddresses = append(dnsAddresses, addr)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(dnsAddresses) == 0 {
|
||||
dnsAddresses = append(dnsAddresses, config.DNS.BindHost)
|
||||
}
|
||||
|
||||
data := map[string]interface{}{
|
||||
"dns_address": config.DNS.BindHost,
|
||||
"dns_addresses": dnsAddresses,
|
||||
"http_port": config.BindPort,
|
||||
"dns_port": config.DNS.Port,
|
||||
"protection_enabled": config.DNS.ProtectionEnabled,
|
||||
|
|
Loading…
Reference in New Issue