mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-15 19:31:45 +03:00
* blocked-services: remove unknown service names
This commit is contained in:
parent
01d9078107
commit
5dc7b848df
@ -135,6 +135,12 @@ func initServices() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return TRUE if a blocked service name is known
|
||||||
|
func blockedSvcKnown(s string) bool {
|
||||||
|
_, ok := serviceRules[s]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
// ApplyBlockedServices - set blocked services settings for this DNS request
|
// ApplyBlockedServices - set blocked services settings for this DNS request
|
||||||
func ApplyBlockedServices(setts *dnsfilter.RequestFilteringSettings, list []string) {
|
func ApplyBlockedServices(setts *dnsfilter.RequestFilteringSettings, list []string) {
|
||||||
setts.ServicesRules = []dnsfilter.ServiceEntry{}
|
setts.ServicesRules = []dnsfilter.ServiceEntry{}
|
||||||
|
@ -140,11 +140,18 @@ func (clients *clientsContainer) addFromConfig(objects []clientObject) {
|
|||||||
SafeBrowsingEnabled: cy.SafeBrowsingEnabled,
|
SafeBrowsingEnabled: cy.SafeBrowsingEnabled,
|
||||||
|
|
||||||
UseOwnBlockedServices: !cy.UseGlobalBlockedServices,
|
UseOwnBlockedServices: !cy.UseGlobalBlockedServices,
|
||||||
BlockedServices: cy.BlockedServices,
|
|
||||||
|
|
||||||
Upstreams: cy.Upstreams,
|
Upstreams: cy.Upstreams,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, s := range cy.BlockedServices {
|
||||||
|
if !blockedSvcKnown(s) {
|
||||||
|
log.Debug("Clients: skipping unknown blocked-service '%s'", s)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
cli.BlockedServices = append(cli.BlockedServices, s)
|
||||||
|
}
|
||||||
|
|
||||||
for _, t := range cy.Tags {
|
for _, t := range cy.Tags {
|
||||||
if !clients.tagKnown(t) {
|
if !clients.tagKnown(t) {
|
||||||
log.Debug("Clients: skipping unknown tag '%s'", t)
|
log.Debug("Clients: skipping unknown tag '%s'", t)
|
||||||
|
@ -233,6 +233,16 @@ func parseConfig() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bsvcs := []string{}
|
||||||
|
for _, s := range config.DNS.BlockedServices {
|
||||||
|
if !blockedSvcKnown(s) {
|
||||||
|
log.Debug("skipping unknown blocked-service '%s'", s)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
bsvcs = append(bsvcs, s)
|
||||||
|
}
|
||||||
|
config.DNS.BlockedServices = bsvcs
|
||||||
|
|
||||||
if !checkFiltersUpdateIntervalHours(config.DNS.FiltersUpdateIntervalHours) {
|
if !checkFiltersUpdateIntervalHours(config.DNS.FiltersUpdateIntervalHours) {
|
||||||
config.DNS.FiltersUpdateIntervalHours = 24
|
config.DNS.FiltersUpdateIntervalHours = 24
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user