all: fix private conf fail on start

This commit is contained in:
Eugene Burkov 2024-03-13 19:19:49 +03:00
parent c11fc3e7ab
commit c6cce9644e
2 changed files with 18 additions and 2 deletions

View File

@ -30,6 +30,15 @@ NOTE: Add new changes BELOW THIS COMMENT.
- Ability to define custom directories for storage of query log files and
statistics ([#5992]).
### Changed
- Private RDNS resolution (`dns.use_private_ptr_resolvers` in YAML
configuration) now requires a valid "Private reverse DNS servers", when
enabled ([#6820]).
**NOTE:** Disabling private RDNS resolution behaves effectively the same as if
no private reverse DNS servers provided by user and by the OS.
### Fixed
- Statistics for 7 days displayed by day on the dashboard graph ([#6712]).
@ -41,6 +50,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
[#6711]: https://github.com/AdguardTeam/AdGuardHome/issues/6711
[#6712]: https://github.com/AdguardTeam/AdGuardHome/issues/6712
[#6740]: https://github.com/AdguardTeam/AdGuardHome/issues/6740
[#6820]: https://github.com/AdguardTeam/AdGuardHome/issues/6820
<!--
NOTE: Add new changes ABOVE THIS COMMENT.

View File

@ -557,13 +557,15 @@ func (s *Server) setupLocalResolvers(boot upstream.Resolver) (uc *proxy.Upstream
return nil, err
}
s.localResolvers, err = proxy.New(&proxy.Config{
localResolvers, err := proxy.New(&proxy.Config{
UpstreamConfig: uc,
})
if err != nil {
return nil, &LocalResolversError{Err: err}
}
s.localResolvers = localResolvers
// TODO(e.burkov): Should we also consider the DNS64 usage?
return uc, nil
}
@ -617,11 +619,13 @@ func (s *Server) Prepare(conf *ServerConfig) (err error) {
return fmt.Errorf("setting up fallback dns servers: %w", err)
}
s.dnsProxy, err = proxy.New(proxyConfig)
dnsProxy, err := proxy.New(proxyConfig)
if err != nil {
return fmt.Errorf("creating proxy: %w", err)
}
s.dnsProxy = dnsProxy
s.recDetector.clear()
s.setupAddrProc()
@ -854,6 +858,8 @@ func (s *Server) Reconfigure(conf *ServerConfig) error {
}
}
// TODO(e.burkov): It seems an error here brings the server down, which is
// not reliable enough.
err = s.Prepare(conf)
if err != nil {
return fmt.Errorf("could not reconfigure the server: %w", err)