Pull request: 2179 ipset subdomains

Merge in DNS/adguard-home from 2179-ipset-subdomains to master

Closes #2179.

Squashed commit of the following:

commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jan 29 18:34:46 2021 +0300

    dnsforward: imp code, docs

commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jan 26 20:43:31 2021 +0300

    dnsforward: imp code

commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <sheets@alum.mit.edu>
Date:   Tue Oct 6 16:34:06 2020 +0100

    dnsforward: support subdomain matching in ipset

    This is a squash of all commits in #2179.
This commit is contained in:
Ainar Garipov
2021-01-29 18:53:39 +03:00
parent 0d0a419bd3
commit 510573a904
8 changed files with 425 additions and 186 deletions

View File

@@ -108,6 +108,12 @@ func (s *Server) Close() {
s.stats = nil
s.queryLog = nil
s.dnsProxy = nil
err := s.ipset.Close()
if err != nil {
log.Error("closing ipset: %s", err)
}
s.Unlock()
}
@@ -190,11 +196,14 @@ func (s *Server) Prepare(config *ServerConfig) error {
// Initialize IPSET configuration
// --
s.ipset.init(s.conf.IPSETList)
err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
}
// Prepare DNS servers settings
// --
err := s.prepareUpstreamSettings()
err = s.prepareUpstreamSettings()
if err != nil {
return err
}