Pull request 1931: 6006-fix-cmdline-upd

Updates #6006.

Squashed commit of the following:

commit f974a08856b894fd586cfbba703d98dbcf8c6a97
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jul 18 20:51:58 2023 +0300

    home: fix cmdline update
This commit is contained in:
Ainar Garipov 2023-07-18 21:20:43 +03:00
parent 33ce24abe4
commit b0185201c6
1 changed files with 8 additions and 2 deletions

View File

@ -240,14 +240,20 @@ func newServerConfig(
DNS64Prefixes: config.DNS.DNS64Prefixes,
}
const initialClientsNum = 100
var initialAddresses []netip.Addr
// Context.stats may be nil here if initDNSServer is called from
// [cmdlineUpdate].
if sts := Context.stats; sts != nil {
const initialClientsNum = 100
initialAddresses = Context.stats.TopClientsIP(initialClientsNum)
}
// Do not set DialContext, PrivateSubnets, and UsePrivateRDNS, because they
// are set by [dnsforward.Server.Prepare].
newConf.AddrProcConf = &client.DefaultAddrProcConfig{
Exchanger: Context.dnsServer,
AddressUpdater: &Context.clients,
InitialAddresses: Context.stats.TopClientsIP(initialClientsNum),
InitialAddresses: initialAddresses,
UseRDNS: config.Clients.Sources.RDNS,
UseWHOIS: config.Clients.Sources.WHOIS,
}