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
// Filtering.
<mask> d.checkMatchEmpty(t, "yandex.ru") <mask> d.parentalServer = defaultParentalServer <mask> } <mask> <mask> // FILTERING <mask> <mask> const nl = "\n" <mask> <mask> const ( <mask> blockingRules = `||example.org^` + nl <mask> allowlistRules = `||example.org^` + nl + `@@||test.example.org` + nl <m...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
const nl = "\n" const ( blockingRules = `||example.org^` + nl allowlistRules = `||example.org^` + nl + `@@||test.example.org` + nl importantRules = `@@||example.org^` + nl + `||test.example.org^$important` + nl regexRules = `/example\.org/` + nl + `@@||test.example.org^` + nl maskRules = `test*.ex...
<mask> {"dnstype", dnstypeRules, "test.example.org", false, NotFilteredAllowList, dns.TypeAAAA}, <mask> } <mask> <mask> func TestMatching(t *testing.T) { <mask> for _, test := range tests { <mask> t.Run(fmt.Sprintf("%s-%s", test.testname, test.hostname), func(t *testing.T) { <mask> filters := []Filter{{ ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "k...
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
d := newForTest(nil, filters)
<mask> ` <mask> whiteFilters := []Filter{{ <mask> ID: 0, Data: []byte(whiteRules), <mask> }} <mask> d := NewForTest(nil, filters) <mask> d.SetFilters(filters, whiteFilters, false) <mask> defer d.Close() <mask> <mask> // matched by white filter <mask> res, err := d.CheckHost("host1", dns.TypeA, &sett...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
t.Cleanup(d.Close)
<mask> ID: 0, Data: []byte(whiteRules), <mask> }} <mask> d := NewForTest(nil, filters) <mask> d.SetFilters(filters, whiteFilters, false) <mask> defer d.Close() <mask> <mask> // matched by white filter <mask> res, err := d.CheckHost("host1", dns.TypeA, &setts) <mask> assert.Nil(t, err) <mask> assert...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
// Matched by white filter.
<mask> d := NewForTest(nil, filters) <mask> d.SetFilters(filters, whiteFilters, false) <mask> defer d.Close() <mask> <mask> // matched by white filter <mask> res, err := d.CheckHost("host1", dns.TypeA, &setts) <mask> assert.Nil(t, err) <mask> assert.False(t, res.IsFiltered) <mask> assert.Equal(t, res....
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
// Not matched by white filter, but matched by block filter.
<mask> if assert.Len(t, res.Rules, 1) { <mask> assert.Equal(t, "||host1^", res.Rules[0].Text) <mask> } <mask> <mask> // not matched by white filter, but matched by block filter <mask> res, err = d.CheckHost("host2", dns.TypeA, &setts) <mask> assert.Nil(t, err) <mask> assert.True(t, res.IsFiltered) <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
// Client Settings.
<mask> assert.Equal(t, "||host2^", res.Rules[0].Text) <mask> } <mask> } <mask> <mask> // CLIENT SETTINGS <mask> <mask> func applyClientSettings(setts *RequestFilteringSettings) { <mask> setts.FilteringEnabled = false <mask> setts.ParentalEnabled = false <mask> setts.SafeBrowsingEnabled = true </s> Pu...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
<mask> s.Rules = []*rules.NetworkRule{rule} <mask> setts.ServicesRules = append(setts.ServicesRules, s) <mask> } <mask> <mask> // Check behaviour without any per-client settings, <mask> // then apply per-client settings and check behaviour once again <mask> func TestClientSettings(t *testing.T) { <mask> va...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
d := newForTest( &Config{ ParentalEnabled: true, SafeBrowsingEnabled: false, }, []Filter{{ ID: 0, Data: []byte("||example.org^\n"), }}, ) t.Cleanup(d.Close) d.parentalUpstream = &testSbUpstream{ hostname: "pornhub.com", block: true, } d.safeBrowsingUpstream = &testSbUpstream{ hostnam...
<mask> <mask> // Check behaviour without any per-client settings, <mask> // then apply per-client settings and check behaviour once again <mask> func TestClientSettings(t *testing.T) { <mask> var r Result <mask> filters := []Filter{{ <mask> ID: 0, Data: []byte("||example.org^\n"), <mask> }} <mask> d :=...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
<mask> var r Result <mask> filters := []Filter{{ <mask> ID: 0, Data: []byte("||example.org^\n"), <mask> }} <mask> d := NewForTest(&Config{ParentalEnabled: true, SafeBrowsingEnabled: false}, filters) <mask> defer d.Close() <mask> <mask> // no client settings: <mask> <mask> // blocked by filters <ma...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
makeTester := func(tc testCase, before bool) func(t *testing.T) { return func(t *testing.T) { r, _ := d.CheckHost(tc.host, dns.TypeA, &setts) if before { assert.True(t, r.IsFiltered) assert.Equal(t, tc.wantReason, r.Reason) } else { assert.False(t, r.IsFiltered) } }
<mask> if !r.IsFiltered || r.Reason != FilteredBlockList { <mask> t.Fatalf("CheckHost FilteredBlockList") <mask> } <mask> <mask> // blocked by parental <mask> r, _ = d.CheckHost("pornhub.com", dns.TypeA, &setts) <mask> if !r.IsFiltered || r.Reason != FilteredParental { <mask> t.Fatalf("CheckHost Filte...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
// Check behaviour without any per-client settings, then apply per-client // settings and check behaviour once again. for _, tc := range testCases { t.Run(tc.name, makeTester(tc, tc.before))
<mask> if !r.IsFiltered || r.Reason != FilteredParental { <mask> t.Fatalf("CheckHost FilteredParental") <mask> } <mask> <mask> // safesearch is disabled <mask> r, _ = d.CheckHost("wmconvirus.narod.ru", dns.TypeA, &setts) <mask> if r.IsFiltered { <mask> t.Fatalf("CheckHost safesearch") <mask> } <mas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
<mask> if r.IsFiltered { <mask> t.Fatalf("CheckHost safesearch") <mask> } <mask> <mask> // not blocked <mask> r, _ = d.CheckHost("facebook.com", dns.TypeA, &setts) <mask> assert.False(t, r.IsFiltered) <mask> <mask> // override client settings: <mask> applyClientSettings(&setts) <mask> <mask> //...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
for _, tc := range testCases { t.Run(tc.name, makeTester(tc, !tc.before))
<mask> <mask> // override client settings: <mask> applyClientSettings(&setts) <mask> <mask> // override filtering settings <mask> r, _ = d.CheckHost("example.org", dns.TypeA, &setts) <mask> if r.IsFiltered { <mask> t.Fatalf("CheckHost") <mask> } <mask> <mask> // override parental settings (force ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "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/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
<mask> r, _ = d.CheckHost("wmconvirus.narod.ru", dns.TypeA, &setts) <mask> if !r.IsFiltered || r.Reason != FilteredSafeBrowsing { <mask> t.Fatalf("CheckHost FilteredSafeBrowsing") <mask> } <mask> <mask> // blocked by additional rules <mask> r, _ = d.CheckHost("facebook.com", dns.TypeA, &setts) <mask> a...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
// Benchmarks.
<mask> assert.True(t, r.IsFiltered) <mask> assert.Equal(t, r.Reason, FilteredBlockedService) <mask> } <mask> <mask> // BENCHMARKS <mask> <mask> func BenchmarkSafeBrowsing(b *testing.B) { <mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> for n := 0; n < b.N; n...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
d := newForTest(&Config{SafeBrowsingEnabled: true}, nil) b.Cleanup(d.Close) blocked := "wmconvirus.narod.ru" d.safeBrowsingUpstream = &testSbUpstream{ hostname: blocked, block: true, }
<mask> <mask> // BENCHMARKS <mask> <mask> func BenchmarkSafeBrowsing(b *testing.B) { <mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> for n := 0; n < b.N; n++ { <mask> hostname := "wmconvirus.narod.ru" <mask> res, err := d.CheckHost(hostname, dns.TypeA, &se...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
res, err := d.CheckHost(blocked, dns.TypeA, &setts) assert.Nilf(b, err, "Error while matching host %s: %s", blocked, err) assert.True(b, res.IsFiltered, "Expected hostname %s to match", blocked)
<mask> func BenchmarkSafeBrowsing(b *testing.B) { <mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> for n := 0; n < b.N; n++ { <mask> hostname := "wmconvirus.narod.ru" <mask> res, err := d.CheckHost(hostname, dns.TypeA, &setts) <mask> if err != nil { <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
d := newForTest(&Config{SafeBrowsingEnabled: true}, nil) b.Cleanup(d.Close) blocked := "wmconvirus.narod.ru" d.safeBrowsingUpstream = &testSbUpstream{ hostname: blocked, block: true, }
<mask> } <mask> } <mask> <mask> func BenchmarkSafeBrowsingParallel(b *testing.B) { <mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> b.RunParallel(func(pb *testing.PB) { <mask> for pb.Next() { <mask> hostname := "wmconvirus.narod.ru" <mask> res, err := ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
res, err := d.CheckHost(blocked, dns.TypeA, &setts) assert.Nilf(b, err, "Error while matching host %s: %s", blocked, err) assert.True(b, res.IsFiltered, "Expected hostname %s to match", blocked)
<mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> b.RunParallel(func(pb *testing.PB) { <mask> for pb.Next() { <mask> hostname := "wmconvirus.narod.ru" <mask> res, err := d.CheckHost(hostname, dns.TypeA, &setts) <mask> if err != nil { <mask> b.Errorf(...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
d := newForTest(&Config{SafeSearchEnabled: true}, nil) b.Cleanup(d.Close)
<mask> }) <mask> } <mask> <mask> func BenchmarkSafeSearch(b *testing.B) { <mask> d := NewForTest(&Config{SafeSearchEnabled: true}, nil) <mask> defer d.Close() <mask> for n := 0; n < b.N; n++ { <mask> val, ok := d.SafeSearchDomain("www.google.com") <mask> if !ok { <mask> b.Errorf("Expected safesear...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
assert.True(b, ok, "Expected safesearch to find result for www.google.com") assert.Equal(b, "forcesafesearch.google.com", val, "Expected safesearch for google.com to be forcesafesearch.google.com")
<mask> d := NewForTest(&Config{SafeSearchEnabled: true}, nil) <mask> defer d.Close() <mask> for n := 0; n < b.N; n++ { <mask> val, ok := d.SafeSearchDomain("www.google.com") <mask> if !ok { <mask> b.Errorf("Expected safesearch to find result for www.google.com") <mask> } <mask> if val != "forcesaf...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
d := newForTest(&Config{SafeSearchEnabled: true}, nil) b.Cleanup(d.Close)
<mask> } <mask> } <mask> <mask> func BenchmarkSafeSearchParallel(b *testing.B) { <mask> d := NewForTest(&Config{SafeSearchEnabled: true}, nil) <mask> defer d.Close() <mask> b.RunParallel(func(pb *testing.PB) { <mask> for pb.Next() { <mask> val, ok := d.SafeSearchDomain("www.google.com") <mask> if...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
assert.True(b, ok, "Expected safesearch to find result for www.google.com") assert.Equal(b, "forcesafesearch.google.com", val, "Expected safesearch for google.com to be forcesafesearch.google.com")
<mask> defer d.Close() <mask> b.RunParallel(func(pb *testing.PB) { <mask> for pb.Next() { <mask> val, ok := d.SafeSearchDomain("www.google.com") <mask> if !ok { <mask> b.Errorf("Expected safesearch to find result for www.google.com") <mask> } <mask> if val != "forcesafesearch.google.com" { ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsfilter_test.go
f := newForTest(nil, []Filter{{ID: 0, Data: []byte(text)}})
<mask> |disable-all^$dnsrewrite=127.0.0.2 <mask> @@||disable-all^$dnsrewrite <mask> ` <mask> <mask> f := NewForTest(nil, []Filter{{ID: 0, Data: []byte(text)}}) <mask> setts := &RequestFilteringSettings{ <mask> FilteringEnabled: true, <mask> } <mask> <mask> ipv4p1 := net.IPv4(127, 0, 0, 1) </s> Pull r...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/dnsrewrite_test.go
d := newForTest(nil, nil) t.Cleanup(d.Close)
<mask> "github.com/stretchr/testify/assert" <mask> ) <mask> <mask> func TestRewrites(t *testing.T) { <mask> d := DNSFilter{} <mask> // CNAME, A, AAAA <mask> d.Rewrites = []RewriteEntry{ <mask> {"somecname", "somehost.com", 0, nil}, <mask> {"somehost.com", "0.0.0.0", 0, nil}, <mask> </s> Pull reques...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/rewrites_test.go
d := newForTest(nil, nil) t.Cleanup(d.Close)
<mask> assert.True(t, r.IPList[0].Equal(net.IP{1, 2, 3, 4})) <mask> } <mask> <mask> func TestRewritesLevels(t *testing.T) { <mask> d := DNSFilter{} <mask> // exact host, wildcard L2, wildcard L3 <mask> d.Rewrites = []RewriteEntry{ <mask> {"host.com", "1.1.1.1", 0, nil}, <mask> {"*.host.com", "2.2.2.2"...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/rewrites_test.go
d := newForTest(nil, nil) t.Cleanup(d.Close)
<mask> assert.True(t, net.IP{3, 3, 3, 3}.Equal(r.IPList[0])) <mask> } <mask> <mask> func TestRewritesExceptionCNAME(t *testing.T) { <mask> d := DNSFilter{} <mask> // wildcard; exception for a sub-domain <mask> d.Rewrites = []RewriteEntry{ <mask> {"*.host.com", "2.2.2.2", 0, nil}, <mask> {"sub.host.com...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/rewrites_test.go
d := newForTest(nil, nil) t.Cleanup(d.Close)
<mask> assert.Equal(t, NotFilteredNotFound, r.Reason) <mask> } <mask> <mask> func TestRewritesExceptionWC(t *testing.T) { <mask> d := DNSFilter{} <mask> // wildcard; exception for a sub-wildcard <mask> d.Rewrites = []RewriteEntry{ <mask> {"*.host.com", "2.2.2.2", 0, nil}, <mask> {"*.sub.host.com", "*....
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/rewrites_test.go
d := newForTest(nil, nil) t.Cleanup(d.Close)
<mask> assert.Equal(t, NotFilteredNotFound, r.Reason) <mask> } <mask> <mask> func TestRewritesExceptionIP(t *testing.T) { <mask> d := DNSFilter{} <mask> // exception for AAAA record <mask> d.Rewrites = []RewriteEntry{ <mask> {"host.com", "1.2.3.4", 0, nil}, <mask> {"host.com", "AAAA", 0, nil}, <mask>...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/rewrites_test.go
"sync"
<mask> import ( <mask> "crypto/sha256" <mask> "encoding/hex" <mask> "strings" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/golibs/cache" <mask> "github.com/miekg/dns" <mask> "github.com/stretchr/testify/assert" </s> Pull request: ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safebrowsing_test.go
d := newForTest(&Config{SafeBrowsingEnabled: true}, nil) t.Cleanup(d.Close)
<mask> return "" <mask> } <mask> <mask> func TestSBPC_checkErrorUpstream(t *testing.T) { <mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> <mask> ups := &testErrUpstream{} <mask> <mask> d.safeBrowsingUpstream = ups <mask> d.parentalUpstream = ups </s> Pul...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safebrowsing_test.go
counterLock sync.RWMutex
<mask> type testSbUpstream struct { <mask> hostname string <mask> block bool <mask> requestsCount int <mask> } <mask> <mask> // Exchange returns a message depending on the upstream settings (hostname, block) <mask> func (u *testSbUpstream) Exchange(r *dns.Msg) (*dns.Msg, error) { <mask> u.cou...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safebrowsing_test.go
u.counterLock.Lock()
<mask> <mask> // Exchange returns a message depending on the upstream settings (hostname, block) <mask> func (u *testSbUpstream) Exchange(r *dns.Msg) (*dns.Msg, error) { <mask> u.requestsCount++ <mask> u.counterLock.Unlock() <mask> <mask> hash := sha256.Sum256([]byte(u.hostname)) </s> Pull request: 2574 ex...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safebrowsing_test.go
u.counterLock.Unlock()
<mask> // Exchange returns a message depending on the upstream settings (hostname, block) <mask> func (u *testSbUpstream) Exchange(r *dns.Msg) (*dns.Msg, error) { <mask> u.counterLock.Lock() <mask> u.requestsCount++ <mask> <mask> hash := sha256.Sum256([]byte(u.hostname)) <mask> prefix := hash[0:2] <mask> ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safebrowsing_test.go
d := newForTest(&Config{SafeBrowsingEnabled: true}, nil) t.Cleanup(d.Close)
<mask> return "" <mask> } <mask> <mask> func TestSBPC_sbValidResponse(t *testing.T) { <mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> <mask> ups := &testSbUpstream{} <mask> d.safeBrowsingUpstream = ups <mask> d.parentalUpstream = ups <mask> </s> Pull re...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safebrowsing_test.go
d := newForTest(&Config{SafeBrowsingEnabled: true}, nil) t.Cleanup(d.Close)
<mask> assert.Equal(t, 1, ups.requestsCount) <mask> } <mask> <mask> func TestSBPC_pcBlockedResponse(t *testing.T) { <mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> <mask> ups := &testSbUpstream{} <mask> d.safeBrowsingUpstream = ups <mask> d.parentalUpstrea...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safebrowsing_test.go
"context"
<mask> package dnsfilter <mask> <mask> import ( <mask> "bytes" <mask> "encoding/binary" <mask> "encoding/gob" <mask> "encoding/json" <mask> "fmt" </s> Pull request: 2574 external tests vol.1 Merge in DNS/adguard-home from 2574-external-tests to master Updates #2574. Squashed commit of the following: ...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safesearch.go
ipAddrs, err := d.resolver.LookupIPAddr(context.Background(), safeHost)
<mask> <mask> return res, nil <mask> } <mask> <mask> // TODO this address should be resolved with upstream that was configured in dnsforward <mask> ips, err := net.LookupIP(safeHost) <mask> if err != nil { <mask> log.Tracef("SafeSearchDomain for %s was found but failed to lookup for %s cause %s", host...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safesearch.go
for _, ipAddr := range ipAddrs { if ipv4 := ipAddr.IP.To4(); ipv4 != nil {
<mask> log.Tracef("SafeSearchDomain for %s was found but failed to lookup for %s cause %s", host, safeHost, err) <mask> return Result{}, err <mask> } <mask> <mask> for _, ip := range ips { <mask> if ipv4 := ip.To4(); ipv4 != nil { <mask> res.Rules[0].IP = ipv4 <mask> <mask> l := d.setCacheResul...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc
internal/dnsfilter/safesearch.go
// Init checks the configuration and initializes the server func (s *Server) Init(config ServerConfig) error { err := s.setConfig(config) if err != nil { return err
<mask> } <mask> log.Info("Available network interfaces: %s", buf.String()) <mask> } <mask> <mask> // Start will listen on port 67 and serve DHCP requests. <mask> // Even though config can be nil, it is not optional (at least for now), since there are no default values (yet). <mask> func (s *Server) Start(conf...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
s.dbLoad() return nil } func (s *Server) setConfig(config ServerConfig) error { s.ServerConfig = config
<mask> if err != nil { <mask> return err <mask> } <mask> <mask> iface, err := net.InterfaceByName(s.InterfaceName) <mask> if err != nil { <mask> printInterfaces() <mask> return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName) <mask> } </s> * dhcpd: move code from Start() to...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
<mask> } <mask> <mask> iface, err := net.InterfaceByName(s.InterfaceName) <mask> if err != nil { <mask> s.closeConn() // in case it was already started <mask> printInterfaces() <mask> return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName) <mask> } <mask> <mask> // get ipv...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
<mask> <mask> // get ipv4 address of an interface <mask> s.ipnet = getIfaceIPv4(iface) <mask> if s.ipnet == nil { <mask> s.closeConn() // in case it was already started <mask> return wrapErrPrint(err, "Couldn't find IPv4 address of interface %s %+v", s.InterfaceName, iface) <mask> } <mask> <mask> if...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
<mask> } <mask> <mask> s.leaseStart, err = parseIPv4(s.RangeStart) <mask> if err != nil { <mask> <mask> s.closeConn() // in case it was already started <mask> return wrapErrPrint(err, "Failed to parse range start address %s", s.RangeStart) <mask> } <mask> <mask> s.leaseStop, err = parseIPv4(s.Rang...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
<mask> } <mask> <mask> s.leaseStop, err = parseIPv4(s.RangeEnd) <mask> if err != nil { <mask> s.closeConn() // in case it was already started <mask> return wrapErrPrint(err, "Failed to parse range end address %s", s.RangeEnd) <mask> } <mask> <mask> subnet, err := parseIPv4(s.SubnetMask) <mask> if ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
<mask> } <mask> <mask> subnet, err := parseIPv4(s.SubnetMask) <mask> if err != nil { <mask> s.closeConn() // in case it was already started <mask> return wrapErrPrint(err, "Failed to parse subnet mask %s", s.SubnetMask) <mask> } <mask> <mask> // if !bytes.Equal(subnet, s.ipnet.Mask) { <mask> // s...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
<mask> return wrapErrPrint(err, "Failed to parse subnet mask %s", s.SubnetMask) <mask> } <mask> <mask> // if !bytes.Equal(subnet, s.ipnet.Mask) { <mask> // s.closeConn() // in case it was already started <mask> // return wrapErrPrint(err, "specified subnet mask %s does not meatch interface %s subnet mask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
<mask> // } <mask> <mask> router, err := parseIPv4(s.GatewayIP) <mask> if err != nil { <mask> s.closeConn() // in case it was already started <mask> return wrapErrPrint(err, "Failed to parse gateway IP %s", s.GatewayIP) <mask> } <mask> <mask> s.leaseOptions = dhcp4.Options{ <mask> dhcp4.OptionSub...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
return nil } // Start will listen on port 67 and serve DHCP requests. func (s *Server) Start() error {
<mask> } <mask> <mask> // TODO: don't close if interface and addresses are the same <mask> if s.conn != nil { <mask> s.closeConn() <mask> } <mask> <mask> iface, err := net.InterfaceByName(s.InterfaceName) </s> * dhcpd: move code from Start() to Init() </s> remove // Start will listen on port 67 and se...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
iface, err := net.InterfaceByName(s.InterfaceName) if err != nil { return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName) }
<mask> if s.conn != nil { <mask> s.closeConn() <mask> } <mask> <mask> s.dbLoad() <mask> <mask> c, err := newFilterConn(*iface, ":67") // it has to be bound to 0.0.0.0:67, otherwise it won't see DHCP discover/request packets <mask> if err != nil { <mask> return wrapErrPrint(err, "Couldn't start liste...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca
dhcpd/dhcpd.go
if question == nil { return } q, err = question.Pack() if err != nil { log.Printf("failed to pack question for querylog: %s", err) return
<mask> var a []byte <mask> var err error <mask> ip := getIPString(addr) <mask> <mask> if question != nil { <mask> q, err = question.Pack() <mask> if err != nil { <mask> log.Printf("failed to pack question for querylog: %s", err) <mask> return <mask> } <mask> } <mask> <mask> if answer !=...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8
querylog/qlog.go
if len(entry.Question) == 0 { continue } q = new(dns.Msg) if err := q.Unpack(entry.Question); err != nil { log.Tracef("q.Unpack(): %s", err) continue
<mask> entry := entries[i] <mask> var q *dns.Msg <mask> var a *dns.Msg <mask> <mask> if len(entry.Question) > 0 { <mask> q = new(dns.Msg) <mask> if err := q.Unpack(entry.Question); err != nil { <mask> // ignore, log and move on <mask> log.Printf("Failed to unpack dns message question: %s...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8
querylog/qlog.go
if len(q.Question) != 1 { log.Tracef("len(q.Question) != 1") continue }
<mask> if err := q.Unpack(entry.Question); err != nil { <mask> log.Tracef("q.Unpack(): %s", err) <mask> continue <mask> } <mask> if len(entry.Answer) > 0 { <mask> a = new(dns.Msg) <mask> if err := a.Unpack(entry.Answer); err != nil { <mask> log.Debug("Failed to unpack dns message answer: %...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8
querylog/qlog.go
log.Debug("Failed to unpack dns message answer: %s", err)
<mask> } <mask> if len(entry.Answer) > 0 { <mask> a = new(dns.Msg) <mask> if err := a.Unpack(entry.Answer); err != nil { <mask> // ignore, log and move on <mask> log.Printf("Failed to unpack dns message question: %s", err) <mask> a = nil <mask> } <mask> } <mask> <mask> jsonEntry...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8
querylog/qlog.go
jsonEntry["question"] = map[string]interface{}{ "host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")), "type": dns.Type(q.Question[0].Qtype).String(), "class": dns.Class(q.Question[0].Qclass).String(),
<mask> "elapsedMs": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64), <mask> "time": entry.Time.Format(time.RFC3339Nano), <mask> "client": entry.IP, <mask> } <mask> if q != nil { <mask> jsonEntry["question"] = map[string]interface{}{ <mask> "host": strings.ToLower(strin...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8
querylog/qlog.go
"net"
<mask> import ( <mask> "encoding/json" <mask> "fmt" <mask> "io/ioutil" <mask> "net/http" <mask> "net/url" <mask> "os" <mask> "strings" <mask> "time" </s> + GET /filtering/check_host: Check if host name is filtered </s> remove version: '0.99.3' </s> add version: '0.101' </s> remove httpRegist...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445
home/control_filtering.go
"github.com/miekg/dns"
<mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // IsValidURL - return TRUE if URL is valid <mask> func IsValidURL(rawurl string) bool { <mask> url, err := url.ParseRequestURI(rawurl) </s> + GET /filtering/check_host: Check if host name is filtered...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445
home/control_filtering.go
httpRegister("GET", "/control/filtering/status", handleFilteringStatus) httpRegister("POST", "/control/filtering/config", handleFilteringConfig) httpRegister("POST", "/control/filtering/add_url", handleFilteringAddURL) httpRegister("POST", "/control/filtering/remove_url", handleFilteringRemoveURL) httpRegister("PO...
<mask> } <mask> <mask> // RegisterFilteringHandlers - register handlers <mask> func RegisterFilteringHandlers() { <mask> httpRegister(http.MethodGet, "/control/filtering/status", handleFilteringStatus) <mask> httpRegister(http.MethodPost, "/control/filtering/config", handleFilteringConfig) <mask> httpRegiste...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445
home/control_filtering.go
version: '0.101'
<mask> swagger: '2.0' <mask> info: <mask> title: 'AdGuard Home' <mask> description: 'AdGuard Home REST API. Admin web interface is built on top of this REST API.' <mask> version: '0.99.3' <mask> schemes: <mask> - http <mask> basePath: /control <mask> produces: <mask> - application/json </...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445
openapi/openapi.yaml
/filtering/check_host: get: tags: - filtering operationId: filteringCheckHost summary: 'Check if host name is filtered' parameters: - name: name in: query type: string responses: ...
<mask> description: OK <mask> <mask> # -------------------------------------------------- <mask> # Safebrowsing methods <mask> # -------------------------------------------------- <mask> <mask> /safebrowsing/enable: </s> + GET /filtering/check_host: Check if host name is fi...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445
openapi/openapi.yaml
- "ReasonRewrite"
<mask> - "FilteredParental" <mask> - "FilteredInvalid" <mask> - "FilteredSafeSearch" <mask> - "FilteredBlockedService" <mask> service_name: <mask> type: "string" <mask> description: "Set if reason=Filtered...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445
openapi/openapi.yaml
var clientObjects []clientObject
<mask> func (clients *clientsContainer) WriteDiskConfig(objects *[]clientObject) { <mask> clients.lock.Lock() <mask> defer clients.lock.Unlock() <mask> <mask> clientObjects := []clientObject{} <mask> for _, cli := range clients.list { <mask> cy := clientObject{ <mask> Name: cli.Nam...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e1015a4ee7f4101ef21cb2b2688beb50a11dc83
internal/home/clients.go
cliObj := clientObject{
<mask> defer clients.lock.Unlock() <mask> <mask> clientObjects := []clientObject{} <mask> for _, cli := range clients.list { <mask> cy := clientObject{ <mask> Name: cli.Name, <mask> UseGlobalSettings: !cli.UseOwnSettings, <mask> FilteringEnabled: cli.FilteringEn...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e1015a4ee7f4101ef21cb2b2688beb50a11dc83
internal/home/clients.go
cliObj.Tags = stringutil.CloneSlice(cli.Tags) cliObj.IDs = stringutil.CloneSlice(cli.IDs) cliObj.BlockedServices = stringutil.CloneSlice(cli.BlockedServices) cliObj.Upstreams = stringutil.CloneSlice(cli.Upstreams)
<mask> SafeBrowsingEnabled: cli.SafeBrowsingEnabled, <mask> UseGlobalBlockedServices: !cli.UseOwnBlockedServices, <mask> } <mask> <mask> cy.Tags = stringutil.CloneSlice(cli.Tags) <mask> cy.IDs = stringutil.CloneSlice(cli.IDs) <mask> cy.BlockedServices = stringutil.CloneSlice(cli.BlockedServic...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e1015a4ee7f4101ef21cb2b2688beb50a11dc83
internal/home/clients.go
clientObjects = append(clientObjects, cliObj)
<mask> cy.IDs = stringutil.CloneSlice(cli.IDs) <mask> cy.BlockedServices = stringutil.CloneSlice(cli.BlockedServices) <mask> cy.Upstreams = stringutil.CloneSlice(cli.Upstreams) <mask> <mask> clientObjects = append(clientObjects, cy) <mask> } <mask> <mask> // Maps aren't guaranteed to iterate in the ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e1015a4ee7f4101ef21cb2b2688beb50a11dc83
internal/home/clients.go
// above loop can generate different orderings when writing to the config // file: this produces lots of diffs in config files, so sort objects by // name before writing.
<mask> clientObjects = append(clientObjects, cy) <mask> } <mask> <mask> // Maps aren't guaranteed to iterate in the same order each time, so the <mask> // above loop can generate different orderings when writing to the <mask> // config file: this produces lots of diffs in config files, so sort <mask> // ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e1015a4ee7f4101ef21cb2b2688beb50a11dc83
internal/home/clients.go
<mask> <mask> // configure log level and output <mask> configureLogger(args) <mask> <mask> // Go memory hacks <mask> memoryUsage(args) <mask> <mask> // Print the first message after logger is configured. <mask> log.Println(version.Full()) <mask> log.Debug("current working directory is %s", Context.w...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/home.go
"github.com/AdguardTeam/golibs/log"
<mask> "strconv" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/version" <mask> ) <mask> <mask> // options passed from command-line arguments <mask> type options struct { </s> Pull request: 4437 depr memory opt Merge in DNS/adguard-home from 4437-rm-mem-opt to master Updates #4437. Updates #20...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options.go
<mask> <mask> // runningAsService flag is set to true when options are passed from the service runner <mask> runningAsService bool <mask> <mask> // disableMemoryOptimization - disables memory optimization hacks <mask> // see memoryUsage() function for the details <mask> disableMemoryOptimization bool <ma...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options.go
nil, nil, func(_ options, _ string) (f effect, err error) { log.Info("warning: using --no-mem-optimization flag has no effect and is deprecated") return nil, nil }, func(o options) []string { return nil },
<mask> <mask> var disableMemoryOptimizationArg = arg{ <mask> "Disable memory optimization.", <mask> "no-mem-optimization", "", <mask> nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil, <mask> func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimi...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options.go
// TODO(e.burkov): Remove after v0.108.0.
<mask> assert.False(t, testParseOK(t).disableUpdate, "empty is not disable update") <mask> assert.True(t, testParseOK(t, "--no-check-update").disableUpdate, "--no-check-update is disable update") <mask> } <mask> <mask> func TestParseDisableMemoryOptimization(t *testing.T) { <mask> o, eff, err := parse("", []s...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options_test.go
o, eff, err := parse("", []string{"--no-mem-optimization"}) require.NoError(t, err) assert.Nil(t, eff) assert.Zero(t, o)
<mask> assert.True(t, testParseOK(t, "--no-check-update").disableUpdate, "--no-check-update is disable update") <mask> } <mask> <mask> func TestParseDisableMemoryOptimization(t *testing.T) { <mask> assert.False(t, testParseOK(t).disableMemoryOptimization, "empty is not disable update") <mask> assert.True(t, t...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options_test.go
<mask> testParseErr(t, "unknown dash", "-") <mask> } <mask> <mask> func TestSerialize(t *testing.T) { <mask> const reportFmt = "expected %s but got %s" <mask> <mask> testCases := []struct { <mask> name string <mask> opts options <mask> ss []string <mask> }{{ </s> Pull request: 4437 depr memory...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options_test.go
<mask> }, { <mask> name: "glinet_mode", <mask> opts: options{glinetMode: true}, <mask> ss: []string{"--glinet"}, <mask> }, { <mask> name: "disable_mem_opt", <mask> opts: options{disableMemoryOptimization: true}, <mask> ss: []string{"--no-mem-optimization"}, <mask> }, { <mask> name: "multi...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options_test.go
serviceControlAction: "run", configFilename: "config", workDir: "work", pidFile: "pid", disableUpdate: true,
<mask> ss: []string{"--no-mem-optimization"}, <mask> }, { <mask> name: "multiple", <mask> opts: options{ <mask> serviceControlAction: "run", <mask> configFilename: "config", <mask> workDir: "work", <mask> pidFile: "pid", <mask> disable...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options_test.go
<mask> "-w", "work", <mask> "-s", "run", <mask> "--pidfile", "pid", <mask> "--no-check-update", <mask> "--no-mem-optimization", <mask> }, <mask> }} <mask> <mask> for _, tc := range testCases { <mask> t.Run(tc.name, func(t *testing.T) { </s> Pull request: 4437 depr memory opt Merge in D...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options_test.go
assert.ElementsMatch(t, tc.ss, result)
<mask> <mask> for _, tc := range testCases { <mask> t.Run(tc.name, func(t *testing.T) { <mask> result := serialize(tc.opts) <mask> require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result) <mask> <mask> for i, r := range result { <mask> assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, resul...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab
internal/home/options_test.go
# Ignore everything except for explicitly allowed stuff. * !dist/docker
<mask> .DS_Store <mask> /.git <mask> /.github <mask> /.vscode <mask> .idea <mask> /AdGuardHome <mask> /AdGuardHome.exe <mask> /AdGuardHome.yaml <mask> /AdGuardHome.log <mask> /data <mask> /build <mask> /build2 <mask> /dist <mask> /client/node_modules <mask> /client2/node_modules <mask> /.gitattributes ...
[ "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "rep...
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.dockerignore
'run': 'make VERBOSE=1 ci'
<mask> 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" <mask> 'restore-keys': '${{ runner.os }}-node-' <mask> - 'name': 'Run make ci' <mask> 'shell': 'bash' <mask> 'run': 'make ci' <mask> - 'name': 'Upload coverage' <mask> 'uses': 'codecov/cod...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/build.yml
'build-release':
<mask> 'if': "success() && matrix.os == 'ubuntu-latest'" <mask> 'with': <mask> 'token': '${{ secrets.CODECOV_TOKEN }}' <mask> 'file': './coverage.txt' <mask> 'app': <mask> 'runs-on': 'ubuntu-latest' <mask> 'needs': 'test' <mask> 'steps': <mask> - 'name': 'Checkout'...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/build.yml
<mask> 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" <mask> 'restore-keys': '${{ runner.os }}-node-' <mask> - 'name': 'Set up Snapcraft' <mask> 'run': 'sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft' <mask> - 'name': 'Set...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/build.yml
- 'name': 'Run snapshot build' 'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker'
<mask> - 'name': 'Set up QEMU' <mask> 'uses': 'docker/setup-qemu-action@v1' <mask> - 'name': 'Set up Docker Buildx' <mask> 'uses': 'docker/setup-buildx-action@v1' <mask> - 'name': 'Docker Buildx (build)' <mask> 'run': 'make docker-multi-arch' <mask> <mask> 'notify': <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/build.yml
- 'build-release'
<mask> 'run': 'make docker-multi-arch' <mask> <mask> 'notify': <mask> 'needs': <mask> - 'app' <mask> - 'docker' <mask> # Secrets are not passed to workflows that are triggered by a pull request <mask> # from a fork. <mask> # <mask> # Use always() to signal to the runner th...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/build.yml
'fields': 'repo, message, commit, author, workflow'
<mask> - 'name': 'Send Slack notif' <mask> 'uses': '8398a7/action-slack@v3' <mask> 'with': <mask> 'status': '${{ env.WORKFLOW_CONCLUSION }}' <mask> 'fields': 'repo, message, commit, author, job' <mask> 'env': <mask> 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' <mas...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/build.yml
make go-deps go-tools go-lint
<mask> 'steps': <mask> - 'uses': 'actions/checkout@v2' <mask> - 'name': 'run-lint' <mask> 'run': > <mask> make go-install-tools go-lint <mask> 'eslint': <mask> 'runs-on': 'ubuntu-latest' <mask> 'steps': <mask> - 'uses': 'actions/checkout@v2' <mask> - 'name': 'Instal...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/lint.yml
'run': 'npm --prefix="./client" ci'
<mask> 'runs-on': 'ubuntu-latest' <mask> 'steps': <mask> - 'uses': 'actions/checkout@v2' <mask> - 'name': 'Install modules' <mask> 'run': 'npm --prefix client ci' <mask> - 'name': 'Run ESLint' <mask> 'run': 'npm --prefix client run lint' <mask> 'notify': <mask> 'needs': <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/lint.yml
'run': 'npm --prefix="./client" run lint'
<mask> - 'uses': 'actions/checkout@v2' <mask> - 'name': 'Install modules' <mask> 'run': 'npm --prefix client ci' <mask> - 'name': 'Run ESLint' <mask> 'run': 'npm --prefix client run lint' <mask> 'notify': <mask> 'needs': <mask> - 'go-lint' <mask> - 'eslint' <mask> # S...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/lint.yml
'fields': 'repo, message, commit, author, workflow'
<mask> - 'name': 'Send Slack notif' <mask> 'uses': '8398a7/action-slack@v3' <mask> 'with': <mask> 'status': '${{ env.WORKFLOW_CONCLUSION }}' <mask> 'fields': 'repo, message, commit, author, job' <mask> 'env': <mask> 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' <mas...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
.github/workflows/lint.yml
# See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html. .POSIX: CHANNEL = development CLIENT_BETA_DIR = client2 CLIENT_DIR = client COMMIT = $$(git rev-parse --short HEAD) DIST_DIR = dist GO = go # TODO(a.garipov): Add more default proxies using pipes after update to # Go 1.15.
<mask> # <mask> # Available targets <mask> # <mask> # * build -- builds AdGuardHome for the current platform <mask> # * client -- builds client-side code of AdGuard Home <mask> # * client-watch -- builds client-side code of AdGuard Home and watches for changes there <mask> # * docker -- builds a docker image for...
[ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
Makefile
# GOPROXY = https://goproxy.io|https://goproxy.cn|direct GOPROXY = https://goproxy.cn,https://goproxy.io,direct GPG_KEY_PASSPHRASE = not-a-real-password NPM = npm NPM_FLAGS = --prefix $(CLIENT_DIR) SIGN = 1 VERBOSE = 0 VERSION = v0.0.0 YARN = yarn YARN_FLAGS = --cwd $(CLIENT_BETA_DIR) ENV = env\ COMMIT='$(COMMIT)'\ ...
<mask> # <mask> # Available targets <mask> # <mask> # * build -- builds AdGuardHome for the current platform <mask> # * client -- builds client-side code of AdGuard Home <mask> # * client-watch -- builds client-side code of AdGuard Home and watches for changes there <mask> # * docker -- builds a docker image for...
[ "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", ...
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
Makefile
<mask> @echo Now you can run the docker image: <mask> @echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME) <mask> <mask> lint: js-lint go-lint <mask> <mask> js-lint: dependencies <mask> npm --prefix client run lint ...
[ "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/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
Makefile
$(NPM) $(NPM_FLAGS) run test
<mask> <mask> test: js-test go-test <mask> <mask> js-test: <mask> npm run test --prefix client <mask> <mask> go-test: <mask> $(GO) test $(TEST_FLAGS) --coverprofile coverage.txt ./... <mask> <mask> ci: client_with_deps <mask> $(GO) mod download <mask> $(MAKE) test <mask> </s> Pull request: all: a...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
Makefile
go-build: ; $(ENV) "$(SHELL)" ./scripts/make/go-build.sh go-deps: ; $(ENV) "$(SHELL)" ./scripts/make/go-deps.sh go-lint: ; $(ENV) "$(SHELL)" ./scripts/make/go-lint.sh go-test: ; $(ENV) "$(SHELL)" ./scripts/make/go-test.sh go-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-tools.sh
<mask> <mask> go-test: <mask> $(GO) test $(TEST_FLAGS) --coverprofile coverage.txt ./... <mask> <mask> ci: client_with_deps <mask> $(GO) mod download <mask> $(MAKE) test <mask> <mask> dependencies: <mask> npm --prefix client ci <mask> yarn --cwd client2 install <mask> $(GO) mod download </s> Pull ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
Makefile
# TODO(a.garipov): Remove the legacy targets once the build # infrastructure stops using them.
<mask> go-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-tools.sh <mask> <mask> dependencies: <mask> @ echo "use make deps instead" <mask> @ $(MAKE) deps <mask> docker-multi-arch: <mask> @ echo "use make build-docker instead" </s> Pull request: all: add a new Makefile and scripts, remove goreleaaser Merge in...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
Makefile
@ echo "use make deps instead" @ $(MAKE) deps
<mask> $(GO) mod download <mask> $(MAKE) test <mask> <mask> dependencies: <mask> npm --prefix client ci <mask> yarn --cwd client2 install <mask> $(GO) mod download <mask> <mask> clean: <mask> rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt <mask> rm -f -r ./build/ ./client/node_modules/ ./data/...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
Makefile
@ echo "use make build-docker instead" @ $(MAKE) build-docker go-install-tools: @ echo "use make go-tools instead" @ $(MAKE) go-tools release: @ echo "use make build-release instead" @ $(MAKE) build-release
<mask> env PATH="$(GOPATH)/bin:$$PATH" packr clean <mask> rm -f -r ./bin/ <mask> <mask> docker-multi-arch: <mask> DOCKER_CLI_EXPERIMENTAL=enabled \ <mask> docker buildx build \ <mask> --platform $(DOCKER_PLATFORMS) \ <mask> --build-arg VERSION=$(VERSION) \ <mask> --build-arg CHANNEL=$(CHANNEL) \ <mask...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
Makefile
<mask> //go:generate go install -v github.com/gobuffalo/packr/packr <mask> //go:generate packr clean <mask> //go:generate packr -z <mask> package main <mask> <mask> import ( </s> Pull request: all: add a new Makefile and scripts, remove goreleaaser Merge in DNS/adguard-home from 2276-releases to master Update...
[ "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
main.go
<mask> // goarm is the GOARM value. It is set by the linker. <mask> var goarm = "" <mask> <mask> // gomips is the GOMIPS value. It is set by the linker. <mask> // <mask> // TODO(a.garipov): Implement. <mask> var gomips = "" <mask> <mask> func main() { <mask> home.Main(version, channel, goarm, gomips) <m...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5
main.go
"access_settings_saved": "Access settings successfully saved", "updates_checked": "Updates successfully checked", "check_updates_now": "Check updates now"
<mask> "access_disallowed_title": "Disallowed clients", <mask> "access_disallowed_desc": "A list of CIDR or IP addresses. If configured, AdGuard Home will drop requests from these IP addresses.", <mask> "access_blocked_title": "Blocked domains", <mask> "access_blocked_desc": "Don't confuse this with...
[ "keep", "keep", "keep", "keep", "replace", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7
client/src/__locales/en.json