+ clients: find DNS client's hostname by IP using rDNS

This commit is contained in:
Simon Zolin
2019-05-21 14:53:13 +03:00
parent c038e4cf14
commit a12f01793f
3 changed files with 144 additions and 0 deletions

View File

@@ -88,6 +88,7 @@ type ServerConfig struct {
Upstreams []upstream.Upstream // Configured upstreams
DomainsReservedUpstreams map[string][]upstream.Upstream // Map of domains and lists of configured upstreams
Filters []dnsfilter.Filter // A list of filters to use
OnDNSRequest func(d *proxy.DNSContext)
FilteringConfig
TLSConfig
@@ -324,6 +325,10 @@ func (s *Server) GetStatsHistory(timeUnit time.Duration, startTime time.Time, en
func (s *Server) handleDNSRequest(p *proxy.Proxy, d *proxy.DNSContext) error {
start := time.Now()
if s.conf.OnDNSRequest != nil {
s.conf.OnDNSRequest(d)
}
// use dnsfilter before cache -- changed settings or filters would require cache invalidation otherwise
res, err := s.filterDNSRequest(d)
if err != nil {