Pull request: 2574 external tests vol.2

Merge in DNS/adguard-home from 2574-external-tests-2 to master

Updates #2574.

Squashed commit of the following:

commit 8a514facc33cb727ef842fc3048f72cc12efbbf1
Merge: 41c7374f 28b9abf1
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Feb 2 14:43:55 2021 +0300

    Merge branch 'master' into 2574-external-tests-2

commit 41c7374f88a292961c0217a6702e65c693691bf5
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Feb 2 14:42:33 2021 +0300

    dnsfilter: imp error messages

commit 1402a987ccec3f84d2e863d9dea6e47ac1c0249f
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Feb 2 14:07:11 2021 +0300

    dnsfilter: imp tests
This commit is contained in:
Eugene Burkov 2021-02-02 15:13:12 +03:00
parent 28b9abf1dd
commit 6fe227646b
3 changed files with 655 additions and 607 deletions

View File

@ -42,7 +42,6 @@ func (s *v6Server) WriteDiskConfig6(c *V6ServerConf) {
}
// Return TRUE if IP address is within range [start..0xff]
// nolint(staticcheck)
func ip6InRange(start, ip net.IP) bool {
if len(start) != 16 {
return false

View File

@ -163,15 +163,15 @@ func (s *Server) Exchange(req *dns.Msg) (*dns.Msg, error) {
return ctx.Res, nil
}
// Start starts the DNS server
// Start starts the DNS server.
func (s *Server) Start() error {
s.Lock()
defer s.Unlock()
return s.startInternal()
return s.startLocked()
}
// startInternal starts without locking
func (s *Server) startInternal() error {
// startLocked starts the DNS server without locking. For internal use only.
func (s *Server) startLocked() error {
err := s.dnsProxy.Start()
if err == nil {
s.isRunning = true
@ -256,15 +256,15 @@ func (s *Server) Prepare(config *ServerConfig) error {
return nil
}
// Stop stops the DNS server
// Stop stops the DNS server.
func (s *Server) Stop() error {
s.Lock()
defer s.Unlock()
return s.stopInternal()
return s.stopLocked()
}
// stopInternal stops without locking
func (s *Server) stopInternal() error {
// stopLocked stops the DNS server without locking. For internal use only.
func (s *Server) stopLocked() error {
if s.dnsProxy != nil {
err := s.dnsProxy.Stop()
if err != nil {
@ -289,7 +289,7 @@ func (s *Server) Reconfigure(config *ServerConfig) error {
defer s.Unlock()
log.Print("Start reconfiguring the server")
err := s.stopInternal()
err := s.stopLocked()
if err != nil {
return fmt.Errorf("could not reconfigure the server: %w", err)
}
@ -303,7 +303,7 @@ func (s *Server) Reconfigure(config *ServerConfig) error {
return fmt.Errorf("could not reconfigure the server: %w", err)
}
err = s.startInternal()
err = s.startLocked()
if err != nil {
return fmt.Errorf("could not reconfigure the server: %w", err)
}

File diff suppressed because it is too large Load Diff