docstring_tokens stringlengths 0 76.5k | code_tokens stringlengths 75 1.81M | label_window listlengths 4 2.12k | html_url stringlengths 74 116 | file_name stringlengths 3 311 |
|---|---|---|---|---|
log.Error("parsing blocked service %q rule %q: %s", s.ID, text, err) | <mask> netRules := make([]*rules.NetworkRule, 0, len(s.rules))
<mask> for _, text := range s.rules {
<mask> rule, err := rules.NewNetworkRule(text, BlockedSvcsListID)
<mask> if err != nil {
<mask> log.Error("parsing blocked service %q rule %q: %s", s.name, text, err)
<mask>
<mask> continue
<m... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | internal/filtering/blocked.go |
serviceIDs[i] = s.ID
serviceRules[s.ID] = netRules | <mask>
<mask> netRules = append(netRules, rule)
<mask> }
<mask>
<mask> serviceIDs[i] = s.name
<mask> serviceRules[s.name] = netRules
<mask> }
<mask>
<mask> slices.Sort(serviceIDs)
<mask>
<mask> log.Debug("filtering: initialized %d services", l)
</s> Pull request: 3972-hostlists-services
Upd... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | internal/filtering/blocked.go |
// BlockedSvcKnown returns true if a blocked service ID is known. | <mask>
<mask> log.Debug("filtering: initialized %d services", l)
<mask> }
<mask>
<mask> // BlockedSvcKnown - return TRUE if a blocked service name is known
<mask> func BlockedSvcKnown(s string) (ok bool) {
<mask> _, ok = serviceRules[s]
<mask>
<mask> return ok
<mask> }
</s> Pull request: 3972-hostlists... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | internal/filtering/blocked.go |
func (d *DNSFilter) handleBlockedServicesIDs(w http.ResponseWriter, r *http.Request) { | <mask> })
<mask> }
<mask> }
<mask>
<mask> func (d *DNSFilter) handleBlockedServicesAvailableServices(w http.ResponseWriter, r *http.Request) {
<mask> _ = aghhttp.WriteJSONResponse(w, r, serviceIDs)
<mask> }
<mask>
<mask> func (d *DNSFilter) handleBlockedServicesList(w http.ResponseWriter, r *http.Request... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | internal/filtering/blocked.go |
func (d *DNSFilter) handleBlockedServicesAll(w http.ResponseWriter, r *http.Request) {
_ = aghhttp.WriteJSONResponse(w, r, struct {
BlockedServices []blockedService `json:"blocked_services"`
}{
BlockedServices: blockedServices,
})
}
| <mask> _ = aghhttp.WriteJSONResponse(w, r, serviceIDs)
<mask> }
<mask>
<mask> func (d *DNSFilter) handleBlockedServicesList(w http.ResponseWriter, r *http.Request) {
<mask> d.confLock.RLock()
<mask> list := d.Config.BlockedServices
<mask> d.confLock.RUnlock()
<mask>
<mask> _ = aghhttp.WriteJSONResponse(... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | internal/filtering/blocked.go |
d.Config.ConfigModified() | <mask> d.confLock.Unlock()
<mask>
<mask> log.Debug("Updated blocked services list: %d", len(list))
<mask>
<mask> d.ConfigModified()
<mask> }
</s> Pull request: 3972-hostlists-services
Updates #3972.
Squashed commit of the following:
commit 9dc0efe2453cb6c738d97d39b02c86eccb18a42c
Merge: 239550f8 8a935d4f... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | internal/filtering/blocked.go |
registerHTTP(http.MethodGet, "/control/blocked_services/services", d.handleBlockedServicesIDs)
registerHTTP(http.MethodGet, "/control/blocked_services/all", d.handleBlockedServicesAll) | <mask> registerHTTP(http.MethodGet, "/control/rewrite/list", d.handleRewriteList)
<mask> registerHTTP(http.MethodPost, "/control/rewrite/add", d.handleRewriteAdd)
<mask> registerHTTP(http.MethodPost, "/control/rewrite/delete", d.handleRewriteDelete)
<mask>
<mask> registerHTTP(http.MethodGet, "/control/blocked... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | internal/filtering/http.go |
'deprecated': true
'description': >
Deprecated: Use `GET /blocked_services/all` instead. | <mask> 'tags':
<mask> - 'clients'
<mask> '/blocked_services/services':
<mask> 'get':
<mask> 'tags':
<mask> - 'blocked_services'
<mask> 'operationId': 'blockedServicesAvailableServices'
<mask> 'summary': 'Get available services to use for blocking'
<mask> 'respons... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | openapi/openapi.yaml |
'/blocked_services/all':
'get':
'tags':
- 'blocked_services'
'operationId': 'blockedServicesAll'
'summary': 'Get available services to use for blocking'
'responses':
'200':
'description': 'OK.'
'content':
'application/json':
'sche... | <mask> 'application/json':
<mask> 'schema':
<mask> '$ref': '#/components/schemas/BlockedServicesArray'
<mask> '/blocked_services/list':
<mask> 'get':
<mask> 'tags':
<mask> - 'blocked_services'
</s> Pull request: 3972-hostlists-services
Updates #3972.
... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | openapi/openapi.yaml |
// vetted-filters fetches the most recent Hostlists Registry filtering rule list
// index and transforms the filters from it to AdGuard Home's format. | <mask> // vetted-filters fetches the most recent Hostlists Registry index and
<mask> // transforms the filters from it to AdGuard Home's format.
<mask> package main
<mask>
<mask> import (
<mask> "bytes"
<mask> "encoding/json"
</s> Pull request: 3972-hostlists-services
Updates #3972.
Squashed commit of the ... | [
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | scripts/vetted-filters/main.go |
// jsHeader is the header for the generated JavaScript file. It informs the | <mask> err = maybe.WriteFile("client/src/helpers/filters/filters.js", buf.Bytes(), 0o644)
<mask> check(err)
<mask> }
<mask>
<mask> // jsHeader is the header for the generates JavaScript file. It informs the
<mask> // reader that the file is generated and disables some style-related eslint
<mask> // checks.
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9951d861d17ec92ad172aa3c5547ce2b0d8a161d | scripts/vetted-filters/main.go |
// Upstream objects:
// nil: not yet initialized
// not nil, but empty: initialized, no good upstreams
// not nil, not empty: Upstreams ready to be used
upstreamObjects []upstream.Upstream | <mask> UseOwnBlockedServices bool // false: use global settings
<mask> BlockedServices []string
<mask>
<mask> Upstreams []string // list of upstream servers to be used for the client's requests
<mask> }
<mask>
<mask> type clientSource uint
<mask>
<mask> // Client sources
<mask> const (
</s> * cli... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go |
lock sync.Mutex | <mask> type clientsContainer struct {
<mask> list map[string]*Client // name -> client
<mask> idIndex map[string]*Client // IP -> client
<mask> ipHost map[string]*ClientHost // IP -> Hostname
<mask>
<mask> // cache for Upstream instances that are used in the case
<mask> // when custom DNS serve... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go |
<mask> }
<mask> clients.list = make(map[string]*Client)
<mask> clients.idIndex = make(map[string]*Client)
<mask> clients.ipHost = make(map[string]*ClientHost)
<mask> clients.upstreamsCache = make(map[string][]upstream.Upstream)
<mask> clients.dhcpServer = dhcpServer
<mask> clients.addFromConfig(objects)
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go | |
func upstreamArrayCopy(a []upstream.Upstream) []upstream.Upstream {
a2 := make([]upstream.Upstream, len(a))
copy(a2, a)
return a2
}
| <mask> return clients.findByIP(ip)
<mask> }
<mask>
<mask> // FindUpstreams looks for upstreams configured for the client
<mask> // If no client found for this IP, or if no custom upstreams are configured,
<mask> // this method returns nil
<mask> func (clients *clientsContainer) FindUpstreams(ip string) []upstr... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go |
if c.upstreamObjects == nil {
c.upstreamObjects = make([]upstream.Upstream, 0)
for _, us := range c.Upstreams {
u, err := upstream.AddressToUpstream(us, upstream.Options{Timeout: dnsforward.DefaultTimeout})
if err != nil {
log.Error("upstream.AddressToUpstream: %s: %s", us, err)
continue
}
c.up... | <mask> if !ok {
<mask> return nil
<mask> }
<mask>
<mask> if len(c.Upstreams) == 0 {
<mask> return nil
<mask> }
<mask>
<mask> upstreams, ok := clients.upstreamsCache[c.Name]
<mask> if ok {
<mask> return upstreams
<mask> }
<mask>
<mask> for _, us := range c.Upstreams {
<mask> u, err := u... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go |
<mask> if err != nil {
<mask> log.Error("upstream.AddressToUpstream: %s: %s", us, err)
<mask> continue
<mask> }
<mask> upstreams = append(upstreams, u)
<mask> }
<mask>
<mask> if len(upstreams) == 0 {
<mask> clients.upstreamsCache[c.Name] = nil
<mask> } else {
</s> * clients: Upstreams cache... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go | |
if len(c.upstreamObjects) == 0 {
return nil | <mask> }
<mask> upstreams = append(upstreams, u)
<mask> }
<mask>
<mask> if len(upstreams) == 0 {
<mask> clients.upstreamsCache[c.Name] = nil
<mask> } else {
<mask> clients.upstreamsCache[c.Name] = upstreams
<mask> }
<mask>
<mask> return upstreams
<mask> }
<mask>
</s> * clients: Upstreams c... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go |
return upstreamArrayCopy(c.upstreamObjects) | <mask> clients.upstreamsCache[c.Name] = nil
<mask> } else {
<mask> clients.upstreamsCache[c.Name] = upstreams
<mask> }
<mask>
<mask> return upstreams
<mask> }
<mask>
<mask> // Find searches for a client by IP (and does not lock anything)
<mask> func (clients *clientsContainer) findByIP(ip string) (Cl... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go |
<mask>
<mask> // update Name index
<mask> delete(clients.list, name)
<mask>
<mask> // update upstreams cache
<mask> delete(clients.upstreamsCache, name)
<mask>
<mask> // update ID index
<mask> for _, id := range c.IDs {
<mask> delete(clients.idIndex, id)
<mask> }
<mask> return true
</s> * clie... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go | |
c.upstreamObjects = nil | <mask> clients.list[c.Name] = old
<mask> }
<mask>
<mask> // update upstreams cache
<mask> if old.Name != c.Name {
<mask> delete(clients.upstreamsCache, old.Name)
<mask> } else {
<mask> delete(clients.upstreamsCache, c.Name)
<mask> }
<mask>
<mask> *old = c
<mask> return nil
<mask> }
<mask>
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/995373c74bae05fde3c0b5ab04a5318cbaf5fa3d | home/clients.go |
// isValidURL - return TRUE if URL or file path is valid
func isValidURL(rawurl string) bool { | <mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
<mask> // IsValidURL - return TRUE if URL or file path is valid
<mask> func IsValidURL(rawurl string) bool {
<mask> if filepath.IsAbs(rawurl) {
<mask> // this is a file path
<mask> return util.FileExists(rawurl)
<... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99625da1e44b4e6686f3c4b29526949ef471a100 | home/control_filtering.go |
if !isValidURL(fj.URL) { | <mask> httpError(w, http.StatusBadRequest, "Failed to parse request body json: %s", err)
<mask> return
<mask> }
<mask>
<mask> if !IsValidURL(fj.URL) {
<mask> http.Error(w, "Invalid URL or file path", http.StatusBadRequest)
<mask> return
<mask> }
<mask>
<mask> // Check for duplicates
</s> - "set... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99625da1e44b4e6686f3c4b29526949ef471a100 | home/control_filtering.go |
if !isValidURL(fj.Data.URL) { | <mask> httpError(w, http.StatusBadRequest, "json decode: %s", err)
<mask> return
<mask> }
<mask>
<mask> if !IsValidURL(fj.URL) {
<mask> http.Error(w, "invalid URL or file path", http.StatusBadRequest)
<mask> return
<mask> }
<mask>
<mask> filt := filter{
</s> - "set_url": couldn't set a new path... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99625da1e44b4e6686f3c4b29526949ef471a100 | home/control_filtering.go |
github.com/AdguardTeam/golibs v0.11.4 | <mask> go 1.18
<mask>
<mask> require (
<mask> github.com/AdguardTeam/dnsproxy v0.46.5
<mask> github.com/AdguardTeam/golibs v0.11.3
<mask> github.com/AdguardTeam/urlfilter v0.16.0
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/ameshkov/dnscrypt/v2 v2.2.5
<mask> github.com/digineo/go-ipset... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | go.mod |
github.com/AdguardTeam/golibs v0.11.4 h1:IltyvxwCTN+xxJF5sh6VadF8Zfbf8elgCm9dgijSVzM=
github.com/AdguardTeam/golibs v0.11.4/go.mod h1:87bN2x4VsTritptE3XZg9l8T6gznWsIxHBcQ1DeRIXA= | <mask> github.com/AdguardTeam/dnsproxy v0.46.5 h1:TiJZhwaIDDaKkqEfJ9AD9aroFjcHN8oEbKB8WfTjSIs=
<mask> github.com/AdguardTeam/dnsproxy v0.46.5/go.mod h1:yKBVgFlE6CqTQtye++3e7SATaMPc4Ixij+KkHsM6HhM=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/Ad... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | go.sum |
"github.com/AdguardTeam/golibs/mathutil" | <mask> "encoding/json"
<mask> "fmt"
<mask> )
<mask>
<mask> // NullBool is a nullable boolean. Use these in JSON requests and responses
<mask> // instead of pointers to bool.
<mask> type NullBool uint8
<mask>
</s> Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to master
Squashed c... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghalg/nullbool.go |
return NBFalse - mathutil.BoolToNumber[NullBool](cond) | <mask> }
<mask>
<mask> // BoolToNullBool converts a bool into a NullBool.
<mask> func BoolToNullBool(cond bool) (nb NullBool) {
<mask> if cond {
<mask> return NBTrue
<mask> }
<mask>
<mask> return NBFalse
<mask> }
<mask>
<mask> // type check
<mask> var _ json.Marshaler = NBNull
<mask>
</s> Pull r... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghalg/nullbool.go |
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/mathutil" | <mask> import (
<mask> "fmt"
<mask> "io"
<mask> )
<mask>
<mask> // LimitReachedError records the limit and the operation that caused it.
<mask> type LimitReachedError struct {
</s> Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to master
Squashed commit of the following:
commit cfe... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghio/limitedreader.go |
// Error implements the [error] interface for *LimitReachedError. | <mask> type LimitReachedError struct {
<mask> Limit int64
<mask> }
<mask>
<mask> // Error implements the error interface for LimitReachedError.
<mask> //
<mask> // TODO(a.garipov): Think about error string format.
<mask> func (lre *LimitReachedError) Error() string {
<mask> return fmt.Sprintf("attempted to ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghio/limitedreader.go |
// limitedReader is a wrapper for [io.Reader] limiting the input and dealing
// with errors package. | <mask> func (lre *LimitReachedError) Error() string {
<mask> return fmt.Sprintf("attempted to read more than %d bytes", lre.Limit)
<mask> }
<mask>
<mask> // limitedReader is a wrapper for io.Reader with limited reader and dealing with
<mask> // errors package.
<mask> type limitedReader struct {
<mask> r ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghio/limitedreader.go |
// Read implements the [io.Reader] interface. | <mask> limit int64
<mask> n int64
<mask> }
<mask>
<mask> // Read implements Reader interface.
<mask> func (lr *limitedReader) Read(p []byte) (n int, err error) {
<mask> if lr.n == 0 {
<mask> return 0, &LimitReachedError{
<mask> Limit: lr.limit,
<mask> }
</s> Pull request: use mathutil
Merge i... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghio/limitedreader.go |
p = p[:mathutil.Min(lr.n, int64(len(p)))] | <mask> Limit: lr.limit,
<mask> }
<mask> }
<mask>
<mask> if int64(len(p)) > lr.n {
<mask> p = p[:lr.n]
<mask> }
<mask>
<mask> n, err = lr.r.Read(p)
<mask> lr.n -= int64(n)
<mask>
<mask> return n, err
</s> Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to master
Squa... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghio/limitedreader.go |
return nil, errors.Error("limit must be non-negative") | <mask> // LimitReader wraps Reader to make it's Reader stop with ErrLimitReached after
<mask> // n bytes read.
<mask> func LimitReader(r io.Reader, n int64) (limited io.Reader, err error) {
<mask> if n < 0 {
<mask> return nil, fmt.Errorf("aghio: invalid n in LimitReader: %d", n)
<mask> }
<mask>
<mask> ret... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghio/limitedreader.go |
wantErrMsg: "limit must be non-negative", | <mask> wantErrMsg: "",
<mask> name: "zero",
<mask> n: 0,
<mask> }, {
<mask> wantErrMsg: "aghio: invalid n in LimitReader: -1",
<mask> name: "negative",
<mask> n: -1,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
</s> Pull request: use mathutil
Merge in ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghio/limitedreader_test.go |
log.Debug("%s: handling the request for %s", hostsContainerPref, req.Hostname) | <mask> req *urlfilter.DNSRequest,
<mask> ) (res *urlfilter.DNSResult, ok bool) {
<mask> switch req.DNSType {
<mask> case dns.TypeA, dns.TypeAAAA, dns.TypePTR:
<mask> log.Debug("%s: handling the request", hostsContainerPref)
<mask> default:
<mask> return nil, false
<mask> }
<mask>
<mask> rm.stateLoc... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghnet/hostscontainer.go |
<mask> return fmt.Errorf("refreshing : %w", err)
<mask> }
<mask>
<mask> // hc.last is nil on the first refresh, so let that one through.
<mask> //
<mask> // TODO(a.garipov): Once https://github.com/golang/go/issues/56621 is
<mask> // resolved, remove the first condition.
<mask> if hc.last != nil && map... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghnet/hostscontainer.go | |
"github.com/AdguardTeam/golibs/mathutil"
"golang.org/x/exp/slices" | <mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
<mask> // UnsupportedError is returned by functions and methods when a particular
<mask> // operation Op cannot be performed on the current OS.
</s> Pull request: use mathutil
Merge in DNS/adguard-home fr... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghos/os.go |
out = out[:mathutil.Min(len(out), MaxCmdOutputSize)] | <mask> // RunCommand runs shell command.
<mask> func RunCommand(command string, arguments ...string) (code int, output []byte, err error) {
<mask> cmd := exec.Command(command, arguments...)
<mask> out, err := cmd.Output()
<mask> if len(out) > MaxCmdOutputSize {
<mask> out = out[:MaxCmdOutputSize]
<mask> }
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghos/os.go |
if aerr != nil || cur < 0 || slices.Contains(ignore, cur) { | <mask> continue
<mask> }
<mask>
<mask> cur, aerr := strconv.Atoi(fields[0])
<mask> if aerr != nil || cur < 0 || intIn(cur, ignore) {
<mask> continue
<mask> }
<mask>
<mask> instNum++
<mask> if cur > largest {
</s> Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to m... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghos/os.go |
largest = mathutil.Max(largest, cur) | <mask> continue
<mask> }
<mask>
<mask> instNum++
<mask> if cur > largest {
<mask> largest = cur
<mask> }
<mask> }
<mask> if err = s.Err(); err != nil {
<mask> return 0, 0, fmt.Errorf("scanning stdout: %w", err)
<mask> }
<mask>
</s> Pull request: use mathutil
Merge in DNS/adguard-home ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghos/os.go |
<mask>
<mask> return largest, instNum, nil
<mask> }
<mask>
<mask> // intIn returns true if nums contains n.
<mask> func intIn(n int, nums []int) (ok bool) {
<mask> for _, nn := range nums {
<mask> if n == nn {
<mask> return true
<mask> }
<mask> }
<mask>
<mask> return false
<mask> }
<mask>
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/aghos/os.go | |
"github.com/AdguardTeam/golibs/mathutil" | <mask>
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
<mask> const (
</s> Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to master
Squashed com... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/dnsforward/dns64.go |
Ttl: mathutil.Min(aResp.Hdr.Ttl, soaTTL), | <mask> Hdr: dns.RR_Header{
<mask> Name: aResp.Hdr.Name,
<mask> Rrtype: dns.TypeAAAA,
<mask> Class: aResp.Hdr.Class,
<mask> },
<mask> AAAA: s.mapDNS64(addr),
<mask> }
<mask>
<mask> return aaaa
</s> Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to master
Squashed ... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/dnsforward/dns64.go |
<mask> },
<mask> AAAA: s.mapDNS64(addr),
<mask> }
<mask>
<mask> if rrTTL := aResp.Hdr.Ttl; rrTTL < soaTTL {
<mask> aaaa.Hdr.Ttl = rrTTL
<mask> } else {
<mask> aaaa.Hdr.Ttl = soaTTL
<mask> }
<mask>
<mask> return aaaa
<mask> }
</s> Pull request: use mathutil
Merge in DNS/adguard-home from use... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/dnsforward/dns64.go | |
"github.com/AdguardTeam/golibs/mathutil" | <mask> "sort"
<mask> "strings"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/miekg/dns"
<mask> "golang.org/x/exp/slices"
<mask> )
<mask>
</s> Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to master
Squashed commit of the following:
commit cfe2c02a7bb... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/filtering/rewrites.go |
rewrites = rewrites[:mathutil.Max(1, i)] | <mask> for i, r := range rewrites {
<mask> if isWildcard(r.Domain) {
<mask> // Don't use rewrites[:0], because we need to return at least one
<mask> // item here.
<mask> rewrites = rewrites[:max(1, i)]
<mask>
<mask> break
<mask> }
<mask> }
<mask>
</s> Pull request: use mathutil
Merge in ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/filtering/rewrites.go |
<mask> }
<mask>
<mask> return rewrites, matched
<mask> }
<mask>
<mask> func max(a, b int) int {
<mask> if a > b {
<mask> return a
<mask> }
<mask>
<mask> return b
<mask> }
</s> Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to master
Squashed commit of the following:
com... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/filtering/rewrites.go | |
// usrID and updates it's blocking moment if needed. For internal use only. | <mask> return ab.checkLocked(usrID, now)
<mask> }
<mask>
<mask> // incLocked increments the number of unsuccessful attempts for attempter with
<mask> // ip and updates it's blocking moment if needed. For internal use only.
<mask> func (ab *authRateLimiter) incLocked(usrID string, now time.Time) {
<mask> unti... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/99ec1d840c0b6c7e8c9fb6a6e13722b4006b0e83 | internal/home/authratelimiter.go |
Name string `yaml:"name"` | <mask> clients.addFromSystemARP()
<mask> }
<mask>
<mask> type clientObject struct {
<mask> Name string `yaml:"name"`
<mask> Tags []string `yaml:"tags"`
<mask> IDs []string `yaml:"ids"`
<mask> UseGlobalSettings bool `yaml:"use_global_settings"`
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
Tags []string `yaml:"tags"`
IDs []string `yaml:"ids"`
BlockedServices []string `yaml:"blocked_services"`
Upstreams []string `yaml:"upstreams"` | <mask> ParentalEnabled bool `yaml:"parental_enabled"`
<mask> SafeSearchEnabled bool `yaml:"safesearch_enabled"`
<mask> SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
<mask>
<mask> UseGlobalBlockedServices bool `yaml:"use_global_blocked_services"`
<mask> BlockedServices ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
UseGlobalSettings bool `yaml:"use_global_settings"`
FilteringEnabled bool `yaml:"filtering_enabled"`
ParentalEnabled bool `yaml:"parental_enabled"`
SafeSearchEnabled bool `yaml:"safesearch_enabled"`
SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"`
UseGlobalBlockedServices... | <mask>
<mask> UseGlobalBlockedServices bool `yaml:"use_global_blocked_services"`
<mask> BlockedServices []string `yaml:"blocked_services"`
<mask>
<mask> Upstreams []string `yaml:"upstreams"`
<mask> }
<mask>
<mask> func (clients *clientsContainer) tagKnown(tag string) (ok bool) {
<mask> retu... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
// 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. | <mask> Orgname: wi.Orgname,
<mask> }
<mask> }
<mask>
<mask> // findMultiple returns info about client. If no information about the client
<mask> // is found, it sends the client by default only with the "Disallowed" field
<mask> // filled in. err is always nil.
<mask> func (clients *clientsContainer) find... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
var artClient *querylog.Client
var art bool | <mask> // findMultiple returns info about client. If no information about the client
<mask> // is found, it sends the client by default only with the "Disallowed" field
<mask> // filled in. err is always nil.
<mask> func (clients *clientsContainer) findMultiple(ids []string) (c *querylog.Client, err error) {
<ma... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
c, art = clients.clientOrArtificial(net.ParseIP(id), id)
if art {
artClient = c | <mask> func (clients *clientsContainer) findMultiple(ids []string) (c *querylog.Client, err error) {
<mask> var emptyClient *querylog.Client
<mask>
<mask> for _, id := range ids {
<mask> ip := net.ParseIP(id)
<mask> disallowed, disallowedRule := clients.dnsServer.IsBlockedClient(ip, id)
<mask>
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
return c, nil | <mask>
<mask> continue
<mask> }
<mask>
<mask> return client, nil
<mask> }
<mask>
<mask> return emptyClient, nil
<mask> }
<mask>
</s> Pull request: querylog: fix panic
Merge in DNS/adguard-home from querylog-panic to master
Squashed commit of the following:
commit b7f2edd1d7dd91c0102b9cb4ea50c... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
return artClient, nil | <mask>
<mask> return client, nil
<mask> }
<mask>
<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(
</s> Pull request: querylog: fix panic
Merge ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
// 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( | <mask>
<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> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
) (c *querylog.Client, art bool) {
defer func() {
c.Disallowed, c.DisallowedRule = clients.dnsServer.IsBlockedClient(ip, id)
if c.WHOIS == nil {
c.WHOIS = &querylog.ClientWHOIS{}
}
}()
| <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 &que... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
Name: client.Name,
}, false | <mask> whois := &querylog.ClientWHOIS{}
<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> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
// Technically should never happen, but still.
return &querylog.Client{
Name: "",
}, true | <mask> }
<mask> }
<mask>
<mask> if ip == nil {
<mask> return nil
<mask> }
<mask>
<mask> var rc *RuntimeClient
<mask> rc, ok = clients.FindRuntimeClient(ip)
<mask> if ok {
</s> Pull request: querylog: fix panic
Merge in DNS/adguard-home from querylog-panic to master
Squashed commit of the follow... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
Name: rc.Host,
WHOIS: toQueryLogWHOIS(rc.WHOISInfo),
}, false | <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> }
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
Name: "",
}, true | <mask> }
<mask> }
<mask>
<mask> return &querylog.Client{
<mask> Name: "",
<mask> DisallowedRule: rule,
<mask> WHOIS: &querylog.ClientWHOIS{},
<mask> Disallowed: disallowed,
<mask> }
<mask> }
<mask>
<mask> func (clients *clientsContainer) Find(id string) (c *Client, ok b... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | internal/home/clients.go |
Persistent client's name or runtime client's hostname. May be
empty. | <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> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | openapi/openapi.yaml |
<mask> '$ref': '#/components/schemas/QueryLogItemClientWhois'
<mask> 'required':
<mask> - 'disallowed'
<mask> - 'disallowed_rule'
<mask> - 'ids'
<mask> - 'name'
<mask> - 'whois'
<mask> 'type': 'object'
<mask> 'QueryLogItemClientWhois':
<mask> 'desc... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9a1d3ec694e211bf1a44c27c1497ab043ab0b164 | openapi/openapi.yaml | |
"github.com/miekg/dns" | <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> * dnsfilt... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf | dnsfilter/dnsfilter.go |
func (d *Dnsfilter) CheckHost(host string, qtype uint16) (Result, error) { | <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... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf | dnsfilter/dnsfilter.go |
result, err := d.matchHost(host, qtype) | <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... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf | dnsfilter/dnsfilter.go |
func (d *Dnsfilter) matchHost(host string, qtype uint16) (Result, error) { | <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
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf | dnsfilter/dnsfilter.go |
log.Tracef("%d rules matched for host '%s'", len(rules), host)
| <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 = hostR... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf | dnsfilter/dnsfilter.go |
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 | <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())
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9ad4bba9aba286c88cbf26e0f57e72f6975713cf | dnsfilter/dnsfilter.go |
// done is the channel to sign closing the container.
done chan struct{}
| <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-... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
// 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" | <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> // NewHos... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
// w. paths shouldn't be empty and each of paths should locate either a file or | <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 m... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
return nil, ErrNoHostsPaths | <mask> ) (hc *HostsContainer, err error) {
<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)
<mask> if err != nil {
<mask> return ni... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
var patterns []string
patterns, err = pathsToPatterns(fsys, paths) | <mask> if len(paths) == 0 {
<mask> return nil, errNoPaths
<mask> }
<mask>
<mask> patterns, err := pathsToPatterns(fsys, paths)
<mask> if err != nil {
<mask> return nil, err
<mask> }
<mask>
<mask> hc = &HostsContainer{
</s> Pull request: 3845 hosts fatality
Merge in DNS/adguard-home from 3845-hos... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
} else if len(patterns) == 0 {
return nil, ErrNoHostsPaths | <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 DN... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
done: make(chan struct{}, 1), | <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/... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
if err = w.Add(p); err != nil {
if !errors.Is(err, fs.ErrNotExist) {
return nil, fmt.Errorf("adding path: %w", err)
} | <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> contin... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
log.Debug("%s: file %q expected to exist but doesn't", hostsContainerPref, p) | <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)
<mask> }
<mask>
</s> Pull request: 3845 hosts ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
<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>
<mask> return hc, nil
</s> Pull request: 3845 hosts fatality
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go | |
return hc.engine.MatchRequest(req) | <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> l... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
// Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil. | <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)
<mask>
<mask> return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContai... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
close(hc.done)
return nil | <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 t... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
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) | <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.Erro... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
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... | <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... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
//
// TODO(e.burkov): Accept a parameter to specify the files to refresh. | <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(h... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer.go |
<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... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go | |
wantErr error
name string
paths []string | <mask> p: &fstest.MapFile{Data: []byte("127.0.0.1 localhost")},
<mask> }
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> paths []string
<mask> wantErr error
<mask> wantPatterns []string
<mask> }{{
<mask> name: "one_file",
<mask> paths: []st... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go |
wantErr: nil,
name: "one_file",
paths: []string{p}, | <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",
<mask> paths: [... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go |
wantErr: ErrNoHostsPaths,
name: "no_files",
paths: []string{}, | <mask> paths: []string{p},
<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>... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go |
wantErr: ErrNoHostsPaths,
name: "non-existent_file",
paths: []string{path.Join(dirname, filename+"2")}, | <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> }, {
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go |
wantErr: nil,
name: "whole_dir",
paths: []string{dirname}, | <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, "*")},
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go |
OnClose: func() (err error) { panic("not implemented") }, | <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.N... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go |
<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... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go | |
<mask> })
<mask>
<mask> require.NotNil(t, hc)
<mask>
<mask> assert.Equal(t, tc.wantPatterns, hc.patterns)
<mask> assert.NotNil(t, <-hc.Upd())
<mask>
<mask> eventsCh <- struct{}{}
<mask> assert.Equal(t, uint32(1), atomic.LoadUint32(&eventsCalledCounter))
<mask> })
</s> Pull request: 384... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go | |
OnClose: func() (err error) { panic("not implemented") }, | <mask> assert.Equal(t, dirname, name)
<mask>
<mask> return nil
<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> P... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go |
<mask> }
<mask>
<mask> hc, err := NewHostsContainer(testFS, w, dirname)
<mask> require.NoError(t, err)
<mask> t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) })
<mask>
<mask> checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) {
<mask> upd, ok := <-hc.Upd()
<mask> require.Tr... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go | |
OnClose: func() (err error) { panic("not implemented") }, | <mask> assert.Equal(t, filename, name)
<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) })
<mask>
<mask> testCase := []struct {
</s> Pull request: 3... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go |
<mask> },
<mask> OnClose: fsWatcherOnCloseStub,
<mask> }, filename)
<mask> require.NoError(t, err)
<mask> t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) })
<mask>
<mask> testCase := []struct {
<mask> name string
<mask> want []interface{}
<mask> req urlfilter.DNSRequest
</s> Pu... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/9bac4b3db2416e05d5d6100e2815b806196fcc9b | internal/aghnet/hostscontainer_test.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.