diff --git a/dnsfilter/dnsfilter.go b/dnsfilter/dnsfilter.go index 60a32d39..82b56187 100644 --- a/dnsfilter/dnsfilter.go +++ b/dnsfilter/dnsfilter.go @@ -628,6 +628,11 @@ func makeResult(rule rules.Rule, reason Reason) Result { return res } +// InitModule() - manually initialize blocked services map +func InitModule() { + initBlockedServices() +} + // New creates properly initialized DNS Filter that is ready to be used func New(c *Config, blockFilters []Filter) *Dnsfilter { @@ -677,8 +682,6 @@ func New(c *Config, blockFilters []Filter) *Dnsfilter { } d.BlockedServices = bsvcs - initBlockedServices() - if blockFilters != nil { err := d.initFiltering(nil, blockFilters) if err != nil { diff --git a/home/home.go b/home/home.go index 2340ca6c..ebc25af4 100644 --- a/home/home.go +++ b/home/home.go @@ -208,6 +208,11 @@ func run(args options) { } } + // 'clients' module uses 'dnsfilter' module's static data (dnsfilter.BlockedSvcKnown()), + // so we have to initialize dnsfilter's static data first, + // but also avoid relying on automatic Go init() function + dnsfilter.InitModule() + config.DHCP.WorkDir = Context.workDir config.DHCP.HTTPRegister = httpRegister config.DHCP.ConfigModified = onConfigModified