dnsfilter -- Add parameter to New() to supply optional initial config.

This commit is contained in:
Eugene Bujak
2018-11-30 13:47:26 +03:00
parent 3ecc0ee24b
commit e26837d9e8
3 changed files with 7 additions and 4 deletions

View File

@@ -856,7 +856,7 @@ func (d *Dnsfilter) matchHost(host string) (Result, error) {
//
// New creates properly initialized DNS Filter that is ready to be used
func New() *Dnsfilter {
func New(c *Config) *Dnsfilter {
d := new(Dnsfilter)
d.storage = make(map[string]bool)
@@ -879,6 +879,9 @@ func New() *Dnsfilter {
}
d.safeBrowsingServer = defaultSafebrowsingServer
d.parentalServer = defaultParentalServer
if c != nil {
d.Config = *c
}
return d
}