Code simplify
This commit is contained in:
parent
141b14c94a
commit
1223965cd4
12
control.go
12
control.go
|
@ -354,23 +354,19 @@ func setDNSServers(w *http.ResponseWriter, r *http.Request, upstreams bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// count of upstream or bootstrap servers
|
// count of upstream or bootstrap servers
|
||||||
var count int
|
count := len(hosts)
|
||||||
if upstreams {
|
if !upstreams {
|
||||||
count = len(hosts)
|
|
||||||
} else {
|
|
||||||
count = len(bootstraps)
|
count = len(bootstraps)
|
||||||
}
|
}
|
||||||
|
|
||||||
if upstreams {
|
if upstreams {
|
||||||
if count == 0 {
|
|
||||||
config.DNS.UpstreamDNS = defaultDNS
|
config.DNS.UpstreamDNS = defaultDNS
|
||||||
} else {
|
if count != 0 {
|
||||||
config.DNS.UpstreamDNS = hosts
|
config.DNS.UpstreamDNS = hosts
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if count == 0 {
|
|
||||||
config.DNS.BootstrapDNS = defaultBootstrap
|
config.DNS.BootstrapDNS = defaultBootstrap
|
||||||
} else {
|
if count != 0 {
|
||||||
config.DNS.BootstrapDNS = bootstraps
|
config.DNS.BootstrapDNS = bootstraps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue