docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep keep keep replace replace replace keep keep replace replace replace replace keep keep keep keep
<mask> return emptyClient, nil <mask> } <mask> <mask> // clientInfo is a wrapper around Find to make it a valid client finder for <mask> // the query log. <mask> func (clients *clientsContainer) clientInfo( <mask> ip net.IP, <mask> id string, <mask> disallowed bool, <mask> rule string, <mask> ) (c *querylog.Client) { <mask> whois := &querylog.ClientWHOIS{} <mask> client, ok := clients.Find(id) <mask> if ok { <mask> return &querylog.Client{ <mask> Name: client.Name, </s> Pull request: querylog: fix panic Merge in DNS/adguard-home from querylog-panic to master Squashed commit of the following: commit b7f2edd1d7dd91c0102b9cb4ea50c34d8d9ceb58 Merge: 1b355a2d fac574d3 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 20:06:07 2021 +0300 Merge branch 'master' into querylog-panic commit 1b355a2df6bd96431a70111607470b873b742562 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 19:41:58 2021 +0300 querylog: fix panic </s> remove return emptyClient, nil </s> add return artClient, nil </s> remove Name: client.Name, DisallowedRule: rule, WHOIS: whois, Disallowed: disallowed, } </s> add Name: client.Name, }, false </s> remove // findMultiple returns info about client. If no information about the client // is found, it sends the client by default only with the "Disallowed" field // filled in. err is always nil. </s> add // findMultiple is a wrapper around Find to make it a valid client finder for // the query log. c is never nil; if no information about the client is found, // it returns an artificial client record by only setting the blocking-related // fields. err is always nil. </s> remove var emptyClient *querylog.Client </s> add var artClient *querylog.Client var art bool </s> remove ip := net.ParseIP(id) disallowed, disallowedRule := clients.dnsServer.IsBlockedClient(ip, id) client := clients.clientInfo(ip, id, disallowed, disallowedRule) if client.Name == "" && client.DisallowedRule == "" { emptyClient = client </s> add c, art = clients.clientOrArtificial(net.ParseIP(id), id) if art { artClient = c
https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164
internal/home/clients.go
keep keep keep replace replace replace replace replace keep keep keep replace keep
<mask> client, ok := clients.Find(id) <mask> if ok { <mask> return &querylog.Client{ <mask> Name: client.Name, <mask> DisallowedRule: rule, <mask> WHOIS: whois, <mask> Disallowed: disallowed, <mask> } <mask> } <mask> <mask> if ip == nil { <mask> return nil <mask> } </s> Pull request: querylog: fix panic Merge in DNS/adguard-home from querylog-panic to master Squashed commit of the following: commit b7f2edd1d7dd91c0102b9cb4ea50c34d8d9ceb58 Merge: 1b355a2d fac574d3 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 20:06:07 2021 +0300 Merge branch 'master' into querylog-panic commit 1b355a2df6bd96431a70111607470b873b742562 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 19:41:58 2021 +0300 querylog: fix panic </s> remove Name: rc.Host, DisallowedRule: rule, WHOIS: toQueryLogWHOIS(rc.WHOISInfo), Disallowed: disallowed, } </s> add Name: rc.Host, WHOIS: toQueryLogWHOIS(rc.WHOISInfo), }, false </s> remove disallowed bool, rule string, ) (c *querylog.Client) { whois := &querylog.ClientWHOIS{} </s> add ) (c *querylog.Client, art bool) { defer func() { c.Disallowed, c.DisallowedRule = clients.dnsServer.IsBlockedClient(ip, id) if c.WHOIS == nil { c.WHOIS = &querylog.ClientWHOIS{} } }() </s> remove Name: "", DisallowedRule: rule, WHOIS: &querylog.ClientWHOIS{}, Disallowed: disallowed, } </s> add Name: "", }, true </s> remove ip := net.ParseIP(id) disallowed, disallowedRule := clients.dnsServer.IsBlockedClient(ip, id) client := clients.clientInfo(ip, id, disallowed, disallowedRule) if client.Name == "" && client.DisallowedRule == "" { emptyClient = client </s> add c, art = clients.clientOrArtificial(net.ParseIP(id), id) if art { artClient = c </s> remove return client, nil </s> add return c, nil
https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164
internal/home/clients.go
keep keep keep keep replace replace replace replace replace keep keep keep replace replace replace replace replace
<mask> var rc *RuntimeClient <mask> rc, ok = clients.FindRuntimeClient(ip) <mask> if ok { <mask> return &querylog.Client{ <mask> Name: rc.Host, <mask> DisallowedRule: rule, <mask> WHOIS: toQueryLogWHOIS(rc.WHOISInfo), <mask> Disallowed: disallowed, <mask> } <mask> } <mask> <mask> return &querylog.Client{ <mask> Name: "", <mask> DisallowedRule: rule, <mask> WHOIS: &querylog.ClientWHOIS{}, <mask> Disallowed: disallowed, <mask> } </s> Pull request: querylog: fix panic Merge in DNS/adguard-home from querylog-panic to master Squashed commit of the following: commit b7f2edd1d7dd91c0102b9cb4ea50c34d8d9ceb58 Merge: 1b355a2d fac574d3 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 20:06:07 2021 +0300 Merge branch 'master' into querylog-panic commit 1b355a2df6bd96431a70111607470b873b742562 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 19:41:58 2021 +0300 querylog: fix panic </s> remove Name: client.Name, DisallowedRule: rule, WHOIS: whois, Disallowed: disallowed, } </s> add Name: client.Name, }, false </s> remove return nil </s> add // Technically should never happen, but still. return &querylog.Client{ Name: "", }, true </s> remove disallowed bool, rule string, ) (c *querylog.Client) { whois := &querylog.ClientWHOIS{} </s> add ) (c *querylog.Client, art bool) { defer func() { c.Disallowed, c.DisallowedRule = clients.dnsServer.IsBlockedClient(ip, id) if c.WHOIS == nil { c.WHOIS = &querylog.ClientWHOIS{} } }() </s> remove ip := net.ParseIP(id) disallowed, disallowedRule := clients.dnsServer.IsBlockedClient(ip, id) client := clients.clientInfo(ip, id, disallowed, disallowedRule) if client.Name == "" && client.DisallowedRule == "" { emptyClient = client </s> add c, art = clients.clientOrArtificial(net.ParseIP(id), id) if art { artClient = c </s> remove return client, nil </s> add return c, nil
https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164
internal/home/clients.go
keep keep keep keep replace keep keep keep keep keep
<mask> 'description': > <mask> The rule due to which the client is allowed or blocked. <mask> 'name': <mask> 'description': > <mask> Persistent client's name or runtime client's hostname. <mask> 'type': 'string' <mask> 'whois': <mask> '$ref': '#/components/schemas/QueryLogItemClientWhois' <mask> 'required': <mask> - 'disallowed' </s> Pull request: querylog: fix panic Merge in DNS/adguard-home from querylog-panic to master Squashed commit of the following: commit b7f2edd1d7dd91c0102b9cb4ea50c34d8d9ceb58 Merge: 1b355a2d fac574d3 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 20:06:07 2021 +0300 Merge branch 'master' into querylog-panic commit 1b355a2df6bd96431a70111607470b873b742562 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 19:41:58 2021 +0300 querylog: fix panic </s> remove - 'ids' </s> add </s> remove // clientInfo is a wrapper around Find to make it a valid client finder for // the query log. func (clients *clientsContainer) clientInfo( </s> add // clientOrArtificial returns information about one client. If art is true, // this is an artificial client record, meaning that we currently don't have any // records about this client besides maybe whether or not it is blocked. c is // never nil. func (clients *clientsContainer) clientOrArtificial( </s> remove // findMultiple returns info about client. If no information about the client // is found, it sends the client by default only with the "Disallowed" field // filled in. err is always nil. </s> add // findMultiple is a wrapper around Find to make it a valid client finder for // the query log. c is never nil; if no information about the client is found, // it returns an artificial client record by only setting the blocking-related // fields. err is always nil. </s> remove return emptyClient, nil </s> add return artClient, nil </s> remove var emptyClient *querylog.Client </s> add var artClient *querylog.Client var art bool </s> remove disallowed bool, rule string, ) (c *querylog.Client) { whois := &querylog.ClientWHOIS{} </s> add ) (c *querylog.Client, art bool) { defer func() { c.Disallowed, c.DisallowedRule = clients.dnsServer.IsBlockedClient(ip, id) if c.WHOIS == nil { c.WHOIS = &querylog.ClientWHOIS{} } }()
https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164
openapi/openapi.yaml
keep keep keep keep replace keep keep keep keep keep
<mask> '$ref': '#/components/schemas/QueryLogItemClientWhois' <mask> 'required': <mask> - 'disallowed' <mask> - 'disallowed_rule' <mask> - 'ids' <mask> - 'name' <mask> - 'whois' <mask> 'type': 'object' <mask> 'QueryLogItemClientWhois': <mask> 'description': > </s> Pull request: querylog: fix panic Merge in DNS/adguard-home from querylog-panic to master Squashed commit of the following: commit b7f2edd1d7dd91c0102b9cb4ea50c34d8d9ceb58 Merge: 1b355a2d fac574d3 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 20:06:07 2021 +0300 Merge branch 'master' into querylog-panic commit 1b355a2df6bd96431a70111607470b873b742562 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Sep 13 19:41:58 2021 +0300 querylog: fix panic </s> remove Persistent client's name or runtime client's hostname. </s> add Persistent client's name or runtime client's hostname. May be empty. </s> remove Name: "", DisallowedRule: rule, WHOIS: &querylog.ClientWHOIS{}, Disallowed: disallowed, } </s> add Name: "", }, true </s> remove Name: rc.Host, DisallowedRule: rule, WHOIS: toQueryLogWHOIS(rc.WHOISInfo), Disallowed: disallowed, } </s> add Name: rc.Host, WHOIS: toQueryLogWHOIS(rc.WHOISInfo), }, false </s> remove return nil </s> add // Technically should never happen, but still. return &querylog.Client{ Name: "", }, true </s> remove Name: client.Name, DisallowedRule: rule, WHOIS: whois, Disallowed: disallowed, } </s> add Name: client.Name, }, false </s> remove disallowed bool, rule string, ) (c *querylog.Client) { whois := &querylog.ClientWHOIS{} </s> add ) (c *querylog.Client, art bool) { defer func() { c.Disallowed, c.DisallowedRule = clients.dnsServer.IsBlockedClient(ip, id) if c.WHOIS == nil { c.WHOIS = &querylog.ClientWHOIS{} } }()
https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164
openapi/openapi.yaml
keep keep keep add keep keep keep keep
<mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/urlfilter" <mask> "github.com/bluele/gcache" <mask> "golang.org/x/net/publicsuffix" <mask> ) <mask> <mask> const defaultCacheSize = 64 * 1024 // in number of elements </s> * dnsfilter: return the correct IP address (host rules) </s> remove func (d *Dnsfilter) CheckHost(host string) (Result, error) { </s> add func (d *Dnsfilter) CheckHost(host string, qtype uint16) (Result, error) { </s> remove result, err := d.matchHost(host) </s> add result, err := d.matchHost(host, qtype) </s> remove func (d *Dnsfilter) matchHost(host string) (Result, error) { </s> add func (d *Dnsfilter) matchHost(host string, qtype uint16) (Result, error) { </s> remove res.IP = hostRule.IP return res, nil </s> add if qtype == dns.TypeA && hostRule.IP.To4() != nil { // either IPv4 or IPv4-mapped IPv6 address res.IP = hostRule.IP.To4() return res, nil } else if qtype == dns.TypeAAAA && hostRule.IP.To4() == nil { res.IP = hostRule.IP return res, nil } continue </s> add log.Tracef("%d rules matched for host '%s'", len(rules), host)
https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf
dnsfilter/dnsfilter.go
keep keep keep keep replace keep keep keep keep keep
<mask> return r != NotFilteredNotFound <mask> } <mask> <mask> // CheckHost tries to match host against rules, then safebrowsing and parental if they are enabled <mask> func (d *Dnsfilter) CheckHost(host string) (Result, error) { <mask> // sometimes DNS clients will try to resolve ".", which is a request to get root servers <mask> if host == "" { <mask> return Result{Reason: NotFilteredNotFound}, nil <mask> } <mask> host = strings.ToLower(host) </s> * dnsfilter: return the correct IP address (host rules) </s> remove func (d *Dnsfilter) matchHost(host string) (Result, error) { </s> add func (d *Dnsfilter) matchHost(host string, qtype uint16) (Result, error) { </s> remove result, err := d.matchHost(host) </s> add result, err := d.matchHost(host, qtype) </s> add log.Tracef("%d rules matched for host '%s'", len(rules), host) </s> remove res.IP = hostRule.IP return res, nil </s> add if qtype == dns.TypeA && hostRule.IP.To4() != nil { // either IPv4 or IPv4-mapped IPv6 address res.IP = hostRule.IP.To4() return res, nil } else if qtype == dns.TypeAAAA && hostRule.IP.To4() == nil { res.IP = hostRule.IP return res, nil } continue </s> add "github.com/miekg/dns"
https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf
dnsfilter/dnsfilter.go
keep keep keep keep replace keep keep keep keep keep
<mask> return Result{}, nil <mask> } <mask> <mask> // try filter lists first <mask> result, err := d.matchHost(host) <mask> if err != nil { <mask> return result, err <mask> } <mask> if result.Reason.Matched() { <mask> return result, nil </s> * dnsfilter: return the correct IP address (host rules) </s> remove res.IP = hostRule.IP return res, nil </s> add if qtype == dns.TypeA && hostRule.IP.To4() != nil { // either IPv4 or IPv4-mapped IPv6 address res.IP = hostRule.IP.To4() return res, nil } else if qtype == dns.TypeAAAA && hostRule.IP.To4() == nil { res.IP = hostRule.IP return res, nil } continue </s> remove func (d *Dnsfilter) matchHost(host string) (Result, error) { </s> add func (d *Dnsfilter) matchHost(host string, qtype uint16) (Result, error) { </s> remove func (d *Dnsfilter) CheckHost(host string) (Result, error) { </s> add func (d *Dnsfilter) CheckHost(host string, qtype uint16) (Result, error) { </s> add log.Tracef("%d rules matched for host '%s'", len(rules), host) </s> add "github.com/miekg/dns"
https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf
dnsfilter/dnsfilter.go
keep keep keep keep replace keep keep keep keep keep
<mask> return nil <mask> } <mask> <mask> // matchHost is a low-level way to check only if hostname is filtered by rules, skipping expensive safebrowsing and parental lookups <mask> func (d *Dnsfilter) matchHost(host string) (Result, error) { <mask> if d.filteringEngine == nil { <mask> return Result{}, nil <mask> } <mask> <mask> rules, ok := d.filteringEngine.Match(host) </s> * dnsfilter: return the correct IP address (host rules) </s> remove func (d *Dnsfilter) CheckHost(host string) (Result, error) { </s> add func (d *Dnsfilter) CheckHost(host string, qtype uint16) (Result, error) { </s> remove res.IP = hostRule.IP return res, nil </s> add if qtype == dns.TypeA && hostRule.IP.To4() != nil { // either IPv4 or IPv4-mapped IPv6 address res.IP = hostRule.IP.To4() return res, nil } else if qtype == dns.TypeAAAA && hostRule.IP.To4() == nil { res.IP = hostRule.IP return res, nil } continue </s> remove result, err := d.matchHost(host) </s> add result, err := d.matchHost(host, qtype) </s> add log.Tracef("%d rules matched for host '%s'", len(rules), host) </s> add "github.com/miekg/dns"
https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf
dnsfilter/dnsfilter.go
keep keep add keep keep keep keep keep
<mask> return Result{}, nil <mask> } <mask> <mask> for _, rule := range rules { <mask> <mask> log.Tracef("Found rule for host '%s': '%s' list_id: %d", <mask> host, rule.Text(), rule.GetFilterListID()) <mask> </s> * dnsfilter: return the correct IP address (host rules) </s> remove res.IP = hostRule.IP return res, nil </s> add if qtype == dns.TypeA && hostRule.IP.To4() != nil { // either IPv4 or IPv4-mapped IPv6 address res.IP = hostRule.IP.To4() return res, nil } else if qtype == dns.TypeAAAA && hostRule.IP.To4() == nil { res.IP = hostRule.IP return res, nil } continue </s> remove result, err := d.matchHost(host) </s> add result, err := d.matchHost(host, qtype) </s> remove func (d *Dnsfilter) CheckHost(host string) (Result, error) { </s> add func (d *Dnsfilter) CheckHost(host string, qtype uint16) (Result, error) { </s> remove func (d *Dnsfilter) matchHost(host string) (Result, error) { </s> add func (d *Dnsfilter) matchHost(host string, qtype uint16) (Result, error) { </s> add "github.com/miekg/dns"
https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf
dnsfilter/dnsfilter.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> return res, nil <mask> <mask> } else if hostRule, ok := rule.(*urlfilter.HostRule); ok { <mask> <mask> res.IP = hostRule.IP <mask> return res, nil <mask> <mask> } else { <mask> log.Tracef("Rule type is unsupported: '%s' list_id: %d", <mask> rule.Text(), rule.GetFilterListID()) <mask> } </s> * dnsfilter: return the correct IP address (host rules) </s> add log.Tracef("%d rules matched for host '%s'", len(rules), host) </s> remove func (d *Dnsfilter) matchHost(host string) (Result, error) { </s> add func (d *Dnsfilter) matchHost(host string, qtype uint16) (Result, error) { </s> remove result, err := d.matchHost(host) </s> add result, err := d.matchHost(host, qtype) </s> remove func (d *Dnsfilter) CheckHost(host string) (Result, error) { </s> add func (d *Dnsfilter) CheckHost(host string, qtype uint16) (Result, error) { </s> add "github.com/miekg/dns"
https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf
dnsfilter/dnsfilter.go
keep add keep keep keep keep
<mask> engine *urlfilter.DNSEngine <mask> <mask> // updates is the channel for receiving updated hosts. <mask> updates chan *netutil.IPMap <mask> // last is the set of hosts that was cached within last detected change. <mask> last *netutil.IPMap </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContainerPref) </s> add close(hc.done) return nil </s> remove updater *updater.Updater </s> add // hostsWatcher is the watcher to detect changes in the hosts files. hostsWatcher aghos.FSWatcher updater *updater.Updater </s> remove // errNoPaths is returned when there are no paths to watch passed to the // HostsContainer. const errNoPaths errors.Error = "hosts paths are empty" </s> add // ErrNoHostsPaths is returned when there are no valid paths to watch passed to // the HostsContainer. const ErrNoHostsPaths errors.Error = "no valid paths to hosts files provided" </s> add // Currently Context.hostsWatcher is only used in Context.etcHosts and // needs closing only in case of the successful initialization of // Context.etcHosts. if err = Context.hostsWatcher.Close(); err != nil { log.Error("closing hosts watcher: %s", err) } </s> add // // TODO(e.burkov): Accept a parameter to specify the files to refresh. </s> remove // Close implements the io.Closer interface for *HostsContainer. </s> add // Close implements the io.Closer interface for *HostsContainer. Close must // only be called once. The returned err is always nil.
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep keep replace replace replace keep keep replace keep keep keep keep
<mask> // patterns stores specified paths in the fs.Glob-compatible form. <mask> patterns []string <mask> } <mask> <mask> // errNoPaths is returned when there are no paths to watch passed to the <mask> // HostsContainer. <mask> const errNoPaths errors.Error = "hosts paths are empty" <mask> <mask> // NewHostsContainer creates a container of hosts, that watches the paths with <mask> // w. paths shouldn't be empty and each of them should locate either a file or <mask> // a directory in fsys. fsys and w must be non-nil. <mask> func NewHostsContainer( <mask> fsys fs.FS, <mask> w aghos.FSWatcher, </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContainerPref) </s> add close(hc.done) return nil </s> remove if fi, err = fs.Stat(fsys, p); err != nil { return nil, fmt.Errorf("%q at index %d: %w", p, i, err) </s> add fi, err = fs.Stat(fsys, p) if err != nil { if errors.Is(err, fs.ErrNotExist) { continue } // Don't put a filename here since it's already added by fs.Stat. return nil, fmt.Errorf("path at index %d: %w", i, err) </s> add // // TODO(e.burkov): Accept a parameter to specify the files to refresh. </s> remove const closeCalled errors.Error = "close method called" // fsWatcherOnCloseStub is a stub implementation of the Close method of // aghos.FSWatcher. func fsWatcherOnCloseStub() (err error) { return closeCalled } </s> add </s> add // Currently Context.hostsWatcher is only used in Context.etcHosts and // needs closing only in case of the successful initialization of // Context.etcHosts. if err = Context.hostsWatcher.Close(); err != nil { log.Error("closing hosts watcher: %s", err) }
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep replace keep keep replace
<mask> defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }() <mask> <mask> if len(paths) == 0 { <mask> return nil, errNoPaths <mask> } <mask> <mask> patterns, err := pathsToPatterns(fsys, paths) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> add } else if len(patterns) == 0 { return nil, ErrNoHostsPaths </s> add // // TODO(e.burkov): Make it accept non-existing files to detect it's creating. </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) } </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on. </s> remove // Close implements the io.Closer interface for *HostsContainer. </s> add // Close implements the io.Closer interface for *HostsContainer. Close must // only be called once. The returned err is always nil.
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep add keep keep keep keep keep
<mask> var patterns []string <mask> patterns, err = pathsToPatterns(fsys, paths) <mask> if err != nil { <mask> return nil, err <mask> } <mask> <mask> hc = &HostsContainer{ <mask> engLock: &sync.RWMutex{}, <mask> done: make(chan struct{}, 1), </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> add done: make(chan struct{}, 1), </s> remove patterns, err := pathsToPatterns(fsys, paths) </s> add var patterns []string patterns, err = pathsToPatterns(fsys, paths) </s> remove return nil, errNoPaths </s> add return nil, ErrNoHostsPaths </s> remove if fi, err = fs.Stat(fsys, p); err != nil { return nil, fmt.Errorf("%q at index %d: %w", p, i, err) </s> add fi, err = fs.Stat(fsys, p) if err != nil { if errors.Is(err, fs.ErrNotExist) { continue } // Don't put a filename here since it's already added by fs.Stat. return nil, fmt.Errorf("path at index %d: %w", i, err) </s> remove var osWritesWatcher aghos.FSWatcher osWritesWatcher, err = aghos.NewOSWritesWatcher() if err != nil { return fmt.Errorf("initing os watcher: %w", err) } Context.etcHosts, err = aghnet.NewHostsContainer( aghos.RootDirFS(), osWritesWatcher, aghnet.DefaultHostsPaths()..., ) if err != nil { return fmt.Errorf("initing hosts container: %w", err) </s> add if err = setupHostsContainer(); err != nil { return err </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) }
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep add keep keep keep keep keep keep
<mask> } <mask> <mask> hc = &HostsContainer{ <mask> engLock: &sync.RWMutex{}, <mask> updates: make(chan *netutil.IPMap, 1), <mask> last: &netutil.IPMap{}, <mask> fsys: fsys, <mask> w: w, <mask> patterns: patterns, <mask> } </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> add } else if len(patterns) == 0 { return nil, ErrNoHostsPaths </s> remove patterns, err := pathsToPatterns(fsys, paths) </s> add var patterns []string patterns, err = pathsToPatterns(fsys, paths) </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove return nil, errNoPaths </s> add return nil, ErrNoHostsPaths </s> remove log.Error("stopping hosts container: %s", err) </s> add log.Error("closing hosts container: %s", err)
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
<mask> return nil, err <mask> } <mask> <mask> for _, p := range paths { <mask> err = w.Add(p) <mask> if err == nil { <mask> continue <mask> } else if errors.Is(err, fs.ErrNotExist) { <mask> log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) <mask> <mask> continue <mask> } <mask> <mask> return nil, fmt.Errorf("adding path: %w", err) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove continue </s> add log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> remove return nil, fmt.Errorf("adding path: %w", err) </s> add </s> remove if fi, err = fs.Stat(fsys, p); err != nil { return nil, fmt.Errorf("%q at index %d: %w", p, i, err) </s> add fi, err = fs.Stat(fsys, p) if err != nil { if errors.Is(err, fs.ErrNotExist) { continue } // Don't put a filename here since it's already added by fs.Stat. return nil, fmt.Errorf("path at index %d: %w", i, err) </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on. </s> add } else if len(patterns) == 0 { return nil, ErrNoHostsPaths </s> remove return nil, errNoPaths </s> add return nil, ErrNoHostsPaths
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep replace keep replace replace keep keep keep keep
<mask> log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) <mask> <mask> continue <mask> } <mask> <mask> return nil, fmt.Errorf("adding path: %w", err) <mask> } <mask> <mask> go hc.handleEvents() <mask> </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) } </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on. </s> remove if fi, err = fs.Stat(fsys, p); err != nil { return nil, fmt.Errorf("%q at index %d: %w", p, i, err) </s> add fi, err = fs.Stat(fsys, p) if err != nil { if errors.Is(err, fs.ErrNotExist) { continue } // Don't put a filename here since it's already added by fs.Stat. return nil, fmt.Errorf("path at index %d: %w", i, err) </s> add // // TODO(e.burkov): Make it accept non-existing files to detect it's creating. </s> remove // Close implements the io.Closer interface for *HostsContainer. </s> add // Close implements the io.Closer interface for *HostsContainer. Close must // only be called once. The returned err is always nil.
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <mask> hc.engLock.RLock() <mask> defer hc.engLock.RUnlock() <mask> <mask> res, ok = hc.engine.MatchRequest(req) <mask> <mask> return res, ok <mask> } <mask> <mask> // Close implements the io.Closer interface for *HostsContainer. <mask> func (hc *HostsContainer) Close() (err error) { <mask> log.Debug("%s: closing", hostsContainerPref) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove // Close implements the io.Closer interface for *HostsContainer. </s> add // Close implements the io.Closer interface for *HostsContainer. Close must // only be called once. The returned err is always nil. </s> remove return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContainerPref) </s> add close(hc.done) return nil </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on. </s> add // // TODO(e.burkov): Make it accept non-existing files to detect it's creating. </s> add // // TODO(e.burkov): Accept a parameter to specify the files to refresh. </s> remove return nil, errNoPaths </s> add return nil, ErrNoHostsPaths
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep replace keep keep keep replace keep keep keep
<mask> return res, ok <mask> } <mask> <mask> // Close implements the io.Closer interface for *HostsContainer. <mask> func (hc *HostsContainer) Close() (err error) { <mask> log.Debug("%s: closing", hostsContainerPref) <mask> <mask> return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContainerPref) <mask> } <mask> <mask> // Upd returns the channel into which the updates are sent. The receivable </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove res, ok = hc.engine.MatchRequest(req) return res, ok </s> add return hc.engine.MatchRequest(req) </s> add // // TODO(e.burkov): Accept a parameter to specify the files to refresh. </s> add // // TODO(e.burkov): Make it accept non-existing files to detect it's creating. </s> add // done is the channel to sign closing the container. done chan struct{} </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on.
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> // pathsToPatterns converts paths into patterns compatible with fs.Glob. <mask> func pathsToPatterns(fsys fs.FS, paths []string) (patterns []string, err error) { <mask> for i, p := range paths { <mask> var fi fs.FileInfo <mask> if fi, err = fs.Stat(fsys, p); err != nil { <mask> return nil, fmt.Errorf("%q at index %d: %w", p, i, err) <mask> } <mask> <mask> if fi.IsDir() { <mask> p = path.Join(p, "*") <mask> } </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) } </s> remove patterns, err := pathsToPatterns(fsys, paths) </s> add var patterns []string patterns, err = pathsToPatterns(fsys, paths) </s> add } else if len(patterns) == 0 { return nil, ErrNoHostsPaths </s> remove var osWritesWatcher aghos.FSWatcher osWritesWatcher, err = aghos.NewOSWritesWatcher() if err != nil { return fmt.Errorf("initing os watcher: %w", err) } Context.etcHosts, err = aghnet.NewHostsContainer( aghos.RootDirFS(), osWritesWatcher, aghnet.DefaultHostsPaths()..., ) if err != nil { return fmt.Errorf("initing hosts container: %w", err) </s> add if err = setupHostsContainer(); err != nil { return err </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on. </s> remove // errNoPaths is returned when there are no paths to watch passed to the // HostsContainer. const errNoPaths errors.Error = "hosts paths are empty" </s> add // ErrNoHostsPaths is returned when there are no valid paths to watch passed to // the HostsContainer. const ErrNoHostsPaths errors.Error = "no valid paths to hosts files provided"
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref)) <mask> <mask> defer close(hc.updates) <mask> <mask> for range hc.w.Events() { <mask> if err := hc.refresh(); err != nil { <mask> log.Error("%s: %s", hostsContainerPref, err) <mask> } <mask> } <mask> } <mask> <mask> // hostsParser is a helper type to parse rules from the operating system's hosts </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> add // Currently Context.hostsWatcher is only used in Context.etcHosts and // needs closing only in case of the successful initialization of // Context.etcHosts. if err = Context.hostsWatcher.Close(); err != nil { log.Error("closing hosts watcher: %s", err) } </s> remove log.Error("stopping hosts container: %s", err) </s> add log.Error("closing hosts container: %s", err) </s> add // // TODO(e.burkov): Make it accept non-existing files to detect it's creating. </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) } </s> remove return nil, errNoPaths </s> add return nil, ErrNoHostsPaths </s> add // // TODO(e.burkov): Accept a parameter to specify the files to refresh.
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep add keep keep keep keep keep keep
<mask> // refresh gets the data from specified files and propagates the updates if <mask> // needed. <mask> func (hc *HostsContainer) refresh() (err error) { <mask> log.Debug("%s: refreshing", hostsContainerPref) <mask> <mask> hp := hc.newHostsParser() <mask> if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil { <mask> return fmt.Errorf("refreshing : %w", err) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContainerPref) </s> add close(hc.done) return nil </s> remove // Close implements the io.Closer interface for *HostsContainer. </s> add // Close implements the io.Closer interface for *HostsContainer. Close must // only be called once. The returned err is always nil. </s> remove res, ok = hc.engine.MatchRequest(req) return res, ok </s> add return hc.engine.MatchRequest(req) </s> add // // TODO(e.burkov): Make it accept non-existing files to detect it's creating. </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on. </s> add // Currently Context.hostsWatcher is only used in Context.etcHosts and // needs closing only in case of the successful initialization of // Context.etcHosts. if err = Context.hostsWatcher.Close(); err != nil { log.Error("closing hosts watcher: %s", err) }
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer.go
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> nl = "\n" <mask> sp = " " <mask> ) <mask> <mask> const closeCalled errors.Error = "close method called" <mask> <mask> // fsWatcherOnCloseStub is a stub implementation of the Close method of <mask> // aghos.FSWatcher. <mask> func fsWatcherOnCloseStub() (err error) { <mask> return closeCalled <mask> } <mask> <mask> func TestNewHostsContainer(t *testing.T) { <mask> const dirname = "dir" <mask> const filename = "file1" <mask> <mask> p := path.Join(dirname, filename) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove const closeCalled errors.Error = "close method called" </s> add </s> remove // errNoPaths is returned when there are no paths to watch passed to the // HostsContainer. const errNoPaths errors.Error = "hosts paths are empty" </s> add // ErrNoHostsPaths is returned when there are no valid paths to watch passed to // the HostsContainer. const ErrNoHostsPaths errors.Error = "no valid paths to hosts files provided" </s> remove // w. paths shouldn't be empty and each of them should locate either a file or </s> add // w. paths shouldn't be empty and each of paths should locate either a file or </s> add t.Run("bad_file", func(t *testing.T) { const errStat errors.Error = "bad file" badFS := &aghtest.StatFS{ OnStat: func(name string) (fs.FileInfo, error) { return nil, errStat }, } _, err := pathsToPatterns(badFS, []string{""}) assert.ErrorIs(t, err, errStat) }) </s> remove return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContainerPref) </s> add close(hc.done) return nil </s> remove // Close implements the io.Closer interface for *HostsContainer. </s> add // Close implements the io.Closer interface for *HostsContainer. Close must // only be called once. The returned err is always nil.
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep keep replace replace replace replace keep replace replace replace replace keep keep
<mask> <mask> testCases := []struct { <mask> name string <mask> paths []string <mask> wantErr error <mask> wantPatterns []string <mask> }{{ <mask> name: "one_file", <mask> paths: []string{p}, <mask> wantErr: nil, <mask> wantPatterns: []string{p}, <mask> }, { <mask> name: "no_files", </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove name: "no_files", paths: []string{}, wantErr: errNoPaths, wantPatterns: nil, </s> add wantErr: ErrNoHostsPaths, name: "no_files", paths: []string{}, </s> remove name: "whole_dir", paths: []string{dirname}, wantErr: nil, wantPatterns: []string{path.Join(dirname, "*")}, </s> add wantErr: nil, name: "whole_dir", paths: []string{dirname}, </s> remove name: "non-existent_file", paths: []string{path.Join(dirname, filename+"2")}, wantErr: fs.ErrNotExist, wantPatterns: nil, </s> add wantErr: ErrNoHostsPaths, name: "non-existent_file", paths: []string{path.Join(dirname, filename+"2")}, </s> remove wantErr: fs.ErrNotExist, </s> add wantErr: nil, </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep keep keep replace replace replace replace keep replace replace replace replace keep
<mask> wantErr: nil, <mask> wantPatterns: []string{p}, <mask> }, { <mask> name: "no_files", <mask> paths: []string{}, <mask> wantErr: errNoPaths, <mask> wantPatterns: nil, <mask> }, { <mask> name: "non-existent_file", <mask> paths: []string{path.Join(dirname, filename+"2")}, <mask> wantErr: fs.ErrNotExist, <mask> wantPatterns: nil, <mask> }, { </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove name: "one_file", paths: []string{p}, wantErr: nil, wantPatterns: []string{p}, </s> add wantErr: nil, name: "one_file", paths: []string{p}, </s> remove name: "whole_dir", paths: []string{dirname}, wantErr: nil, wantPatterns: []string{path.Join(dirname, "*")}, </s> add wantErr: nil, name: "whole_dir", paths: []string{dirname}, </s> remove wantErr: fs.ErrNotExist, </s> add wantErr: nil, </s> remove name string paths []string wantErr error wantPatterns []string </s> add wantErr error name string paths []string </s> remove OnClose: func() (err error) { return closeCalled }, </s> add OnClose: func() (err error) { panic("not implemented") },
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> paths: []string{path.Join(dirname, filename+"2")}, <mask> wantErr: fs.ErrNotExist, <mask> wantPatterns: nil, <mask> }, { <mask> name: "whole_dir", <mask> paths: []string{dirname}, <mask> wantErr: nil, <mask> wantPatterns: []string{path.Join(dirname, "*")}, <mask> }} <mask> <mask> for _, tc := range testCases { <mask> t.Run(tc.name, func(t *testing.T) { <mask> onAdd := func(name string) (err error) { </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove name: "non-existent_file", paths: []string{path.Join(dirname, filename+"2")}, wantErr: fs.ErrNotExist, wantPatterns: nil, </s> add wantErr: ErrNoHostsPaths, name: "non-existent_file", paths: []string{path.Join(dirname, filename+"2")}, </s> remove name: "no_files", paths: []string{}, wantErr: errNoPaths, wantPatterns: nil, </s> add wantErr: ErrNoHostsPaths, name: "no_files", paths: []string{}, </s> remove wantErr: fs.ErrNotExist, </s> add wantErr: nil, </s> remove name: "one_file", paths: []string{p}, wantErr: nil, wantPatterns: []string{p}, </s> add wantErr: nil, name: "one_file", paths: []string{p}, </s> remove name string paths []string wantErr error wantPatterns []string </s> add wantErr error name string paths []string </s> add t.Run("bad_file", func(t *testing.T) { const errStat errors.Error = "bad file" badFS := &aghtest.StatFS{ OnStat: func(name string) (fs.FileInfo, error) { return nil, errStat }, } _, err := pathsToPatterns(badFS, []string{""}) assert.ErrorIs(t, err, errStat) })
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> hc, err := NewHostsContainer(testFS, &aghtest.FSWatcher{ <mask> OnEvents: onEvents, <mask> OnAdd: onAdd, <mask> OnClose: fsWatcherOnCloseStub, <mask> }, tc.paths...) <mask> if tc.wantErr != nil { <mask> require.ErrorIs(t, err, tc.wantErr) <mask> <mask> assert.Nil(t, hc) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove const closeCalled errors.Error = "close method called" </s> add </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove require.ErrorIs(t, hc.Close(), closeCalled) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep keep keep keep replace replace replace replace keep keep replace keep
<mask> return <mask> } <mask> <mask> require.NoError(t, err) <mask> t.Cleanup(func() { <mask> require.ErrorIs(t, hc.Close(), closeCalled) <mask> }) <mask> <mask> require.NotNil(t, hc) <mask> <mask> assert.Equal(t, tc.wantPatterns, hc.patterns) <mask> assert.NotNil(t, <-hc.Upd()) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove require.ErrorIs(t, hc.Close(), closeCalled) </s> add </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep replace keep keep keep keep replace
<mask> }, <mask> OnClose: fsWatcherOnCloseStub, <mask> } <mask> <mask> hc, err := NewHostsContainer(testFS, w, dirname) <mask> require.NoError(t, err) <mask> t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove require.ErrorIs(t, hc.Close(), closeCalled) </s> add </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") },
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep keep keep replace keep keep replace
<mask> <mask> return nil <mask> }, <mask> OnClose: fsWatcherOnCloseStub, <mask> }, filename) <mask> require.NoError(t, err) <mask> t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove require.ErrorIs(t, hc.Close(), closeCalled) </s> add </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove OnClose: func() (err error) { return closeCalled }, </s> add OnClose: func() (err error) { panic("not implemented") },
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> want: []string{fp1, path.Join(dir0, dir1, "*")}, <mask> paths: []string{fp1, path.Join(dir0, dir1)}, <mask> }, { <mask> name: "non-existing", <mask> wantErr: fs.ErrNotExist, <mask> want: nil, <mask> paths: []string{path.Join(dir0, "file_3")}, <mask> }} <mask> <mask> for _, tc := range testCases { </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove name: "whole_dir", paths: []string{dirname}, wantErr: nil, wantPatterns: []string{path.Join(dirname, "*")}, </s> add wantErr: nil, name: "whole_dir", paths: []string{dirname}, </s> remove name: "non-existent_file", paths: []string{path.Join(dirname, filename+"2")}, wantErr: fs.ErrNotExist, wantPatterns: nil, </s> add wantErr: ErrNoHostsPaths, name: "non-existent_file", paths: []string{path.Join(dirname, filename+"2")}, </s> remove name: "no_files", paths: []string{}, wantErr: errNoPaths, wantPatterns: nil, </s> add wantErr: ErrNoHostsPaths, name: "no_files", paths: []string{}, </s> remove name: "one_file", paths: []string{p}, wantErr: nil, wantPatterns: []string{p}, </s> add wantErr: nil, name: "one_file", paths: []string{p}, </s> remove name string paths []string wantErr error wantPatterns []string </s> add wantErr error name string paths []string </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) }
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep keep keep add keep keep keep keep keep
<mask> <mask> assert.Equal(t, tc.want, patterns) <mask> }) <mask> } <mask> } <mask> <mask> func TestUniqueRules_AddPair(t *testing.T) { <mask> knownIP := net.IP{1, 2, 3, 4} <mask> </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove const closeCalled errors.Error = "close method called" // fsWatcherOnCloseStub is a stub implementation of the Close method of // aghos.FSWatcher. func fsWatcherOnCloseStub() (err error) { return closeCalled } </s> add </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove assert.Equal(t, tc.wantPatterns, hc.patterns) </s> add </s> remove require.ErrorIs(t, hc.Close(), closeCalled) </s> add </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghnet/hostscontainer_test.go
keep keep add keep keep keep keep keep keep
<mask> } <mask> <mask> // Add implements the FSWatcher interface for *osWatcher. <mask> func (w *osWatcher) Add(name string) (err error) { <mask> defer func() { err = errors.Annotate(err, "%s: %w", osWatcherPref) }() <mask> <mask> if _, err = fs.Stat(RootDirFS(), name); err != nil { <mask> return fmt.Errorf("checking file %q: %w", name, err) <mask> } </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove return nil, errNoPaths </s> add return nil, ErrNoHostsPaths </s> remove // Close implements the io.Closer interface for *HostsContainer. </s> add // Close implements the io.Closer interface for *HostsContainer. Close must // only be called once. The returned err is always nil. </s> remove res, ok = hc.engine.MatchRequest(req) return res, ok </s> add return hc.engine.MatchRequest(req) </s> remove return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContainerPref) </s> add close(hc.done) return nil </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) } </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on.
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/aghos/fswatcher.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> ::1 localhost#comment <mask> `)}, <mask> } <mask> <mask> const closeCalled errors.Error = "close method called" <mask> <mask> var eventsCalledCounter uint32 <mask> hc, err := aghnet.NewHostsContainer(testFS, &aghtest.FSWatcher{ <mask> OnEvents: func() (e <-chan struct{}) { <mask> assert.Equal(t, uint32(1), atomic.AddUint32(&eventsCalledCounter, 1)) <mask> </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove const closeCalled errors.Error = "close method called" // fsWatcherOnCloseStub is a stub implementation of the Close method of // aghos.FSWatcher. func fsWatcherOnCloseStub() (err error) { return closeCalled } </s> add </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove OnClose: func() (err error) { return closeCalled }, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove require.ErrorIs(t, hc.Close(), closeCalled) </s> add </s> add t.Run("bad_file", func(t *testing.T) { const errStat errors.Error = "bad file" badFS := &aghtest.StatFS{ OnStat: func(name string) (fs.FileInfo, error) { return nil, errStat }, } _, err := pathsToPatterns(badFS, []string{""}) assert.ErrorIs(t, err, errStat) }) </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") },
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/dnsforward/dnsforward_test.go
keep keep keep keep replace keep keep keep keep replace replace keep
<mask> assert.Equal(t, hostsFilename, name) <mask> <mask> return nil <mask> }, <mask> OnClose: func() (err error) { return closeCalled }, <mask> }, hostsFilename) <mask> require.NoError(t, err) <mask> t.Cleanup(func() { <mask> assert.Equal(t, uint32(1), atomic.LoadUint32(&eventsCalledCounter)) <mask> <mask> require.ErrorIs(t, hc.Close(), closeCalled) <mask> }) </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") }, </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) }) </s> add </s> remove OnClose: fsWatcherOnCloseStub, </s> add OnClose: func() (err error) { panic("not implemented") },
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/dnsforward/dnsforward_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> tls *TLSMod // TLS module <mask> // etcHosts is an IP-hostname pairs set taken from system configuration <mask> // (e.g. /etc/hosts) files. <mask> etcHosts *aghnet.HostsContainer <mask> updater *updater.Updater <mask> <mask> subnetDetector *aghnet.SubnetDetector <mask> <mask> // mux is our custom http.ServeMux. <mask> mux *http.ServeMux </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> add // done is the channel to sign closing the container. done chan struct{} </s> remove // errNoPaths is returned when there are no paths to watch passed to the // HostsContainer. const errNoPaths errors.Error = "hosts paths are empty" </s> add // ErrNoHostsPaths is returned when there are no valid paths to watch passed to // the HostsContainer. const ErrNoHostsPaths errors.Error = "no valid paths to hosts files provided" </s> remove // Close implements the io.Closer interface for *HostsContainer. </s> add // Close implements the io.Closer interface for *HostsContainer. Close must // only be called once. The returned err is always nil. </s> add // Currently Context.hostsWatcher is only used in Context.etcHosts and // needs closing only in case of the successful initialization of // Context.etcHosts. if err = Context.hostsWatcher.Close(); err != nil { log.Error("closing hosts watcher: %s", err) } </s> add // // TODO(e.burkov): Accept a parameter to specify the files to refresh. </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on.
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/home/home.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> ConfName: config.getConfigFilename(), <mask> }) <mask> <mask> if !args.noEtcHosts { <mask> var osWritesWatcher aghos.FSWatcher <mask> osWritesWatcher, err = aghos.NewOSWritesWatcher() <mask> if err != nil { <mask> return fmt.Errorf("initing os watcher: %w", err) <mask> } <mask> <mask> Context.etcHosts, err = aghnet.NewHostsContainer( <mask> aghos.RootDirFS(), <mask> osWritesWatcher, <mask> aghnet.DefaultHostsPaths()..., <mask> ) <mask> if err != nil { <mask> return fmt.Errorf("initing hosts container: %w", err) <mask> } <mask> } <mask> Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts) <mask> config.Clients = nil <mask> </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove log.Error("stopping hosts container: %s", err) </s> add log.Error("closing hosts container: %s", err) </s> add // Currently Context.hostsWatcher is only used in Context.etcHosts and // needs closing only in case of the successful initialization of // Context.etcHosts. if err = Context.hostsWatcher.Close(); err != nil { log.Error("closing hosts watcher: %s", err) } </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) } </s> remove return nil, errNoPaths </s> add return nil, ErrNoHostsPaths </s> remove if fi, err = fs.Stat(fsys, p); err != nil { return nil, fmt.Errorf("%q at index %d: %w", p, i, err) </s> add fi, err = fs.Stat(fsys, p) if err != nil { if errors.Is(err, fs.ErrNotExist) { continue } // Don't put a filename here since it's already added by fs.Stat. return nil, fmt.Errorf("path at index %d: %w", i, err) </s> remove patterns, err := pathsToPatterns(fsys, paths) </s> add var patterns []string patterns, err = pathsToPatterns(fsys, paths)
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/home/home.go
keep add keep keep keep keep
<mask> <mask> if Context.etcHosts != nil { <mask> if err = Context.etcHosts.Close(); err != nil { <mask> log.Error("closing hosts container: %s", err) <mask> } <mask> } </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> remove log.Error("stopping hosts container: %s", err) </s> add log.Error("closing hosts container: %s", err) </s> remove var osWritesWatcher aghos.FSWatcher osWritesWatcher, err = aghos.NewOSWritesWatcher() if err != nil { return fmt.Errorf("initing os watcher: %w", err) } Context.etcHosts, err = aghnet.NewHostsContainer( aghos.RootDirFS(), osWritesWatcher, aghnet.DefaultHostsPaths()..., ) if err != nil { return fmt.Errorf("initing hosts container: %w", err) </s> add if err = setupHostsContainer(); err != nil { return err </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on. </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) } </s> remove patterns, err := pathsToPatterns(fsys, paths) </s> add var patterns []string patterns, err = pathsToPatterns(fsys, paths) </s> add } else if len(patterns) == 0 { return nil, ErrNoHostsPaths
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/home/home.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> if Context.etcHosts != nil { <mask> if err = Context.etcHosts.Close(); err != nil { <mask> log.Error("stopping hosts container: %s", err) <mask> } <mask> } <mask> <mask> if Context.tls != nil { <mask> Context.tls.Close() </s> Pull request: 3845 hosts fatality Merge in DNS/adguard-home from 3845-hosts-fatality to master Updates #3845. Squashed commit of the following: commit 1447efcc4066e0226feaebde01fcc632cb7b7432 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 17:14:35 2021 +0300 home: imp readability commit e934499072e983e1111b6c976eb93e1d6017981b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:35:10 2021 +0300 aghnet: imp more commit ed9995ee52bd9ec3fa130f3f56989619184a6669 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Nov 17 13:05:56 2021 +0300 all: imp docs, code commit 7b0718a1a4a58a4fd5f1ba24c33792b0610c334f Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Nov 16 20:32:24 2021 +0300 all: reduce hosts container fatality </s> add // Currently Context.hostsWatcher is only used in Context.etcHosts and // needs closing only in case of the successful initialization of // Context.etcHosts. if err = Context.hostsWatcher.Close(); err != nil { log.Error("closing hosts watcher: %s", err) } </s> remove var osWritesWatcher aghos.FSWatcher osWritesWatcher, err = aghos.NewOSWritesWatcher() if err != nil { return fmt.Errorf("initing os watcher: %w", err) } Context.etcHosts, err = aghnet.NewHostsContainer( aghos.RootDirFS(), osWritesWatcher, aghnet.DefaultHostsPaths()..., ) if err != nil { return fmt.Errorf("initing hosts container: %w", err) </s> add if err = setupHostsContainer(); err != nil { return err </s> remove for range hc.w.Events() { if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) </s> add ok, eventsCh := true, hc.w.Events() for ok { select { case _, ok = <-eventsCh: if !ok { log.Debug("%s: watcher closed the events channel", hostsContainerPref) continue } if err := hc.refresh(); err != nil { log.Error("%s: %s", hostsContainerPref, err) } case _, ok = <-hc.done: // Go on. </s> remove err = w.Add(p) if err == nil { continue } else if errors.Is(err, fs.ErrNotExist) { log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) </s> add if err = w.Add(p); err != nil { if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("adding path: %w", err) } </s> remove patterns, err := pathsToPatterns(fsys, paths) </s> add var patterns []string patterns, err = pathsToPatterns(fsys, paths) </s> add } else if len(patterns) == 0 { return nil, ErrNoHostsPaths
https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b
internal/home/home.go
keep keep replace keep keep keep keep keep
<mask> package upstream <mask> <mask> import "github.com/miekg/dns" <mask> <mask> // Performs a simple health-check of the specified upstream <mask> func IsAlive(u Upstream) (bool, error) { <mask> <mask> // Using ipv4only.arpa. domain as it is a part of DNS64 RFC and it should exist everywhere </s> Added factory method for creating DNS upstreams </s> remove // NewHttpsUpstream creates a new DNS-over-HTTPS upstream from hostname </s> add // NewHttpsUpstream creates a new DNS-over-HTTPS upstream from the specified url </s> remove bootstrapResolver := net.DefaultResolver if bootstrap != "" { bootstrapResolver = &net.Resolver{ PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { var d net.Dialer conn, err := d.DialContext(ctx, network, bootstrap) return conn, err }, } } </s> add bootstrapResolver := CreateResolver(bootstrap) </s> remove u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove {"https://doh.cleanbrowsing.org/doh/security-filter/", ""}, // TODO: status 201?? </s> add {"https://doh.cleanbrowsing.org/doh/security-filter/", ""}, </s> remove endpoint string proto string </s> add url string bootstrap string </s> remove endpoint string tlsServerName string </s> add url string bootstrap string
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/helpers.go
keep keep keep keep replace keep keep keep keep keep
<mask> client *http.Client <mask> endpoint *url.URL <mask> } <mask> <mask> // NewHttpsUpstream creates a new DNS-over-HTTPS upstream from hostname <mask> func NewHttpsUpstream(endpoint string, bootstrap string) (Upstream, error) { <mask> u, err := url.Parse(endpoint) <mask> if err != nil { <mask> return nil, err <mask> } </s> Added factory method for creating DNS upstreams </s> remove import "github.com/miekg/dns" </s> add import ( "github.com/miekg/dns" "golang.org/x/net/context" "net" "strings" ) // Detects the upstream type from the specified url and creates a proper Upstream object func NewUpstream(url string, bootstrap string) (Upstream, error) { proto := "udp" prefix := "" switch { case strings.HasPrefix(url, "tcp://"): proto = "tcp" prefix = "tcp://" case strings.HasPrefix(url, "tls://"): proto = "tcp-tls" prefix = "tls://" case strings.HasPrefix(url, "https://"): return NewHttpsUpstream(url, bootstrap) } hostname := strings.TrimPrefix(url, prefix) host, port, err := net.SplitHostPort(hostname) if err != nil { // Set port depending on the protocol switch proto { case "udp": port = "53" case "tcp": port = "53" case "tcp-tls": port = "853" } // Set host = hostname host = hostname } // Try to resolve the host address (or check if it's an IP address) bootstrapResolver := CreateResolver(bootstrap) ips, err := bootstrapResolver.LookupIPAddr(context.Background(), host) if err != nil || len(ips) == 0 { return nil, err } addr := ips[0].String() endpoint := net.JoinHostPort(addr, port) tlsServerName := "" if proto == "tcp-tls" && host != addr { // Check if we need to specify TLS server name tlsServerName = host } return NewDnsUpstream(endpoint, proto, tlsServerName) } func CreateResolver(bootstrap string) *net.Resolver { bootstrapResolver := net.DefaultResolver if bootstrap != "" { bootstrapResolver = &net.Resolver{ PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { var d net.Dialer conn, err := d.DialContext(ctx, network, bootstrap) return conn, err }, } } return bootstrapResolver } </s> remove bootstrapResolver := net.DefaultResolver if bootstrap != "" { bootstrapResolver = &net.Resolver{ PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { var d net.Dialer conn, err := d.DialContext(ctx, network, bootstrap) return conn, err }, } } </s> add bootstrapResolver := CreateResolver(bootstrap) </s> remove u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, test.proto, "") </s> add u, err := NewUpstream(test.url, test.bootstrap)
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/https_upstream.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> return nil, err <mask> } <mask> <mask> // Initialize bootstrap resolver <mask> bootstrapResolver := net.DefaultResolver <mask> if bootstrap != "" { <mask> bootstrapResolver = &net.Resolver{ <mask> PreferGo: true, <mask> Dial: func(ctx context.Context, network, address string) (net.Conn, error) { <mask> var d net.Dialer <mask> conn, err := d.DialContext(ctx, network, bootstrap) <mask> return conn, err <mask> }, <mask> } <mask> } <mask> <mask> dialer := &net.Dialer{ <mask> Timeout: defaultTimeout, <mask> KeepAlive: defaultKeepAlive, <mask> DualStack: true, <mask> Resolver: bootstrapResolver, </s> Added factory method for creating DNS upstreams </s> remove import "github.com/miekg/dns" </s> add import ( "github.com/miekg/dns" "golang.org/x/net/context" "net" "strings" ) // Detects the upstream type from the specified url and creates a proper Upstream object func NewUpstream(url string, bootstrap string) (Upstream, error) { proto := "udp" prefix := "" switch { case strings.HasPrefix(url, "tcp://"): proto = "tcp" prefix = "tcp://" case strings.HasPrefix(url, "tls://"): proto = "tcp-tls" prefix = "tls://" case strings.HasPrefix(url, "https://"): return NewHttpsUpstream(url, bootstrap) } hostname := strings.TrimPrefix(url, prefix) host, port, err := net.SplitHostPort(hostname) if err != nil { // Set port depending on the protocol switch proto { case "udp": port = "53" case "tcp": port = "53" case "tcp-tls": port = "853" } // Set host = hostname host = hostname } // Try to resolve the host address (or check if it's an IP address) bootstrapResolver := CreateResolver(bootstrap) ips, err := bootstrapResolver.LookupIPAddr(context.Background(), host) if err != nil || len(ips) == 0 { return nil, err } addr := ips[0].String() endpoint := net.JoinHostPort(addr, port) tlsServerName := "" if proto == "tcp-tls" && host != addr { // Check if we need to specify TLS server name tlsServerName = host } return NewDnsUpstream(endpoint, proto, tlsServerName) } func CreateResolver(bootstrap string) *net.Resolver { bootstrapResolver := net.DefaultResolver if bootstrap != "" { bootstrapResolver = &net.Resolver{ PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { var d net.Dialer conn, err := d.DialContext(ctx, network, bootstrap) return conn, err }, } } return bootstrapResolver } </s> remove // NewHttpsUpstream creates a new DNS-over-HTTPS upstream from hostname </s> add // NewHttpsUpstream creates a new DNS-over-HTTPS upstream from the specified url </s> remove u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, test.proto, "") </s> add u, err := NewUpstream(test.url, test.bootstrap)
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/https_upstream.go
keep keep replace replace keep replace replace replace keep keep
<mask> <mask> var tests = []struct { <mask> endpoint string <mask> proto string <mask> }{ <mask> {"8.8.8.8:53", "udp"}, <mask> {"8.8.8.8:53", "tcp"}, <mask> {"1.1.1.1:53", "udp"}, <mask> } <mask> </s> Added factory method for creating DNS upstreams </s> remove endpoint string proto string </s> add url string bootstrap string </s> remove {"8.8.8.8:53", "udp"}, {"8.8.8.8:53", "tcp"}, {"1.1.1.1:53", "udp"}, </s> add {"8.8.8.8:53", "8.8.8.8:53"}, {"1.1.1.1", ""}, {"tcp://1.1.1.1:53", ""}, {"176.103.130.130:5353", ""}, </s> remove u, err := NewDnsUpstream(test.endpoint, test.proto, "") </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, test.proto, "") </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove endpoint string tlsServerName string </s> add url string bootstrap string
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> {"1.1.1.1:53", "udp"}, <mask> } <mask> <mask> for _, test := range tests { <mask> u, err := NewDnsUpstream(test.endpoint, test.proto, "") <mask> <mask> if err != nil { <mask> t.Errorf("cannot create a DNS upstream") <mask> } <mask> </s> Added factory method for creating DNS upstreams </s> remove u, err := NewDnsUpstream(test.endpoint, test.proto, "") </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove {"8.8.8.8:53", "udp"}, {"8.8.8.8:53", "tcp"}, {"1.1.1.1:53", "udp"}, </s> add {"8.8.8.8:53", "8.8.8.8:53"}, {"1.1.1.1", ""}, {"tcp://1.1.1.1:53", ""}, {"176.103.130.130:5353", ""}, </s> remove {"8.8.8.8:53", "udp"}, {"8.8.8.8:53", "tcp"}, {"1.1.1.1:53", "udp"}, </s> add {"8.8.8.8:53", "8.8.8.8:53"}, {"1.1.1.1", ""}, {"tcp://1.1.1.1:53", ""}, {"176.103.130.130:5353", ""},
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep keep replace keep keep keep replace
<mask> }{ <mask> {"https://cloudflare-dns.com/dns-query", "8.8.8.8:53"}, <mask> {"https://dns.google.com/experimental", "8.8.8.8:53"}, <mask> {"https://doh.cleanbrowsing.org/doh/security-filter/", ""}, // TODO: status 201?? <mask> } <mask> <mask> for _, test := range tests { <mask> u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> Added factory method for creating DNS upstreams </s> remove u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove {"1.1.1.1:853", ""}, {"9.9.9.9:853", ""}, {"185.228.168.10:853", "security-filter-dns.cleanbrowsing.org"}, </s> add {"tls://1.1.1.1", ""}, {"tls://9.9.9.9:853", ""}, {"tls://security-filter-dns.cleanbrowsing.org", "8.8.8.8:53"}, {"tls://adult-filter-dns.cleanbrowsing.org:853", "8.8.8.8:53"}, </s> remove {"1.1.1.1:853", ""}, {"9.9.9.9:853", ""}, {"185.228.168.10:853", "security-filter-dns.cleanbrowsing.org"}, </s> add {"tls://1.1.1.1", ""}, {"tls://9.9.9.9:853", ""}, {"tls://security-filter-dns.cleanbrowsing.org", "8.8.8.8:53"}, {"tls://adult-filter-dns.cleanbrowsing.org:853", "8.8.8.8:53"}, </s> remove {"8.8.8.8:53", "udp"}, {"8.8.8.8:53", "tcp"}, {"1.1.1.1:53", "udp"}, </s> add {"8.8.8.8:53", "8.8.8.8:53"}, {"1.1.1.1", ""}, {"tcp://1.1.1.1:53", ""}, {"176.103.130.130:5353", ""}, </s> remove {"8.8.8.8:53", "udp"}, {"8.8.8.8:53", "tcp"}, {"1.1.1.1:53", "udp"}, </s> add {"8.8.8.8:53", "8.8.8.8:53"}, {"1.1.1.1", ""}, {"tcp://1.1.1.1:53", ""}, {"176.103.130.130:5353", ""},
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep keep keep replace replace keep replace replace replace keep
<mask> <mask> func TestDnsOverTlsIsAlive(t *testing.T) { <mask> <mask> var tests = []struct { <mask> endpoint string <mask> tlsServerName string <mask> }{ <mask> {"1.1.1.1:853", ""}, <mask> {"9.9.9.9:853", ""}, <mask> {"185.228.168.10:853", "security-filter-dns.cleanbrowsing.org"}, <mask> } </s> Added factory method for creating DNS upstreams </s> remove endpoint string tlsServerName string </s> add url string bootstrap string </s> remove {"1.1.1.1:853", ""}, {"9.9.9.9:853", ""}, {"185.228.168.10:853", "security-filter-dns.cleanbrowsing.org"}, </s> add {"tls://1.1.1.1", ""}, {"tls://9.9.9.9:853", ""}, {"tls://security-filter-dns.cleanbrowsing.org", "8.8.8.8:53"}, {"tls://adult-filter-dns.cleanbrowsing.org:853", "8.8.8.8:53"}, </s> remove endpoint string proto string </s> add url string bootstrap string </s> remove endpoint string proto string </s> add url string bootstrap string </s> remove {"8.8.8.8:53", "udp"}, {"8.8.8.8:53", "tcp"}, {"1.1.1.1:53", "udp"}, </s> add {"8.8.8.8:53", "8.8.8.8:53"}, {"1.1.1.1", ""}, {"tcp://1.1.1.1:53", ""}, {"176.103.130.130:5353", ""},
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> {"185.228.168.10:853", "security-filter-dns.cleanbrowsing.org"}, <mask> } <mask> <mask> for _, test := range tests { <mask> u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) <mask> <mask> if err != nil { <mask> t.Errorf("cannot create a DNS-over-TLS upstream") <mask> } <mask> </s> Added factory method for creating DNS upstreams </s> remove u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, test.proto, "") </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, test.proto, "") </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove {"1.1.1.1:853", ""}, {"9.9.9.9:853", ""}, {"185.228.168.10:853", "security-filter-dns.cleanbrowsing.org"}, </s> add {"tls://1.1.1.1", ""}, {"tls://9.9.9.9:853", ""}, {"tls://security-filter-dns.cleanbrowsing.org", "8.8.8.8:53"}, {"tls://adult-filter-dns.cleanbrowsing.org:853", "8.8.8.8:53"}, </s> remove {"1.1.1.1:853", ""}, {"9.9.9.9:853", ""}, {"185.228.168.10:853", "security-filter-dns.cleanbrowsing.org"}, </s> add {"tls://1.1.1.1", ""}, {"tls://9.9.9.9:853", ""}, {"tls://security-filter-dns.cleanbrowsing.org", "8.8.8.8:53"}, {"tls://adult-filter-dns.cleanbrowsing.org:853", "8.8.8.8:53"},
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep keep keep replace replace keep replace replace replace keep keep
<mask> <mask> func TestDnsUpstream(t *testing.T) { <mask> <mask> var tests = []struct { <mask> endpoint string <mask> proto string <mask> }{ <mask> {"8.8.8.8:53", "udp"}, <mask> {"8.8.8.8:53", "tcp"}, <mask> {"1.1.1.1:53", "udp"}, <mask> } <mask> </s> Added factory method for creating DNS upstreams
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> {"1.1.1.1:53", "udp"}, <mask> } <mask> <mask> for _, test := range tests { <mask> u, err := NewDnsUpstream(test.endpoint, test.proto, "") <mask> <mask> if err != nil { <mask> t.Errorf("cannot create a DNS upstream") <mask> } <mask> </s> Added factory method for creating DNS upstreams
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> {"https://doh.cleanbrowsing.org/doh/security-filter/", ""}, <mask> } <mask> <mask> for _, test := range tests { <mask> u, err := NewHttpsUpstream(test.url, test.bootstrap) <mask> <mask> if err != nil { <mask> t.Errorf("cannot create a DNS-over-HTTPS upstream") <mask> } <mask> </s> Added factory method for creating DNS upstreams </s> remove u, err := NewHttpsUpstream(test.url, test.bootstrap) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove {"https://doh.cleanbrowsing.org/doh/security-filter/", ""}, // TODO: status 201?? </s> add {"https://doh.cleanbrowsing.org/doh/security-filter/", ""}, </s> remove u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, test.proto, "") </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) </s> add u, err := NewUpstream(test.url, test.bootstrap) </s> remove u, err := NewDnsUpstream(test.endpoint, test.proto, "") </s> add u, err := NewUpstream(test.url, test.bootstrap)
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep replace replace keep replace replace replace keep keep keep keep
<mask> <mask> var tests = []struct { <mask> endpoint string <mask> tlsServerName string <mask> }{ <mask> {"1.1.1.1:853", ""}, <mask> {"9.9.9.9:853", ""}, <mask> {"185.228.168.10:853", "security-filter-dns.cleanbrowsing.org"}, <mask> } <mask> <mask> for _, test := range tests { <mask> u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) </s> Added factory method for creating DNS upstreams
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> {"185.228.168.10:853", "security-filter-dns.cleanbrowsing.org"}, <mask> } <mask> <mask> for _, test := range tests { <mask> u, err := NewDnsUpstream(test.endpoint, "tcp-tls", test.tlsServerName) <mask> <mask> if err != nil { <mask> t.Errorf("cannot create a DNS-over-TLS upstream") <mask> } <mask> </s> Added factory method for creating DNS upstreams
https://github.com/AdguardTeam/AdGuardHome/commit/9bc4bf66edb279f83aa7610894bd3cccaf12e477
upstream/upstream_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> p = make(dhcp4.Packet, 241) <mask> <mask> // Reserve an IP <mask> hw = []byte{1, 2, 3, 4, 5, 6} <mask> p.SetCHAddr(hw) <mask> lease, _ = s.reserveLease(p) <mask> check(t, bytes.Equal(lease.HWAddr, hw), "lease.HWAddr") <mask> check(t, bytes.Equal(lease.IP, []byte{1, 1, 1, 1}), "lease.IP") <mask> lease = s.findLease(p) </s> * DHCP: fix and update tests for: + dhcp: handle lease expiration (d68600c5d03b73d94f380f5442c22ddc8f755d9a) </s> add // Commit the previously reserved lease #2 hw = []byte{2, 2, 3, 4, 5, 6} p.SetCHAddr(hw) p.SetCIAddr([]byte{0, 0, 0, 0}) opt = make(dhcp4.Options, 10) opt[dhcp4.OptionRequestedIPAddress] = []byte{1, 1, 1, 2} p2 = s.handleDHCP4Request(p, opt) check(t, bytes.Equal(p2.YIAddr(), []byte{1, 1, 1, 2}), "p2.YIAddr") // Reserve an IP - we have no more available IPs hw = []byte{3, 2, 3, 4, 5, 6} p.SetCHAddr(hw) lease, _ = s.reserveLease(p) check(t, lease == nil, "lease == nil") </s> remove check(t, lease == nil, "lease == nil") </s> add check(t, bytes.Equal(lease.HWAddr, hw), "lease.HWAddr") check(t, bytes.Equal(lease.IP, []byte{1, 1, 1, 1}), "lease.IP") </s> remove // Reserve an IP - we have no more available IPs p.SetCHAddr([]byte{3, 2, 3, 4, 5, 6}) </s> add // Reserve an IP - we have no more available IPs, // so the first expired (or, in our case, not yet committed) lease is returned hw = []byte{1, 2, 3, 4, 5, 6} p.SetCHAddr(hw)
https://github.com/AdguardTeam/AdGuardHome/commit/9bc5a4570e76873984a4fda21a4d307499b4980a
dhcpd/dhcpd_test.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> lease, _ = s.reserveLease(p) <mask> check(t, bytes.Equal(lease.HWAddr, hw), "lease.HWAddr") <mask> check(t, bytes.Equal(lease.IP, []byte{1, 1, 1, 2}), "lease.IP") <mask> <mask> // Reserve an IP - we have no more available IPs <mask> p.SetCHAddr([]byte{3, 2, 3, 4, 5, 6}) <mask> lease, _ = s.reserveLease(p) <mask> check(t, lease == nil, "lease == nil") <mask> <mask> // Decline request for a lease which doesn't match our internal state <mask> hw = []byte{1, 2, 3, 4, 5, 6} </s> * DHCP: fix and update tests for: + dhcp: handle lease expiration (d68600c5d03b73d94f380f5442c22ddc8f755d9a) </s> add // Commit the previously reserved lease #2 hw = []byte{2, 2, 3, 4, 5, 6} p.SetCHAddr(hw) p.SetCIAddr([]byte{0, 0, 0, 0}) opt = make(dhcp4.Options, 10) opt[dhcp4.OptionRequestedIPAddress] = []byte{1, 1, 1, 2} p2 = s.handleDHCP4Request(p, opt) check(t, bytes.Equal(p2.YIAddr(), []byte{1, 1, 1, 2}), "p2.YIAddr") // Reserve an IP - we have no more available IPs hw = []byte{3, 2, 3, 4, 5, 6} p.SetCHAddr(hw) lease, _ = s.reserveLease(p) check(t, lease == nil, "lease == nil") </s> remove hw = []byte{1, 2, 3, 4, 5, 6} </s> add hw = []byte{3, 2, 3, 4, 5, 6} </s> remove check(t, lease == nil, "lease == nil") </s> add check(t, bytes.Equal(lease.HWAddr, hw), "lease.HWAddr") check(t, bytes.Equal(lease.IP, []byte{1, 1, 1, 1}), "lease.IP")
https://github.com/AdguardTeam/AdGuardHome/commit/9bc5a4570e76873984a4fda21a4d307499b4980a
dhcpd/dhcpd_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // Reserve an IP - we have no more available IPs <mask> p.SetCHAddr([]byte{3, 2, 3, 4, 5, 6}) <mask> lease, _ = s.reserveLease(p) <mask> check(t, lease == nil, "lease == nil") <mask> <mask> // Decline request for a lease which doesn't match our internal state <mask> hw = []byte{1, 2, 3, 4, 5, 6} <mask> p.SetCHAddr(hw) <mask> p.SetCIAddr([]byte{0, 0, 0, 0}) </s> * DHCP: fix and update tests for: + dhcp: handle lease expiration (d68600c5d03b73d94f380f5442c22ddc8f755d9a) </s> remove hw = []byte{1, 2, 3, 4, 5, 6} </s> add hw = []byte{3, 2, 3, 4, 5, 6} </s> add // Commit the previously reserved lease #2 hw = []byte{2, 2, 3, 4, 5, 6} p.SetCHAddr(hw) p.SetCIAddr([]byte{0, 0, 0, 0}) opt = make(dhcp4.Options, 10) opt[dhcp4.OptionRequestedIPAddress] = []byte{1, 1, 1, 2} p2 = s.handleDHCP4Request(p, opt) check(t, bytes.Equal(p2.YIAddr(), []byte{1, 1, 1, 2}), "p2.YIAddr") // Reserve an IP - we have no more available IPs hw = []byte{3, 2, 3, 4, 5, 6} p.SetCHAddr(hw) lease, _ = s.reserveLease(p) check(t, lease == nil, "lease == nil") </s> remove // Reserve an IP - we have no more available IPs p.SetCHAddr([]byte{3, 2, 3, 4, 5, 6}) </s> add // Reserve an IP - we have no more available IPs, // so the first expired (or, in our case, not yet committed) lease is returned hw = []byte{1, 2, 3, 4, 5, 6} p.SetCHAddr(hw)
https://github.com/AdguardTeam/AdGuardHome/commit/9bc5a4570e76873984a4fda21a4d307499b4980a
dhcpd/dhcpd_test.go
keep add keep keep keep keep keep keep
<mask> check(t, bytes.Equal(opt[dhcp4.OptionServerIdentifier], s.ipnet.IP), "OptionServerIdentifier") <mask> <mask> s.reset() <mask> misc(t, &s) <mask> } <mask> <mask> // Small tests that don't require a static server's state <mask> func misc(t *testing.T, s *Server) { </s> * DHCP: fix and update tests for: + dhcp: handle lease expiration (d68600c5d03b73d94f380f5442c22ddc8f755d9a) </s> remove hw = []byte{1, 2, 3, 4, 5, 6} </s> add hw = []byte{3, 2, 3, 4, 5, 6} </s> remove // Reserve an IP - we have no more available IPs p.SetCHAddr([]byte{3, 2, 3, 4, 5, 6}) </s> add // Reserve an IP - we have no more available IPs, // so the first expired (or, in our case, not yet committed) lease is returned hw = []byte{1, 2, 3, 4, 5, 6} p.SetCHAddr(hw) </s> remove check(t, lease == nil, "lease == nil") </s> add check(t, bytes.Equal(lease.HWAddr, hw), "lease.HWAddr") check(t, bytes.Equal(lease.IP, []byte{1, 1, 1, 1}), "lease.IP")
https://github.com/AdguardTeam/AdGuardHome/commit/9bc5a4570e76873984a4fda21a4d307499b4980a
dhcpd/dhcpd_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> "1hosts_lite": { <mask> "name": "1Hosts (Lite)", <mask> "categoryId": "general", <mask> "homepage": "https://badmojr.github.io/1Hosts/", <mask> "source": "https://badmojr.gitlab.io/1hosts/Lite/adblock.txt" <mask> }, <mask> "CHN_adrules": { <mask> "name": "CHN: AdRules DNS List", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/Cats-Team/AdRules", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_29.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://abpvn.com/android/abpvn.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_16.txt" </s> remove "source": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt" </s> remove "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt" </s> remove "source": "https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_31.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "CHN_adrules": { <mask> "name": "CHN: AdRules DNS List", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/Cats-Team/AdRules", <mask> "source": "https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt" <mask> }, <mask> "CHN_anti_ad": { <mask> "name": "CHN: anti-AD", <mask> "categoryId": "regional", <mask> "homepage": "https://anti-ad.net/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://badmojr.gitlab.io/1hosts/Lite/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_24.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://abpvn.com/android/abpvn.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_16.txt" </s> remove "source": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt" </s> remove "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt" </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "CHN_anti_ad": { <mask> "name": "CHN: anti-AD", <mask> "categoryId": "regional", <mask> "homepage": "https://anti-ad.net/", <mask> "source": "https://anti-ad.net/easylist.txt" <mask> }, <mask> "IDN_abpindo": { <mask> "name": "IDN: ABPindo", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/ABPindo/indonesianadblockrules", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_29.txt" </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt" </s> remove "source": "https://badmojr.gitlab.io/1hosts/Lite/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_24.txt" </s> remove "source": "https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_19.txt" </s> remove "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt" </s> remove "source": "https://filtri-dns.ga/filtri.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_18.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "IDN_abpindo": { <mask> "name": "IDN: ABPindo", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/ABPindo/indonesianadblockrules", <mask> "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" <mask> }, <mask> "IRN_unwanted_iranian_domains": { <mask> "name": "IRN: PersianBlocker list", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/MasterKia/PersianBlocker", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_19.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt" </s> remove "source": "https://filtri-dns.ga/filtri.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_18.txt" </s> remove "source": "https://github.com/List-KR/List-KR" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_25.txt" </s> remove "source": "https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_29.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "IRN_unwanted_iranian_domains": { <mask> "name": "IRN: PersianBlocker list", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/MasterKia/PersianBlocker", <mask> "source": "https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt" <mask> }, <mask> "ITA_filtri_dns": { <mask> "name": "ITA: Filtri-DNS", <mask> "categoryId": "regional", <mask> "homepage": "https://filtri-dns.ga/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt" </s> remove "source": "https://filtri-dns.ga/filtri.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_18.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt" </s> remove "source": "https://github.com/List-KR/List-KR" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_25.txt" </s> remove "source": "https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_29.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "ITA_filtri_dns": { <mask> "name": "ITA: Filtri-DNS", <mask> "categoryId": "regional", <mask> "homepage": "https://filtri-dns.ga/", <mask> "source": "https://filtri-dns.ga/filtri.txt" <mask> }, <mask> "KOR_list_kr": { <mask> "name": "KOR: List-KR DNS", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/List-KR/List-KR", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://github.com/List-KR/List-KR" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_25.txt" </s> remove "source": "https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_19.txt" </s> remove "source": "https://raw.githubusercontent.com/yous/YousList/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_15.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt" </s> remove "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "KOR_list_kr": { <mask> "name": "KOR: List-KR DNS", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/List-KR/List-KR", <mask> "source": "https://github.com/List-KR/List-KR" <mask> }, <mask> "KOR_youslist": { <mask> "name": "KOR: YousList", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/yous/YousList", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://filtri-dns.ga/filtri.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_18.txt" </s> remove "source": "https://raw.githubusercontent.com/yous/YousList/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_15.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt" </s> remove "source": "https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_19.txt" </s> remove "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "KOR_youslist": { <mask> "name": "KOR: YousList", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/yous/YousList", <mask> "source": "https://raw.githubusercontent.com/yous/YousList/master/hosts.txt" <mask> }, <mask> "MKD_macedonian_pi_hole_blocklist": { <mask> "name": "MKD: Macedonian Pi-hole Blocklist", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/cchevy/macedonian-pi-hole-blocklist", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_20.txt" </s> remove "source": "https://github.com/List-KR/List-KR" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_25.txt" </s> remove "source": "https://filtri-dns.ga/filtri.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_18.txt" </s> remove "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "MKD_macedonian_pi_hole_blocklist": { <mask> "name": "MKD: Macedonian Pi-hole Blocklist", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/cchevy/macedonian-pi-hole-blocklist", <mask> "source": "https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt" <mask> }, <mask> "NOR_dandelion_sprouts_anti_malware_list": { <mask> "name": "NOR: Dandelion Sprouts nordiske filtre", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/DandelionSprout/adfilt", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/NorwegianExperimentalList%20alternate%20versions/NordicFiltersAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_13.txt" </s> remove "source": "https://raw.githubusercontent.com/yous/YousList/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_15.txt" </s> remove "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_12.txt" </s> remove "source": "https://someonewhocares.org/hosts/zero/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "NOR_dandelion_sprouts_anti_malware_list": { <mask> "name": "NOR: Dandelion Sprouts nordiske filtre", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/DandelionSprout/adfilt", <mask> "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/NorwegianExperimentalList%20alternate%20versions/NordicFiltersAdGuardHome.txt" <mask> }, <mask> "POL_polish_filters_for_pi_hole": { <mask> "name": "POL: Polish filters for Pi hole", <mask> "categoryId": "regional", <mask> "homepage": "https://www.certyficate.it/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/polish-pihole-filters/hostfile.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_14.txt" </s> remove "source": "https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_20.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_12.txt" </s> remove "source": "https://someonewhocares.org/hosts/zero/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "POL_polish_filters_for_pi_hole": { <mask> "name": "POL: Polish filters for Pi hole", <mask> "categoryId": "regional", <mask> "homepage": "https://www.certyficate.it/", <mask> "source": "https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/polish-pihole-filters/hostfile.txt" <mask> }, <mask> "SWE_frellwit_swedish_hosts_file": { <mask> "name": "SWE: Frellwit's Swedish Hosts File", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/lassekongo83/Frellwits-filter-lists/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/NorwegianExperimentalList%20alternate%20versions/NordicFiltersAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_13.txt" </s> remove "source": "https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Hosts-File.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_17.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_11.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt" </s> remove "source": "https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_19.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "SWE_frellwit_swedish_hosts_file": { <mask> "name": "SWE: Frellwit's Swedish Hosts File", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/lassekongo83/Frellwits-filter-lists/", <mask> "source": "https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Hosts-File.txt" <mask> }, <mask> "TUR_turk_adlist": { <mask> "name": "TUR: turk-adlist", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/bkrucarci/turk-adlist", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/polish-pihole-filters/hostfile.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_14.txt" </s> remove "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_11.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt" </s> remove "source": "https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_19.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "TUR_turk_adlist": { <mask> "name": "TUR: turk-adlist", <mask> "categoryId": "regional", <mask> "homepage": "https://github.com/bkrucarci/turk-adlist", <mask> "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" <mask> }, <mask> "VNM_abpvn": { <mask> "name": "VNM: ABPVN List", <mask> "categoryId": "regional", <mask> "homepage": "http://abpvn.com/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://abpvn.com/android/abpvn.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_16.txt" </s> remove "source": "https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Hosts-File.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_17.txt" </s> remove "source": "https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_29.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://badmojr.gitlab.io/1hosts/Lite/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_24.txt" </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "VNM_abpvn": { <mask> "name": "VNM: ABPVN List", <mask> "categoryId": "regional", <mask> "homepage": "http://abpvn.com/", <mask> "source": "https://abpvn.com/android/abpvn.txt" <mask> }, <mask> "adguard_dns_filter": { <mask> "name": "AdGuard DNS filter", <mask> "categoryId": "general", <mask> "homepage": "https://github.com/AdguardTeam/AdGuardSDNSFilter", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt" </s> remove "source": "https://raw.githubusercontent.com/bkrucarci/turk-adlist/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt" </s> remove "source": "https://badmojr.gitlab.io/1hosts/Lite/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_24.txt" </s> remove "source": "https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_29.txt" </s> remove "source": "https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_31.txt" </s> remove "source": "https://block.energized.pro/spark/formats/filter" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_28.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "adguard_dns_filter": { <mask> "name": "AdGuard DNS filter", <mask> "categoryId": "general", <mask> "homepage": "https://github.com/AdguardTeam/AdGuardSDNSFilter", <mask> "source": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" <mask> }, <mask> "adway_default_blocklist": { <mask> "name": "AdAway Default Blocklist", <mask> "categoryId": "general", <mask> "homepage": "https://github.com/AdAway/adaway.github.io/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://abpvn.com/android/abpvn.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_16.txt" </s> remove "source": "https://adaway.org/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" </s> remove "source": "https://badmojr.gitlab.io/1hosts/Lite/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_24.txt" </s> remove "source": "https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_29.txt" </s> remove "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt" </s> remove "source": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus\u0026showintro=1\u0026mimetype=plaintext" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_3.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "adway_default_blocklist": { <mask> "name": "AdAway Default Blocklist", <mask> "categoryId": "general", <mask> "homepage": "https://github.com/AdAway/adaway.github.io/", <mask> "source": "https://adaway.org/hosts.txt" <mask> }, <mask> "curben_phishing_filter": { <mask> "name": "Phishing URL Blocklist (PhishTank and OpenPhish)", <mask> "categoryId": "security", <mask> "homepage": "https://gitlab.com/malware-filter/phishing-filter", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_30.txt" </s> remove "source": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt" </s> remove "source": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus\u0026showintro=1\u0026mimetype=plaintext" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_3.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_11.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "curben_phishing_filter": { <mask> "name": "Phishing URL Blocklist (PhishTank and OpenPhish)", <mask> "categoryId": "security", <mask> "homepage": "https://gitlab.com/malware-filter/phishing-filter", <mask> "source": "https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt" <mask> }, <mask> "dan_pollocks_list": { <mask> "name": "Dan Pollock's List", <mask> "categoryId": "general", <mask> "homepage": "https://someonewhocares.org/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://adaway.org/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" </s> remove "source": "https://someonewhocares.org/hosts/zero/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_11.txt" </s> remove "source": "https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_9.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_10.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "dan_pollocks_list": { <mask> "name": "Dan Pollock's List", <mask> "categoryId": "general", <mask> "homepage": "https://someonewhocares.org/", <mask> "source": "https://someonewhocares.org/hosts/zero/hosts" <mask> }, <mask> "dandelion_sprouts_anti_malware_list": { <mask> "name": "Dandelion Sprout's Anti-Malware List", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/DandelionSprout/adfilt", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_12.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_30.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_6.txt" </s> remove "source": "https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_31.txt" </s> remove "source": "https://block.energized.pro/spark/formats/filter" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_28.txt" </s> remove "source": "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_8.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "dandelion_sprouts_anti_malware_list": { <mask> "name": "Dandelion Sprout's Anti-Malware List", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/DandelionSprout/adfilt", <mask> "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuardHome.txt" <mask> }, <mask> "dandelion_sprouts_game_console_adblock_list": { <mask> "name": "Dandelion Sprout's Game Console Adblock List", <mask> "categoryId": "other", <mask> "homepage": "https://github.com/DandelionSprout/adfilt", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_6.txt" </s> remove "source": "https://someonewhocares.org/hosts/zero/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt" </s> remove "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_20.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/NorwegianExperimentalList%20alternate%20versions/NordicFiltersAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_13.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "dandelion_sprouts_game_console_adblock_list": { <mask> "name": "Dandelion Sprout's Game Console Adblock List", <mask> "categoryId": "other", <mask> "homepage": "https://github.com/DandelionSprout/adfilt", <mask> "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt" <mask> }, <mask> "energized_spark": { <mask> "name": "Energized Spark", <mask> "categoryId": "general", <mask> "homepage": "https://energized.pro/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_12.txt" </s> remove "source": "https://block.energized.pro/spark/formats/filter" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_28.txt" </s> remove "source": "https://someonewhocares.org/hosts/zero/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt" </s> remove "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_20.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "energized_spark": { <mask> "name": "Energized Spark", <mask> "categoryId": "general", <mask> "homepage": "https://energized.pro/", <mask> "source": "https://block.energized.pro/spark/formats/filter" <mask> }, <mask> "nocoin_filter_list": { <mask> "name": "NoCoin Filter List", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/hoshsadiq/adblock-nocoin-list/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_8.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_6.txt" </s> remove "source": "https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_31.txt" </s> remove "source": "https://someonewhocares.org/hosts/zero/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt" </s> remove "source": "https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_10.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_30.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "nocoin_filter_list": { <mask> "name": "NoCoin Filter List", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/hoshsadiq/adblock-nocoin-list/", <mask> "source": "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt" <mask> }, <mask> "notracking_hosts_blocklists": { <mask> "name": "The NoTracking blocklist", <mask> "categoryId": "general", <mask> "homepage": "https://github.com/notracking/hosts-blocklists", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/notracking/hosts-blocklists/master/adblock/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_32.txt" </s> remove "source": "https://block.energized.pro/spark/formats/filter" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_28.txt" </s> remove "source": "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_33.txt" </s> remove "source": "https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_9.txt" </s> remove "source": "https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_31.txt" </s> remove "source": "https://someonewhocares.org/hosts/zero/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "notracking_hosts_blocklists": { <mask> "name": "The NoTracking blocklist", <mask> "categoryId": "general", <mask> "homepage": "https://github.com/notracking/hosts-blocklists", <mask> "source": "https://raw.githubusercontent.com/notracking/hosts-blocklists/master/adblock/adblock.txt" <mask> }, <mask> "oisd_basic": { <mask> "name": "OISD Blocklist Basic", <mask> "categoryId": "general", <mask> "homepage": "https://oisd.nl/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://abp.oisd.nl/basic/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_5.txt" </s> remove "source": "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_8.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_9.txt" </s> remove "source": "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_33.txt" </s> remove "source": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus\u0026showintro=1\u0026mimetype=plaintext" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_3.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "oisd_basic": { <mask> "name": "OISD Blocklist Basic", <mask> "categoryId": "general", <mask> "homepage": "https://oisd.nl/", <mask> "source": "https://abp.oisd.nl/basic/" <mask> }, <mask> "oisd_full": { <mask> "name": "OISD Blocklist Full", <mask> "categoryId": "general", <mask> "homepage": "https://oisd.nl/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/notracking/hosts-blocklists/master/adblock/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_32.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus\u0026showintro=1\u0026mimetype=plaintext" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_3.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_30.txt" </s> remove "source": "https://adaway.org/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" </s> remove "source": "https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_10.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "oisd_full": { <mask> "name": "OISD Blocklist Full", <mask> "categoryId": "general", <mask> "homepage": "https://oisd.nl/", <mask> "source": "https://abp.oisd.nl/" <mask> }, <mask> "perflyst_dandelion_sprout_smart_tv_blocklist_for_adguard_home": { <mask> "name": "Perflyst and Dandelion Sprout's Smart-TV Blocklist", <mask> "categoryId": "other", <mask> "homepage": "https://github.com/Perflyst/PiHoleBlocklist", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt" </s> remove "source": "https://abp.oisd.nl/basic/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_5.txt" </s> remove "source": "https://raw.githubusercontent.com/notracking/hosts-blocklists/master/adblock/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_32.txt" </s> remove "source": "https://adaway.org/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_12.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_6.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "perflyst_dandelion_sprout_smart_tv_blocklist_for_adguard_home": { <mask> "name": "Perflyst and Dandelion Sprout's Smart-TV Blocklist", <mask> "categoryId": "other", <mask> "homepage": "https://github.com/Perflyst/PiHoleBlocklist", <mask> "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" <mask> }, <mask> "peter_lowe_list": { <mask> "name": "Peter Lowe's Blocklist", <mask> "categoryId": "general", <mask> "homepage": "https://pgl.yoyo.org/adservers/", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus\u0026showintro=1\u0026mimetype=plaintext" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_3.txt" </s> remove "source": "https://raw.githubusercontent.com/cchevy/macedonian-pi-hole-blocklist/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_20.txt" </s> remove "source": "https://adaway.org/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_12.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_6.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "peter_lowe_list": { <mask> "name": "Peter Lowe's Blocklist", <mask> "categoryId": "general", <mask> "homepage": "https://pgl.yoyo.org/adservers/", <mask> "source": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus\u0026showintro=1\u0026mimetype=plaintext" <mask> }, <mask> "scam_blocklist_by_durablenapkin": { <mask> "name": "Scam Blocklist by DurableNapkin", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/durablenapkin/scamblocklist", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_10.txt" </s> remove "source": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt" </s> remove "source": "https://adaway.org/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://abp.oisd.nl/basic/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_5.txt" </s> remove "source": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "scam_blocklist_by_durablenapkin": { <mask> "name": "Scam Blocklist by DurableNapkin", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/durablenapkin/scamblocklist", <mask> "source": "https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt" <mask> }, <mask> "staklerware_indicators_list": { <mask> "name": "Stalkerware Indicators List", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/AssoEchap/stalkerware-indicators", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus\u0026showintro=1\u0026mimetype=plaintext" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_3.txt" </s> remove "source": "https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_31.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_30.txt" </s> remove "source": "https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_9.txt" </s> remove "source": "https://block.energized.pro/spark/formats/filter" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_28.txt" </s> remove "source": "https://adaway.org/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "staklerware_indicators_list": { <mask> "name": "Stalkerware Indicators List", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/AssoEchap/stalkerware-indicators", <mask> "source": "https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts" <mask> }, <mask> "steven_blacks_list": { <mask> "name": "Steven Black's List", <mask> "categoryId": "general", <mask> "homepage": "https://github.com/StevenBlack/hosts", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_10.txt" </s> remove "source": "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_33.txt" </s> remove "source": "https://someonewhocares.org/hosts/zero/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt" </s> remove "source": "https://block.energized.pro/spark/formats/filter" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_28.txt" </s> remove "source": "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_8.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_12.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "steven_blacks_list": { <mask> "name": "Steven Black's List", <mask> "categoryId": "general", <mask> "homepage": "https://github.com/StevenBlack/hosts", <mask> "source": "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" <mask> }, <mask> "the_big_list_of_hacked_malware_web_sites": { <mask> "name": "The Big List of Hacked Malware Web Sites", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_9.txt" </s> remove "source": "https://raw.githubusercontent.com/AssoEchap/stalkerware-indicators/master/generated/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_31.txt" </s> remove "source": "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_8.txt" </s> remove "source": "https://raw.githubusercontent.com/notracking/hosts-blocklists/master/adblock/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_32.txt" </s> remove "source": "https://block.energized.pro/spark/formats/filter" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_28.txt" </s> remove "source": "https://someonewhocares.org/hosts/zero/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "the_big_list_of_hacked_malware_web_sites": { <mask> "name": "The Big List of Hacked Malware Web Sites", <mask> "categoryId": "security", <mask> "homepage": "https://github.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites", <mask> "source": "https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hosts" <mask> }, <mask> "urlhaus_filter_online": { <mask> "name": "Malicious URL Blocklist (URLHaus)", <mask> "categoryId": "security", <mask> "homepage": "https://gitlab.com/malware-filter/urlhaus-filter", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_33.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_11.txt" </s> remove "source": "https://adaway.org/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_30.txt" </s> remove "source": "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_8.txt" </s> remove "source": "https://raw.githubusercontent.com/notracking/hosts-blocklists/master/adblock/adblock.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_32.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> "urlhaus_filter_online": { <mask> "name": "Malicious URL Blocklist (URLHaus)", <mask> "categoryId": "security", <mask> "homepage": "https://gitlab.com/malware-filter/urlhaus-filter", <mask> "source": "https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh.txt" <mask> }, <mask> "windowsspyblocker_hosts_spy_rules": { <mask> "name": "WindowsSpyBlocker - Hosts spy rules", <mask> "categoryId": "other", <mask> "homepage": "https://github.com/crazy-max/WindowsSpyBlocker", </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_23.txt" </s> remove "source": "https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hosts" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_9.txt" </s> remove "source": "https://adaway.org/hosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt" </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/phishing-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_30.txt" </s> remove "source": "https://abp.oisd.nl/" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt" </s> remove "source": "https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Hosts-File.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_17.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep
<mask> "windowsspyblocker_hosts_spy_rules": { <mask> "name": "WindowsSpyBlocker - Hosts spy rules", <mask> "categoryId": "other", <mask> "homepage": "https://github.com/crazy-max/WindowsSpyBlocker", <mask> "source": "https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt" <mask> } <mask> } <mask> } </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-agh.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_11.txt" </s> remove "source": "https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Hosts-File.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_17.txt" </s> remove Source: f.SourceURL, </s> add // NOTE: The source URL in filters.json is not guaranteed to contain // the URL of the filtering rule list. So, use our mirror for the // vetted blocklists, which are mostly guaranteed to be valid and // available lists. Source: f.DownloadURL, </s> remove FilterID string `json:"filterId"` Name string `json:"name"` Homepage string `json:"homepage"` SourceURL string `json:"sourceUrl"` Tags []string `json:"tags"` </s> add DownloadURL string `json:"downloadUrl"` FilterID string `json:"filterId"` Homepage string `json:"homepage"` Name string `json:"name"` Tags []string `json:"tags"` </s> remove "source": "https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/polish-pihole-filters/hostfile.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_14.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_6.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
client/src/helpers/filters/filters.js
keep keep keep keep replace keep keep keep keep keep
<mask> aghFlt.Filters[id] = &aghFiltersFilter{ <mask> Name: f.Name, <mask> CategoryID: cat, <mask> Homepage: f.Homepage, <mask> Source: f.SourceURL, <mask> } <mask> } <mask> <mask> buf := &bytes.Buffer{} <mask> _, _ = buf.WriteString(jsHeader) </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove "source": "https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_23.txt" </s> remove FilterID string `json:"filterId"` Name string `json:"name"` Homepage string `json:"homepage"` SourceURL string `json:"sourceUrl"` Tags []string `json:"tags"` </s> add DownloadURL string `json:"downloadUrl"` FilterID string `json:"filterId"` Homepage string `json:"homepage"` Name string `json:"name"` Tags []string `json:"tags"` </s> remove "source": "https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_29.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt" </s> remove "source": "https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_19.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
scripts/vetted-filters/main.go
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> <mask> // hlFiltersFilter is the JSON structure for a filter in the Hostlists Registry. <mask> type hlFiltersFilter struct { <mask> FilterID string `json:"filterId"` <mask> Name string `json:"name"` <mask> Homepage string `json:"homepage"` <mask> SourceURL string `json:"sourceUrl"` <mask> Tags []string `json:"tags"` <mask> } <mask> <mask> // category returns the AdGuard Home category for this filter. If there is no <mask> // fitting category, cat is empty. <mask> func (f *hlFiltersFilter) category() (cat string) { </s> Pull request: use-download-url Merge in DNS/adguard-home from use-download-url to master Squashed commit of the following: commit d665794ef0594b87044c7a1aadac6ac9dc31722a Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 24 18:06:36 2022 +0300 all: use download url for vetted lists </s> remove Source: f.SourceURL, </s> add // NOTE: The source URL in filters.json is not guaranteed to contain // the URL of the filtering rule list. So, use our mirror for the // vetted blocklists, which are mostly guaranteed to be valid and // available lists. Source: f.DownloadURL, </s> remove "source": "https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_23.txt" </s> remove "source": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/NorwegianExperimentalList%20alternate%20versions/NordicFiltersAdGuardHome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_13.txt" </s> remove "source": "https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/polish-pihole-filters/hostfile.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_14.txt" </s> remove "source": "https://anti-ad.net/easylist.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt" </s> remove "source": "https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/aghome.txt" </s> add "source": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt"
https://github.com/AdguardTeam/AdGuardHome/commit/9c4bed31e79dac3d558efe3510ff372a2cdbe59f
scripts/vetted-filters/main.go
keep keep keep keep replace keep keep keep keep keep
<mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings" <mask> "github.com/AdguardTeam/golibs/cache" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> const ( </s> Pull request: home: imp whois parse Updates #2646. Squashed commit of the following: commit 0a5ff6ae74c532a296c0594a598a99c7cfaccf8c Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 14:07:08 2021 +0300 home: imp code commit 2af0f463a77b81e827d9faca079a19c5437e1cd9 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 13:48:08 2021 +0300 home: imp whois parse </s> remove _, ok := m["orgname"] if !ok { // Set orgname from either descr or netname for the frontent. // // TODO(a.garipov): Perhaps don't do that in the V1 HTTP API? if descr != "" { m["orgname"] = trimValue(descr) } else if netname != "" { m["orgname"] = trimValue(netname) } </s> add m[k] = v </s> remove } </s> add </s> remove case "org-name": m["orgname"] = trimValue(v) case "city", "country", "orgname": m[k] = trimValue(v) case "descr": if len(descr) == 0 { descr = v } case "netname": netname = v case "whois": // "whois: whois.arin.net" m["whois"] = v case "referralserver": // "ReferralServer: whois://whois.ripe.net" if strings.HasPrefix(v, "whois://") { m["whois"] = v[len("whois://"):] } </s> add case "orgname", "org-name": k = "orgname" v = trimValue(v) orgname = v case "city", "country": v = trimValue(v) case "descr", "netname": k = "orgname" v = coalesceStr(orgname, v) orgname = v case "whois": k = "whois" case "referralserver": k = "whois" v = strings.TrimPrefix(v, "whois://") default: continue </s> add if v == "" { continue } </s> remove k := strings.TrimSpace(kv[0]) k = strings.ToLower(k) </s> add k := strings.ToLower(strings.TrimSpace(kv[0])) </s> remove kv := strings.SplitN(ln, ":", 2) </s> add kv := strings.SplitN(l, ":", 2)
https://github.com/AdguardTeam/AdGuardHome/commit/9c60aef6371c608d715f3ded92afa91007397c48
internal/home/whois.go
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep replace keep keep keep
<mask> } <mask> return s[:maxValueLength-3] + "..." <mask> } <mask> <mask> // Parse plain-text data from the response <mask> func whoisParse(data string) map[string]string { <mask> m := map[string]string{} <mask> descr := "" <mask> netname := "" <mask> for len(data) != 0 { <mask> ln := aghstrings.SplitNext(&data, '\n') <mask> if len(ln) == 0 || ln[0] == '#' || ln[0] == '%' { <mask> continue <mask> } <mask> <mask> kv := strings.SplitN(ln, ":", 2) <mask> if len(kv) != 2 { <mask> continue <mask> } </s> Pull request: home: imp whois parse Updates #2646. Squashed commit of the following: commit 0a5ff6ae74c532a296c0594a598a99c7cfaccf8c Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 14:07:08 2021 +0300 home: imp code commit 2af0f463a77b81e827d9faca079a19c5437e1cd9 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 13:48:08 2021 +0300 home: imp whois parse </s> remove _, ok := m["orgname"] if !ok { // Set orgname from either descr or netname for the frontent. // // TODO(a.garipov): Perhaps don't do that in the V1 HTTP API? if descr != "" { m["orgname"] = trimValue(descr) } else if netname != "" { m["orgname"] = trimValue(netname) } </s> add m[k] = v </s> remove k := strings.TrimSpace(kv[0]) k = strings.ToLower(k) </s> add k := strings.ToLower(strings.TrimSpace(kv[0])) </s> add if v == "" { continue } </s> remove } </s> add </s> remove case "org-name": m["orgname"] = trimValue(v) case "city", "country", "orgname": m[k] = trimValue(v) case "descr": if len(descr) == 0 { descr = v } case "netname": netname = v case "whois": // "whois: whois.arin.net" m["whois"] = v case "referralserver": // "ReferralServer: whois://whois.ripe.net" if strings.HasPrefix(v, "whois://") { m["whois"] = v[len("whois://"):] } </s> add case "orgname", "org-name": k = "orgname" v = trimValue(v) orgname = v case "city", "country": v = trimValue(v) case "descr", "netname": k = "orgname" v = coalesceStr(orgname, v) orgname = v case "whois": k = "whois" case "referralserver": k = "whois" v = strings.TrimPrefix(v, "whois://") default: continue
https://github.com/AdguardTeam/AdGuardHome/commit/9c60aef6371c608d715f3ded92afa91007397c48
internal/home/whois.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> kv := strings.SplitN(ln, ":", 2) <mask> if len(kv) != 2 { <mask> continue <mask> } <mask> k := strings.TrimSpace(kv[0]) <mask> k = strings.ToLower(k) <mask> v := strings.TrimSpace(kv[1]) <mask> <mask> switch k { <mask> case "org-name": <mask> m["orgname"] = trimValue(v) </s> Pull request: home: imp whois parse Updates #2646. Squashed commit of the following: commit 0a5ff6ae74c532a296c0594a598a99c7cfaccf8c Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 14:07:08 2021 +0300 home: imp code commit 2af0f463a77b81e827d9faca079a19c5437e1cd9 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 13:48:08 2021 +0300 home: imp whois parse </s> remove kv := strings.SplitN(ln, ":", 2) </s> add kv := strings.SplitN(l, ":", 2) </s> add if v == "" { continue } </s> remove case "org-name": m["orgname"] = trimValue(v) case "city", "country", "orgname": m[k] = trimValue(v) case "descr": if len(descr) == 0 { descr = v } case "netname": netname = v case "whois": // "whois: whois.arin.net" m["whois"] = v case "referralserver": // "ReferralServer: whois://whois.ripe.net" if strings.HasPrefix(v, "whois://") { m["whois"] = v[len("whois://"):] } </s> add case "orgname", "org-name": k = "orgname" v = trimValue(v) orgname = v case "city", "country": v = trimValue(v) case "descr", "netname": k = "orgname" v = coalesceStr(orgname, v) orgname = v case "whois": k = "whois" case "referralserver": k = "whois" v = strings.TrimPrefix(v, "whois://") default: continue </s> remove // Parse plain-text data from the response func whoisParse(data string) map[string]string { m := map[string]string{} descr := "" netname := "" for len(data) != 0 { ln := aghstrings.SplitNext(&data, '\n') if len(ln) == 0 || ln[0] == '#' || ln[0] == '%' { </s> add // coalesceStr returns the first non-empty string. // // TODO(a.garipov): Move to aghstrings? func coalesceStr(strs ...string) (res string) { for _, s := range strs { if s != "" { return s } } return "" } // isWhoisComment returns true if the string is empty or is a WHOIS comment. func isWhoisComment(s string) (ok bool) { return len(s) == 0 || s[0] == '#' || s[0] == '%' } // strmap is an alias for convenience. type strmap = map[string]string // whoisParse parses a subset of plain-text data from the WHOIS response into // a string map. func whoisParse(data string) (m strmap) { m = strmap{} var orgname string lines := strings.Split(data, "\n") for _, l := range lines { if isWhoisComment(l) { </s> remove } </s> add </s> remove _, ok := m["orgname"] if !ok { // Set orgname from either descr or netname for the frontent. // // TODO(a.garipov): Perhaps don't do that in the V1 HTTP API? if descr != "" { m["orgname"] = trimValue(descr) } else if netname != "" { m["orgname"] = trimValue(netname) } </s> add m[k] = v
https://github.com/AdguardTeam/AdGuardHome/commit/9c60aef6371c608d715f3ded92afa91007397c48
internal/home/whois.go
keep keep keep add keep keep keep keep keep
<mask> } <mask> <mask> k := strings.ToLower(strings.TrimSpace(kv[0])) <mask> v := strings.TrimSpace(kv[1]) <mask> <mask> switch k { <mask> case "orgname", "org-name": <mask> k = "orgname" <mask> v = trimValue(v) </s> Pull request: home: imp whois parse Updates #2646. Squashed commit of the following: commit 0a5ff6ae74c532a296c0594a598a99c7cfaccf8c Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 14:07:08 2021 +0300 home: imp code commit 2af0f463a77b81e827d9faca079a19c5437e1cd9 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 13:48:08 2021 +0300 home: imp whois parse </s> remove case "org-name": m["orgname"] = trimValue(v) case "city", "country", "orgname": m[k] = trimValue(v) case "descr": if len(descr) == 0 { descr = v } case "netname": netname = v case "whois": // "whois: whois.arin.net" m["whois"] = v case "referralserver": // "ReferralServer: whois://whois.ripe.net" if strings.HasPrefix(v, "whois://") { m["whois"] = v[len("whois://"):] } </s> add case "orgname", "org-name": k = "orgname" v = trimValue(v) orgname = v case "city", "country": v = trimValue(v) case "descr", "netname": k = "orgname" v = coalesceStr(orgname, v) orgname = v case "whois": k = "whois" case "referralserver": k = "whois" v = strings.TrimPrefix(v, "whois://") default: continue </s> remove k := strings.TrimSpace(kv[0]) k = strings.ToLower(k) </s> add k := strings.ToLower(strings.TrimSpace(kv[0])) </s> remove kv := strings.SplitN(ln, ":", 2) </s> add kv := strings.SplitN(l, ":", 2) </s> remove _, ok := m["orgname"] if !ok { // Set orgname from either descr or netname for the frontent. // // TODO(a.garipov): Perhaps don't do that in the V1 HTTP API? if descr != "" { m["orgname"] = trimValue(descr) } else if netname != "" { m["orgname"] = trimValue(netname) } </s> add m[k] = v </s> remove } </s> add </s> remove // Parse plain-text data from the response func whoisParse(data string) map[string]string { m := map[string]string{} descr := "" netname := "" for len(data) != 0 { ln := aghstrings.SplitNext(&data, '\n') if len(ln) == 0 || ln[0] == '#' || ln[0] == '%' { </s> add // coalesceStr returns the first non-empty string. // // TODO(a.garipov): Move to aghstrings? func coalesceStr(strs ...string) (res string) { for _, s := range strs { if s != "" { return s } } return "" } // isWhoisComment returns true if the string is empty or is a WHOIS comment. func isWhoisComment(s string) (ok bool) { return len(s) == 0 || s[0] == '#' || s[0] == '%' } // strmap is an alias for convenience. type strmap = map[string]string // whoisParse parses a subset of plain-text data from the WHOIS response into // a string map. func whoisParse(data string) (m strmap) { m = strmap{} var orgname string lines := strings.Split(data, "\n") for _, l := range lines { if isWhoisComment(l) {
https://github.com/AdguardTeam/AdGuardHome/commit/9c60aef6371c608d715f3ded92afa91007397c48
internal/home/whois.go
keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep replace
<mask> <mask> switch k { <mask> case "org-name": <mask> m["orgname"] = trimValue(v) <mask> case "city", "country", "orgname": <mask> m[k] = trimValue(v) <mask> case "descr": <mask> if len(descr) == 0 { <mask> descr = v <mask> } <mask> case "netname": <mask> netname = v <mask> case "whois": // "whois: whois.arin.net" <mask> m["whois"] = v <mask> case "referralserver": // "ReferralServer: whois://whois.ripe.net" <mask> if strings.HasPrefix(v, "whois://") { <mask> m["whois"] = v[len("whois://"):] <mask> } <mask> } <mask> } </s> Pull request: home: imp whois parse Updates #2646. Squashed commit of the following: commit 0a5ff6ae74c532a296c0594a598a99c7cfaccf8c Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 14:07:08 2021 +0300 home: imp code commit 2af0f463a77b81e827d9faca079a19c5437e1cd9 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 13:48:08 2021 +0300 home: imp whois parse </s> add if v == "" { continue } </s> remove k := strings.TrimSpace(kv[0]) k = strings.ToLower(k) </s> add k := strings.ToLower(strings.TrimSpace(kv[0])) </s> remove _, ok := m["orgname"] if !ok { // Set orgname from either descr or netname for the frontent. // // TODO(a.garipov): Perhaps don't do that in the V1 HTTP API? if descr != "" { m["orgname"] = trimValue(descr) } else if netname != "" { m["orgname"] = trimValue(netname) } </s> add m[k] = v </s> remove kv := strings.SplitN(ln, ":", 2) </s> add kv := strings.SplitN(l, ":", 2) </s> remove // Parse plain-text data from the response func whoisParse(data string) map[string]string { m := map[string]string{} descr := "" netname := "" for len(data) != 0 { ln := aghstrings.SplitNext(&data, '\n') if len(ln) == 0 || ln[0] == '#' || ln[0] == '%' { </s> add // coalesceStr returns the first non-empty string. // // TODO(a.garipov): Move to aghstrings? func coalesceStr(strs ...string) (res string) { for _, s := range strs { if s != "" { return s } } return "" } // isWhoisComment returns true if the string is empty or is a WHOIS comment. func isWhoisComment(s string) (ok bool) { return len(s) == 0 || s[0] == '#' || s[0] == '%' } // strmap is an alias for convenience. type strmap = map[string]string // whoisParse parses a subset of plain-text data from the WHOIS response into // a string map. func whoisParse(data string) (m strmap) { m = strmap{} var orgname string lines := strings.Split(data, "\n") for _, l := range lines { if isWhoisComment(l) {
https://github.com/AdguardTeam/AdGuardHome/commit/9c60aef6371c608d715f3ded92afa91007397c48
internal/home/whois.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> } <mask> } <mask> <mask> _, ok := m["orgname"] <mask> if !ok { <mask> // Set orgname from either descr or netname for the frontent. <mask> // <mask> // TODO(a.garipov): Perhaps don't do that in the V1 HTTP API? <mask> if descr != "" { <mask> m["orgname"] = trimValue(descr) <mask> } else if netname != "" { <mask> m["orgname"] = trimValue(netname) <mask> } <mask> } <mask> <mask> return m <mask> } <mask> </s> Pull request: home: imp whois parse Updates #2646. Squashed commit of the following: commit 0a5ff6ae74c532a296c0594a598a99c7cfaccf8c Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 14:07:08 2021 +0300 home: imp code commit 2af0f463a77b81e827d9faca079a19c5437e1cd9 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 20 13:48:08 2021 +0300 home: imp whois parse </s> remove } </s> add </s> remove // Parse plain-text data from the response func whoisParse(data string) map[string]string { m := map[string]string{} descr := "" netname := "" for len(data) != 0 { ln := aghstrings.SplitNext(&data, '\n') if len(ln) == 0 || ln[0] == '#' || ln[0] == '%' { </s> add // coalesceStr returns the first non-empty string. // // TODO(a.garipov): Move to aghstrings? func coalesceStr(strs ...string) (res string) { for _, s := range strs { if s != "" { return s } } return "" } // isWhoisComment returns true if the string is empty or is a WHOIS comment. func isWhoisComment(s string) (ok bool) { return len(s) == 0 || s[0] == '#' || s[0] == '%' } // strmap is an alias for convenience. type strmap = map[string]string // whoisParse parses a subset of plain-text data from the WHOIS response into // a string map. func whoisParse(data string) (m strmap) { m = strmap{} var orgname string lines := strings.Split(data, "\n") for _, l := range lines { if isWhoisComment(l) { </s> add if v == "" { continue } </s> remove case "org-name": m["orgname"] = trimValue(v) case "city", "country", "orgname": m[k] = trimValue(v) case "descr": if len(descr) == 0 { descr = v } case "netname": netname = v case "whois": // "whois: whois.arin.net" m["whois"] = v case "referralserver": // "ReferralServer: whois://whois.ripe.net" if strings.HasPrefix(v, "whois://") { m["whois"] = v[len("whois://"):] } </s> add case "orgname", "org-name": k = "orgname" v = trimValue(v) orgname = v case "city", "country": v = trimValue(v) case "descr", "netname": k = "orgname" v = coalesceStr(orgname, v) orgname = v case "whois": k = "whois" case "referralserver": k = "whois" v = strings.TrimPrefix(v, "whois://") default: continue </s> remove kv := strings.SplitN(ln, ":", 2) </s> add kv := strings.SplitN(l, ":", 2) </s> remove k := strings.TrimSpace(kv[0]) k = strings.ToLower(k) </s> add k := strings.ToLower(strings.TrimSpace(kv[0]))
https://github.com/AdguardTeam/AdGuardHome/commit/9c60aef6371c608d715f3ded92afa91007397c48
internal/home/whois.go
keep keep keep keep replace keep keep keep keep keep
<mask> "fmt" <mask> "io" <mask> "io/fs" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/stringutil" <mask> ) <mask> <mask> // FileWalker is the signature of a function called for files in the file tree. </s> Pull request: 3906 filewalker read limit Merge in DNS/adguard-home from 3906-filewalker-constraint to master Updates #3906. Squashed commit of the following: commit e1b654420a5031dbfe69d86c3fcf16a95a9ca935 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Dec 1 15:45:26 2021 +0300 aghos: rm filewalker limit </s> remove // should be valid for fs.Glob. If cont is false, the walking terminates. Each // opened file is also limited for reading to MaxWalkedFileSize. </s> add // should be valid for fs.Glob. If FileWalker returns false for cont then // walking terminates. Prefer using bufio.Scanner to read the r since the input // is not limited. </s> remove // TODO(e.burkov, a.garipov): Move into another package like aghfs. </s> add // TODO(e.burkov, a.garipov): Move into another package like aghfs. </s> remove // MaxWalkedFileSize is the maximum length of the file that FileWalker can // check. const MaxWalkedFileSize = 1024 * 1024 </s> add </s> remove var r io.Reader // Ignore the error since LimitReader function returns error only if passed // limit value is less than zero, but the constant used. // // TODO(e.burkov): Make variable. r, _ = aghio.LimitReader(f, MaxWalkedFileSize) return c(r) </s> add return c(f) </s> remove } if fi.IsDir() { </s> add } else if fi.IsDir() {
https://github.com/AdguardTeam/AdGuardHome/commit/9c6d13991306d9a74e6a59954f507d37b15af6c3
internal/aghos/filewalker.go
keep keep keep replace replace keep replace
<mask> // FileWalker is the signature of a function called for files in the file tree. <mask> // As opposed to filepath.Walk it only walk the files (not directories) matching <mask> // the provided pattern and those returned by function itself. All patterns <mask> // should be valid for fs.Glob. If cont is false, the walking terminates. Each <mask> // opened file is also limited for reading to MaxWalkedFileSize. <mask> // <mask> // TODO(e.burkov, a.garipov): Move into another package like aghfs. </s> Pull request: 3906 filewalker read limit Merge in DNS/adguard-home from 3906-filewalker-constraint to master Updates #3906. Squashed commit of the following: commit e1b654420a5031dbfe69d86c3fcf16a95a9ca935 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Dec 1 15:45:26 2021 +0300 aghos: rm filewalker limit </s> remove "github.com/AdguardTeam/AdGuardHome/internal/aghio" </s> add </s> remove var r io.Reader // Ignore the error since LimitReader function returns error only if passed // limit value is less than zero, but the constant used. // // TODO(e.burkov): Make variable. r, _ = aghio.LimitReader(f, MaxWalkedFileSize) return c(r) </s> add return c(f) </s> remove // MaxWalkedFileSize is the maximum length of the file that FileWalker can // check. const MaxWalkedFileSize = 1024 * 1024 </s> add </s> remove } if fi.IsDir() { </s> add } else if fi.IsDir() {
https://github.com/AdguardTeam/AdGuardHome/commit/9c6d13991306d9a74e6a59954f507d37b15af6c3
internal/aghos/filewalker.go