Pull request home: fix client dns cache

Merge in DNS/adguard-home from custom-ups-cache-conf-fix to master

Squashed commit of the following:

commit 01a728e74b2e2e709c496794ca7ceb90703a02fc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Mon Nov 20 11:48:01 2023 +0200

    home: fix client dns cache
This commit is contained in:
Dimitry Kolyshev 2023-11-20 15:28:08 +03:00
parent 1c0bf95b5a
commit c8f1112d4e
2 changed files with 10 additions and 0 deletions

View file

@ -294,6 +294,8 @@ func (clients *clientsContainer) forConfig() (objs []*clientObject) {
UseGlobalBlockedServices: !cli.UseOwnBlockedServices, UseGlobalBlockedServices: !cli.UseOwnBlockedServices,
IgnoreQueryLog: cli.IgnoreQueryLog, IgnoreQueryLog: cli.IgnoreQueryLog,
IgnoreStatistics: cli.IgnoreStatistics, IgnoreStatistics: cli.IgnoreStatistics,
UpstreamsCacheEnabled: cli.UpstreamsCacheEnabled,
UpstreamsCacheSize: cli.UpstreamsCacheSize,
} }
objs = append(objs, o) objs = append(objs, o)

View file

@ -174,6 +174,12 @@ func (clients *clientsContainer) jsonToClient(cj clientJSON, prev *Client) (c *C
return nil, fmt.Errorf("validating blocked services: %w", err) return nil, fmt.Errorf("validating blocked services: %w", err)
} }
var upsCacheEnabled bool
var upsCacheSize uint32
if prev != nil {
upsCacheEnabled, upsCacheSize = prev.UpstreamsCacheEnabled, prev.UpstreamsCacheSize
}
c = &Client{ c = &Client{
safeSearchConf: safeSearchConf, safeSearchConf: safeSearchConf,
@ -192,6 +198,8 @@ func (clients *clientsContainer) jsonToClient(cj clientJSON, prev *Client) (c *C
UseOwnBlockedServices: !cj.UseGlobalBlockedServices, UseOwnBlockedServices: !cj.UseGlobalBlockedServices,
IgnoreQueryLog: ignoreQueryLog, IgnoreQueryLog: ignoreQueryLog,
IgnoreStatistics: ignoreStatistics, IgnoreStatistics: ignoreStatistics,
UpstreamsCacheEnabled: upsCacheEnabled,
UpstreamsCacheSize: upsCacheSize,
} }
if safeSearchConf.Enabled { if safeSearchConf.Enabled {