mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-15 18:08:30 -07:00
Code simplify
This commit is contained in:
parent
141b14c94a
commit
1223965cd4
16
control.go
16
control.go
@ -354,23 +354,19 @@ func setDNSServers(w *http.ResponseWriter, r *http.Request, upstreams bool) {
|
||||
}
|
||||
|
||||
// count of upstream or bootstrap servers
|
||||
var count int
|
||||
if upstreams {
|
||||
count = len(hosts)
|
||||
} else {
|
||||
count := len(hosts)
|
||||
if !upstreams {
|
||||
count = len(bootstraps)
|
||||
}
|
||||
|
||||
if upstreams {
|
||||
if count == 0 {
|
||||
config.DNS.UpstreamDNS = defaultDNS
|
||||
} else {
|
||||
config.DNS.UpstreamDNS = defaultDNS
|
||||
if count != 0 {
|
||||
config.DNS.UpstreamDNS = hosts
|
||||
}
|
||||
} else {
|
||||
if count == 0 {
|
||||
config.DNS.BootstrapDNS = defaultBootstrap
|
||||
} else {
|
||||
config.DNS.BootstrapDNS = defaultBootstrap
|
||||
if count != 0 {
|
||||
config.DNS.BootstrapDNS = bootstraps
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user