docstring_tokens stringlengths 18 16.9k | code_tokens stringlengths 75 1.81M | html_url stringlengths 74 116 | file_name stringlengths 3 311 |
|---|---|---|---|
keep add keep keep keep keep keep keep | <mask>
<mask> topClients := s.GetTopClientsIP(2)
<mask> assert.True(t, net.IP{127, 0, 0, 1}.Equal(topClients[0]))
<mask> }
<mask>
<mask> func TestLargeNumbers(t *testing.T) {
<mask> var hour int32 = 0
<mask> newID := func() uint32 {
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove
s.clear()
s.Close()
</s> add </s> remove var hour int32 = 1
</s> add var hour int32 = 0 </s> remove // use "atomic" to make Go race detector happy
</s> add // Use "atomic" to make go race detector happy. </s> remove // Check if we are notified about changes
ips = ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
</s> add t.Run("notified", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
require.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
}) </s> remove func TestIP(t *testing.T) {
assert.True(t, net.IP{127, 0, 0, 1}.Equal(DNSUnreverseAddr("1.0.0.127.in-addr.arpa")))
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Nil(t, DNSUnreverseAddr("1.0.0.127.in-addr.arpa."))
assert.Nil(t, DNSUnreverseAddr(".0.0.127.in-addr.arpa"))
assert.Nil(t, DNSUnreverseAddr(".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
</s> add func TestDNSReverseAddr(t *testing.T) {
testCases := []struct {
name string
have string
want net.IP
}{{
name: "good_ipv4",
have: "1.0.0.127.in-addr.arpa",
want: net.IP{127, 0, 0, 1},
}, {
name: "good_ipv6",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "good_ipv6_case",
have: "4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "bad_ipv4_dot",
have: "1.0.0.127.in-addr.arpa.",
}, {
name: "wrong_ipv4",
have: ".0.0.127.in-addr.arpa",
}, {
name: "wrong_ipv6",
have: ".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}, {
name: "bad_ipv6_dot",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa",
}, {
name: "bad_ipv6_space",
have: "4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
ip := DNSUnreverseAddr(tc.have)
assert.True(t, tc.want.Equal(ip))
})
} </s> remove s, _ := createObject(conf)
e := Entry{}
n := 1000 // number of distinct clients and domains every hour
for h := 0; h != 12; h++ {
if h != 0 {
atomic.AddInt32(&hour, 1)
}
for i := 0; i != n; i++ {
e.Domain = fmt.Sprintf("domain%d", i)
ip := net.IP{127, 0, 0, 1}
ip[2] = byte((i & 0xff00) >> 8)
ip[3] = byte(i & 0xff)
e.Client = ip.String()
e.Result = RNotFiltered
e.Time = 123456
s.Update(e)
</s> add // Number of distinct clients and domains every hour.
const n = 1000
for h := 0; h < 12; h++ {
atomic.AddInt32(&hour, 1)
for i := 0; i < n; i++ {
s.Update(Entry{
Domain: fmt.Sprintf("domain%d", i),
Client: net.IP{
127,
0,
byte((i & 0xff00) >> 8),
byte(i & 0xff),
}.String(),
Result: RNotFiltered,
Time: 123456,
}) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/stats_test.go |
keep keep keep keep replace replace replace keep keep keep replace keep | <mask> assert.EqualValues(t, 0.123456, d.AvgProcessingTime)
<mask>
<mask> topClients := s.GetTopClientsIP(2)
<mask> assert.True(t, net.IP{127, 0, 0, 1}.Equal(topClients[0]))
<mask>
<mask> s.clear()
<mask> s.Close()
<mask> }
<mask>
<mask> func TestLargeNumbers(t *testing.T) {
<mask> var hour int32 = 1
<mask> newID := func() uint32 {
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> add require.NotEmpty(t, topClients) </s> remove // use "atomic" to make Go race detector happy
</s> add // Use "atomic" to make go race detector happy. </s> remove // Check if we are notified about changes
ips = ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
</s> add t.Run("notified", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
require.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
}) </s> remove func TestIP(t *testing.T) {
assert.True(t, net.IP{127, 0, 0, 1}.Equal(DNSUnreverseAddr("1.0.0.127.in-addr.arpa")))
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Nil(t, DNSUnreverseAddr("1.0.0.127.in-addr.arpa."))
assert.Nil(t, DNSUnreverseAddr(".0.0.127.in-addr.arpa"))
assert.Nil(t, DNSUnreverseAddr(".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
</s> add func TestDNSReverseAddr(t *testing.T) {
testCases := []struct {
name string
have string
want net.IP
}{{
name: "good_ipv4",
have: "1.0.0.127.in-addr.arpa",
want: net.IP{127, 0, 0, 1},
}, {
name: "good_ipv6",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "good_ipv6_case",
have: "4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "bad_ipv4_dot",
have: "1.0.0.127.in-addr.arpa.",
}, {
name: "wrong_ipv4",
have: ".0.0.127.in-addr.arpa",
}, {
name: "wrong_ipv6",
have: ".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}, {
name: "bad_ipv6_dot",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa",
}, {
name: "bad_ipv6_space",
have: "4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
ip := DNSUnreverseAddr(tc.have)
assert.True(t, tc.want.Equal(ip))
})
} </s> remove s, _ := createObject(conf)
e := Entry{}
n := 1000 // number of distinct clients and domains every hour
for h := 0; h != 12; h++ {
if h != 0 {
atomic.AddInt32(&hour, 1)
}
for i := 0; i != n; i++ {
e.Domain = fmt.Sprintf("domain%d", i)
ip := net.IP{127, 0, 0, 1}
ip[2] = byte((i & 0xff00) >> 8)
ip[3] = byte(i & 0xff)
e.Client = ip.String()
e.Result = RNotFiltered
e.Time = 123456
s.Update(e)
</s> add // Number of distinct clients and domains every hour.
const n = 1000
for h := 0; h < 12; h++ {
atomic.AddInt32(&hour, 1)
for i := 0; i < n; i++ {
s.Update(Entry{
Domain: fmt.Sprintf("domain%d", i),
Client: net.IP{
127,
0,
byte((i & 0xff00) >> 8),
byte(i & 0xff),
}.String(),
Result: RNotFiltered,
Time: 123456,
}) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/stats_test.go |
keep keep replace keep keep keep replace keep keep keep keep | <mask> var hour int32 = 1
<mask> newID := func() uint32 {
<mask> // use "atomic" to make Go race detector happy
<mask> return uint32(atomic.LoadInt32(&hour))
<mask> }
<mask>
<mask> // log.SetLevel(log.DEBUG)
<mask> conf := Config{
<mask> Filename: "./stats.db",
<mask> LimitDays: 1,
<mask> UnitID: newID,
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove var hour int32 = 1
</s> add var hour int32 = 0 </s> add s, err := createObject(conf)
require.Nil(t, err) </s> remove
s.clear()
s.Close()
</s> add </s> add s, err := createObject(conf)
require.Nil(t, err) </s> add require.NotEmpty(t, topClients) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/stats_test.go |
keep keep keep add keep keep keep keep keep | <mask> Filename: "./stats.db",
<mask> LimitDays: 1,
<mask> UnitID: newID,
<mask> }
<mask> t.Cleanup(func() {
<mask> s.Close()
<mask> assert.Nil(t, os.Remove(conf.Filename))
<mask> })
<mask>
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> add s, err := createObject(conf)
require.Nil(t, err) </s> remove // log.SetLevel(log.DEBUG)
</s> add </s> add s.clear()
s.Close() </s> add s.Close() </s> remove f, err := ioutil.TempFile(prepareTestDir(t), "*.txt")
</s> add f, err := ioutil.TempFile(aghtest.PrepareTestDir(t), "*.txt") </s> remove func prepareTestDir() string {
const dir = "./agh-test"
_ = os.RemoveAll(dir)
_ = os.MkdirAll(dir, 0o755)
return dir
</s> add func prepareTestFile(t *testing.T) (f *os.File) {
t.Helper()
dir := aghtest.PrepareTestDir(t)
f, err := ioutil.TempFile(dir, "")
require.Nil(t, err)
require.NotNil(t, f)
t.Cleanup(func() {
assert.Nil(t, f.Close())
})
return f | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/stats_test.go |
keep keep keep add keep keep keep keep keep | <mask> }
<mask> s, err := createObject(conf)
<mask> require.Nil(t, err)
<mask> t.Cleanup(func() {
<mask> assert.Nil(t, os.Remove(conf.Filename))
<mask> })
<mask>
<mask> // Number of distinct clients and domains every hour.
<mask> const n = 1000
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove s, _ := createObject(conf)
e := Entry{}
n := 1000 // number of distinct clients and domains every hour
for h := 0; h != 12; h++ {
if h != 0 {
atomic.AddInt32(&hour, 1)
}
for i := 0; i != n; i++ {
e.Domain = fmt.Sprintf("domain%d", i)
ip := net.IP{127, 0, 0, 1}
ip[2] = byte((i & 0xff00) >> 8)
ip[3] = byte(i & 0xff)
e.Client = ip.String()
e.Result = RNotFiltered
e.Time = 123456
s.Update(e)
</s> add // Number of distinct clients and domains every hour.
const n = 1000
for h := 0; h < 12; h++ {
atomic.AddInt32(&hour, 1)
for i := 0; i < n; i++ {
s.Update(Entry{
Domain: fmt.Sprintf("domain%d", i),
Client: net.IP{
127,
0,
byte((i & 0xff00) >> 8),
byte(i & 0xff),
}.String(),
Result: RNotFiltered,
Time: 123456,
}) </s> add s.clear()
s.Close() </s> add s, err := createObject(conf)
require.Nil(t, err) </s> add s, err := createObject(conf)
require.Nil(t, err) </s> remove func prepareTestDir(t *testing.T) string {
t.Helper()
wd, err := os.Getwd()
require.Nil(t, err)
dir, err := ioutil.TempDir(wd, "agh-tests")
require.Nil(t, err)
require.NotEmpty(t, dir)
t.Cleanup(func() {
// TODO(e.burkov): Replace with t.TempDir methods after updating
// go version to 1.15.
start := time.Now()
for {
err := os.RemoveAll(dir)
if err == nil {
break
}
if runtime.GOOS != "windows" || time.Since(start) >= 500*time.Millisecond {
break
}
time.Sleep(5 * time.Millisecond)
}
assert.Nil(t, err)
})
return dir
}
</s> add </s> remove func prepareTestDir() string {
const dir = "./agh-test"
_ = os.RemoveAll(dir)
_ = os.MkdirAll(dir, 0o755)
return dir
</s> add func prepareTestFile(t *testing.T) (f *os.File) {
t.Helper()
dir := aghtest.PrepareTestDir(t)
f, err := ioutil.TempFile(dir, "")
require.Nil(t, err)
require.NotNil(t, f)
t.Cleanup(func() {
assert.Nil(t, f.Close())
})
return f | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/stats_test.go |
keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep replace replace replace replace keep | <mask> assert.Nil(t, os.Remove(conf.Filename))
<mask> })
<mask>
<mask> s, _ := createObject(conf)
<mask> e := Entry{}
<mask>
<mask> n := 1000 // number of distinct clients and domains every hour
<mask> for h := 0; h != 12; h++ {
<mask> if h != 0 {
<mask> atomic.AddInt32(&hour, 1)
<mask> }
<mask> for i := 0; i != n; i++ {
<mask> e.Domain = fmt.Sprintf("domain%d", i)
<mask> ip := net.IP{127, 0, 0, 1}
<mask> ip[2] = byte((i & 0xff00) >> 8)
<mask> ip[3] = byte(i & 0xff)
<mask> e.Client = ip.String()
<mask> e.Result = RNotFiltered
<mask> e.Time = 123456
<mask> s.Update(e)
<mask> }
<mask> }
<mask>
<mask> d, ok := s.getData()
<mask> assert.True(t, ok)
<mask> assert.EqualValues(t, int(hour)*n, d.NumDNSQueries)
<mask>
<mask> s.Close()
<mask> }
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove s, _ := createObject(conf)
e := Entry{}
e.Domain = "domain"
e.Client = "127.0.0.1"
e.Result = RFiltered
e.Time = 123456
s.Update(e)
e.Domain = "domain"
e.Client = "127.0.0.1"
e.Result = RNotFiltered
e.Time = 123456
s.Update(e)
</s> add s.Update(Entry{
Domain: "domain",
Client: "127.0.0.1",
Result: RFiltered,
Time: 123456,
})
s.Update(Entry{
Domain: "domain",
Client: "127.0.0.1",
Result: RNotFiltered,
Time: 123456,
}) </s> add s.Close() </s> remove func TestAggregateDataPerTimeUnit(t *testing.T) {
for i := 0; i != 25; i++ {
alen := aggregateDataPerDay(uint32(i))
assert.Equalf(t, 30, alen, "i=%d", i)
}
</s> add t.Run("hours", func(t *testing.T) {
statsData := statsCollector(units, 0, Hours, ng)
assert.Len(t, statsData, 720)
})
t.Run("days", func(t *testing.T) {
for i := 0; i != 25; i++ {
statsData := statsCollector(units, uint32(i), Days, ng)
require.Lenf(t, statsData, 30, "i=%d", i)
}
}) </s> remove return len(a)
}
</s> add units := make([]*unitDB, 720) </s> remove assert.True(t, ok)
</s> add require.True(t, ok) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/stats_test.go |
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 keep | <mask>
<mask> s.Close()
<mask> }
<mask>
<mask> // this code is a chunk copied from getData() that generates aggregate data per day
<mask> func aggregateDataPerDay(firstID uint32) int {
<mask> firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
<mask> a := []uint64{}
<mask> var sum uint64
<mask> id := firstDayID
<mask> nextDayID := firstDayID + 24
<mask> for i := firstDayID - firstID; int(i) != 720; i++ {
<mask> sum++
<mask> if id == nextDayID {
<mask> a = append(a, sum)
<mask> sum = 0
<mask> nextDayID += 24
<mask> }
<mask> id++
<mask> }
<mask> if id <= nextDayID {
<mask> a = append(a, sum)
<mask> }
<mask> return len(a)
<mask> }
<mask>
<mask> func TestAggregateDataPerTimeUnit(t *testing.T) {
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove assert.True(t, ok)
assert.EqualValues(t, int(hour)*n, d.NumDNSQueries)
s.Close()
</s> add require.True(t, ok)
assert.EqualValues(t, hour*n, d.NumDNSQueries) </s> remove // per time unit counters:
// 720 hours may span 31 days, so we skip data for the first day in this case
firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
statsCollector := func(numsGetter func(u *unitDB) (num uint64)) (nums []uint64) {
if timeUnit == Hours {
for _, u := range units {
nums = append(nums, numsGetter(u))
}
} else {
var sum uint64
id := firstDayID
nextDayID := firstDayID + 24
for i := int(firstDayID - firstID); i != len(units); i++ {
sum += numsGetter(units[i])
if id == nextDayID {
nums = append(nums, sum)
sum = 0
nextDayID += 24
}
id++
}
if id <= nextDayID {
nums = append(nums, sum)
}
}
return nums
}
topsCollector := func(max int, pairsGetter func(u *unitDB) (pairs []countPair)) []map[string]uint64 {
m := map[string]uint64{}
for _, u := range units {
for _, it := range pairsGetter(u) {
m[it.Name] += it.Count
}
}
a2 := convertMapToSlice(m, max)
return convertTopSlice(a2)
}
dnsQueries := statsCollector(func(u *unitDB) (num uint64) { return u.NTotal })
</s> add dnsQueries := statsCollector(units, firstID, timeUnit, func(u *unitDB) (num uint64) { return u.NTotal }) </s> remove return len(a)
}
</s> add units := make([]*unitDB, 720) </s> remove // total counters:
sum := unitDB{}
sum.NResult = make([]uint64, rLast)
</s> add // Total counters:
sum := unitDB{
NResult: make([]uint64, rLast),
} </s> remove func TestAggregateDataPerTimeUnit(t *testing.T) {
for i := 0; i != 25; i++ {
alen := aggregateDataPerDay(uint32(i))
assert.Equalf(t, 30, alen, "i=%d", i)
}
</s> add t.Run("hours", func(t *testing.T) {
statsData := statsCollector(units, 0, Hours, ng)
assert.Len(t, statsData, 720)
})
t.Run("days", func(t *testing.T) {
for i := 0; i != 25; i++ {
statsData := statsCollector(units, uint32(i), Days, ng)
require.Lenf(t, statsData, 30, "i=%d", i)
}
}) </s> remove // Existing host
ips := ah.Process("localhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.Equal(t, net.ParseIP("127.0.0.1"), ips[0])
// Unknown host
ips = ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
// Test hosts file
table := ah.List()
names, ok := table["127.0.0.1"]
assert.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
// Test PTR
a, _ := dns.ReverseAddr("127.0.0.1")
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 2) {
assert.Equal(t, hosts[0], "host")
}
a, _ = dns.ReverseAddr("::1")
a = strings.TrimSuffix(a, ".")
hosts = ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 1) {
assert.Equal(t, hosts[0], "localhost")
}
</s> add t.Run("existing_host", func(t *testing.T) {
ips := ah.Process("localhost", dns.TypeA)
require.Len(t, ips, 1)
assert.Equal(t, net.IPv4(127, 0, 0, 1), ips[0])
})
t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Comment.
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
})
t.Run("hosts_file", func(t *testing.T) {
names, ok := ah.List()["127.0.0.1"]
require.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
})
t.Run("ptr", func(t *testing.T) {
testCases := []struct {
wantIP string
wantLen int
wantHost string
}{
{wantIP: "127.0.0.1", wantLen: 2, wantHost: "host"},
{wantIP: "::1", wantLen: 1, wantHost: "localhost"},
}
for _, tc := range testCases {
a, err := dns.ReverseAddr(tc.wantIP)
require.Nil(t, err)
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
require.Len(t, hosts, tc.wantLen)
assert.Equal(t, tc.wantHost, hosts[0])
}
}) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/stats_test.go |
keep replace replace keep replace replace replace replace replace | <mask> }
<mask> return len(a)
<mask> }
<mask>
<mask> func TestAggregateDataPerTimeUnit(t *testing.T) {
<mask> for i := 0; i != 25; i++ {
<mask> alen := aggregateDataPerDay(uint32(i))
<mask> assert.Equalf(t, 30, alen, "i=%d", i)
<mask> }
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove s, _ := createObject(conf)
e := Entry{}
n := 1000 // number of distinct clients and domains every hour
for h := 0; h != 12; h++ {
if h != 0 {
atomic.AddInt32(&hour, 1)
}
for i := 0; i != n; i++ {
e.Domain = fmt.Sprintf("domain%d", i)
ip := net.IP{127, 0, 0, 1}
ip[2] = byte((i & 0xff00) >> 8)
ip[3] = byte(i & 0xff)
e.Client = ip.String()
e.Result = RNotFiltered
e.Time = 123456
s.Update(e)
</s> add // Number of distinct clients and domains every hour.
const n = 1000
for h := 0; h < 12; h++ {
atomic.AddInt32(&hour, 1)
for i := 0; i < n; i++ {
s.Update(Entry{
Domain: fmt.Sprintf("domain%d", i),
Client: net.IP{
127,
0,
byte((i & 0xff00) >> 8),
byte(i & 0xff),
}.String(),
Result: RNotFiltered,
Time: 123456,
}) </s> remove // this code is a chunk copied from getData() that generates aggregate data per day
func aggregateDataPerDay(firstID uint32) int {
firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
a := []uint64{}
var sum uint64
id := firstDayID
nextDayID := firstDayID + 24
for i := firstDayID - firstID; int(i) != 720; i++ {
sum++
if id == nextDayID {
a = append(a, sum)
sum = 0
nextDayID += 24
}
id++
}
if id <= nextDayID {
a = append(a, sum)
</s> add func TestStatsCollector(t *testing.T) {
ng := func(_ *unitDB) uint64 {
return 0 </s> remove // per time unit counters:
// 720 hours may span 31 days, so we skip data for the first day in this case
firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
statsCollector := func(numsGetter func(u *unitDB) (num uint64)) (nums []uint64) {
if timeUnit == Hours {
for _, u := range units {
nums = append(nums, numsGetter(u))
}
} else {
var sum uint64
id := firstDayID
nextDayID := firstDayID + 24
for i := int(firstDayID - firstID); i != len(units); i++ {
sum += numsGetter(units[i])
if id == nextDayID {
nums = append(nums, sum)
sum = 0
nextDayID += 24
}
id++
}
if id <= nextDayID {
nums = append(nums, sum)
}
}
return nums
}
topsCollector := func(max int, pairsGetter func(u *unitDB) (pairs []countPair)) []map[string]uint64 {
m := map[string]uint64{}
for _, u := range units {
for _, it := range pairsGetter(u) {
m[it.Name] += it.Count
}
}
a2 := convertMapToSlice(m, max)
return convertTopSlice(a2)
}
dnsQueries := statsCollector(func(u *unitDB) (num uint64) { return u.NTotal })
</s> add dnsQueries := statsCollector(units, firstID, timeUnit, func(u *unitDB) (num uint64) { return u.NTotal }) </s> remove BaseDir: prepareTestDir(t),
</s> add BaseDir: aghtest.PrepareTestDir(t), </s> remove func prepareTestDir(t *testing.T) string {
t.Helper()
wd, err := os.Getwd()
require.Nil(t, err)
dir, err := ioutil.TempDir(wd, "agh-tests")
require.Nil(t, err)
require.NotEmpty(t, dir)
t.Cleanup(func() {
// TODO(e.burkov): Replace with t.TempDir methods after updating
// go version to 1.15.
start := time.Now()
for {
err := os.RemoveAll(dir)
if err == nil {
break
}
if runtime.GOOS != "windows" || time.Since(start) >= 500*time.Millisecond {
break
}
time.Sleep(5 * time.Millisecond)
}
assert.Nil(t, err)
})
return dir
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/stats_test.go |
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 replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep | <mask> if units == nil {
<mask> return statsResponse{}, false
<mask> }
<mask>
<mask> // per time unit counters:
<mask> // 720 hours may span 31 days, so we skip data for the first day in this case
<mask> firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
<mask>
<mask> statsCollector := func(numsGetter func(u *unitDB) (num uint64)) (nums []uint64) {
<mask> if timeUnit == Hours {
<mask> for _, u := range units {
<mask> nums = append(nums, numsGetter(u))
<mask> }
<mask> } else {
<mask> var sum uint64
<mask> id := firstDayID
<mask> nextDayID := firstDayID + 24
<mask> for i := int(firstDayID - firstID); i != len(units); i++ {
<mask> sum += numsGetter(units[i])
<mask> if id == nextDayID {
<mask> nums = append(nums, sum)
<mask> sum = 0
<mask> nextDayID += 24
<mask> }
<mask> id++
<mask> }
<mask> if id <= nextDayID {
<mask> nums = append(nums, sum)
<mask> }
<mask> }
<mask> return nums
<mask> }
<mask>
<mask> topsCollector := func(max int, pairsGetter func(u *unitDB) (pairs []countPair)) []map[string]uint64 {
<mask> m := map[string]uint64{}
<mask> for _, u := range units {
<mask> for _, it := range pairsGetter(u) {
<mask> m[it.Name] += it.Count
<mask> }
<mask> }
<mask> a2 := convertMapToSlice(m, max)
<mask> return convertTopSlice(a2)
<mask> }
<mask>
<mask> dnsQueries := statsCollector(func(u *unitDB) (num uint64) { return u.NTotal })
<mask> if timeUnit != Hours && len(dnsQueries) != int(limit/24) {
<mask> log.Fatalf("len(dnsQueries) != limit: %d %d", len(dnsQueries), limit)
<mask> }
<mask>
<mask> data := statsResponse{
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove // this code is a chunk copied from getData() that generates aggregate data per day
func aggregateDataPerDay(firstID uint32) int {
firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
a := []uint64{}
var sum uint64
id := firstDayID
nextDayID := firstDayID + 24
for i := firstDayID - firstID; int(i) != 720; i++ {
sum++
if id == nextDayID {
a = append(a, sum)
sum = 0
nextDayID += 24
}
id++
}
if id <= nextDayID {
a = append(a, sum)
</s> add func TestStatsCollector(t *testing.T) {
ng := func(_ *unitDB) uint64 {
return 0 </s> remove // total counters:
sum := unitDB{}
sum.NResult = make([]uint64, rLast)
</s> add // Total counters:
sum := unitDB{
NResult: make([]uint64, rLast),
} </s> remove return len(a)
}
</s> add units := make([]*unitDB, 720) </s> remove assert.True(t, ok)
assert.EqualValues(t, int(hour)*n, d.NumDNSQueries)
s.Close()
</s> add require.True(t, ok)
assert.EqualValues(t, hour*n, d.NumDNSQueries) </s> remove BlockedFiltering: statsCollector(func(u *unitDB) (num uint64) { return u.NResult[RFiltered] }),
ReplacedSafebrowsing: statsCollector(func(u *unitDB) (num uint64) { return u.NResult[RSafeBrowsing] }),
ReplacedParental: statsCollector(func(u *unitDB) (num uint64) { return u.NResult[RParental] }),
TopQueried: topsCollector(maxDomains, func(u *unitDB) (pairs []countPair) { return u.Domains }),
TopBlocked: topsCollector(maxDomains, func(u *unitDB) (pairs []countPair) { return u.BlockedDomains }),
TopClients: topsCollector(maxClients, func(u *unitDB) (pairs []countPair) { return u.Clients }),
</s> add BlockedFiltering: statsCollector(units, firstID, timeUnit, func(u *unitDB) (num uint64) { return u.NResult[RFiltered] }),
ReplacedSafebrowsing: statsCollector(units, firstID, timeUnit, func(u *unitDB) (num uint64) { return u.NResult[RSafeBrowsing] }),
ReplacedParental: statsCollector(units, firstID, timeUnit, func(u *unitDB) (num uint64) { return u.NResult[RParental] }),
TopQueried: topsCollector(units, maxDomains, func(u *unitDB) (pairs []countPair) { return u.Domains }),
TopBlocked: topsCollector(units, maxDomains, func(u *unitDB) (pairs []countPair) { return u.BlockedDomains }),
TopClients: topsCollector(units, maxClients, func(u *unitDB) (pairs []countPair) { return u.Clients }), </s> remove if err != nil {
t.Fatalf("Cannot get net interfaces: %s", err)
}
if len(ifaces) == 0 {
t.Fatalf("No net interfaces found")
}
</s> add require.Nilf(t, err, "Cannot get net interfaces: %s", err)
require.NotEmpty(t, ifaces, "No net interfaces found") | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/unit.go |
keep keep keep keep replace replace replace replace replace replace keep keep replace replace replace replace keep keep keep | <mask> }
<mask>
<mask> data := statsResponse{
<mask> DNSQueries: dnsQueries,
<mask> BlockedFiltering: statsCollector(func(u *unitDB) (num uint64) { return u.NResult[RFiltered] }),
<mask> ReplacedSafebrowsing: statsCollector(func(u *unitDB) (num uint64) { return u.NResult[RSafeBrowsing] }),
<mask> ReplacedParental: statsCollector(func(u *unitDB) (num uint64) { return u.NResult[RParental] }),
<mask> TopQueried: topsCollector(maxDomains, func(u *unitDB) (pairs []countPair) { return u.Domains }),
<mask> TopBlocked: topsCollector(maxDomains, func(u *unitDB) (pairs []countPair) { return u.BlockedDomains }),
<mask> TopClients: topsCollector(maxClients, func(u *unitDB) (pairs []countPair) { return u.Clients }),
<mask> }
<mask>
<mask> // total counters:
<mask>
<mask> sum := unitDB{}
<mask> sum.NResult = make([]uint64, rLast)
<mask> timeN := 0
<mask> for _, u := range units {
<mask> sum.NTotal += u.NTotal
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove // per time unit counters:
// 720 hours may span 31 days, so we skip data for the first day in this case
firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
statsCollector := func(numsGetter func(u *unitDB) (num uint64)) (nums []uint64) {
if timeUnit == Hours {
for _, u := range units {
nums = append(nums, numsGetter(u))
}
} else {
var sum uint64
id := firstDayID
nextDayID := firstDayID + 24
for i := int(firstDayID - firstID); i != len(units); i++ {
sum += numsGetter(units[i])
if id == nextDayID {
nums = append(nums, sum)
sum = 0
nextDayID += 24
}
id++
}
if id <= nextDayID {
nums = append(nums, sum)
}
}
return nums
}
topsCollector := func(max int, pairsGetter func(u *unitDB) (pairs []countPair)) []map[string]uint64 {
m := map[string]uint64{}
for _, u := range units {
for _, it := range pairsGetter(u) {
m[it.Name] += it.Count
}
}
a2 := convertMapToSlice(m, max)
return convertTopSlice(a2)
}
dnsQueries := statsCollector(func(u *unitDB) (num uint64) { return u.NTotal })
</s> add dnsQueries := statsCollector(units, firstID, timeUnit, func(u *unitDB) (num uint64) { return u.NTotal }) </s> remove // this code is a chunk copied from getData() that generates aggregate data per day
func aggregateDataPerDay(firstID uint32) int {
firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
a := []uint64{}
var sum uint64
id := firstDayID
nextDayID := firstDayID + 24
for i := firstDayID - firstID; int(i) != 720; i++ {
sum++
if id == nextDayID {
a = append(a, sum)
sum = 0
nextDayID += 24
}
id++
}
if id <= nextDayID {
a = append(a, sum)
</s> add func TestStatsCollector(t *testing.T) {
ng := func(_ *unitDB) uint64 {
return 0 </s> remove return len(a)
}
</s> add units := make([]*unitDB, 720) </s> remove func prepareTestDir() string {
const dir = "./agh-test"
_ = os.RemoveAll(dir)
_ = os.MkdirAll(dir, 0o755)
return dir
</s> add func prepareTestFile(t *testing.T) (f *os.File) {
t.Helper()
dir := aghtest.PrepareTestDir(t)
f, err := ioutil.TempFile(dir, "")
require.Nil(t, err)
require.NotNil(t, f)
t.Cleanup(func() {
assert.Nil(t, f.Close())
})
return f </s> remove var hour int32 = 1
</s> add var hour int32 = 0 | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/stats/unit.go |
keep add keep keep keep keep | <mask>
<mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
<mask> const nl = "\n"
<mask>
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> add if filesNum == 0 {
return []string{}
}
</s> remove func prepareTestFiles(t *testing.T, dir string, filesNum, linesNum int) []string {
</s> add func prepareTestFiles(t *testing.T, filesNum, linesNum int) []string { </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest" </s> add "github.com/stretchr/testify/require" </s> add "github.com/stretchr/testify/require" </s> add "github.com/stretchr/testify/require" | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/sysutil/net_linux_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> r := bytes.NewReader(tc.data)
<mask> has, err := dhcpcdStaticConfig(r, "wlan0")
<mask> assert.Nil(t, err)
<mask> assert.Equal(t, tc.want, has)
<mask> })
<mask> }
<mask> }
<mask>
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove assert.Nil(t, err)
</s> add require.Nil(t, err) </s> remove s = updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", nil, net.IP{192, 168, 0, 2})
assert.Equal(t, dhcpcdConf, s)
</s> add for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
s := updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", tc.routers, net.IP{192, 168, 0, 2})
assert.Equal(t, tc.dhcpcdConf, s)
})
} </s> remove // Existing host
ips := ah.Process("localhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.Equal(t, net.ParseIP("127.0.0.1"), ips[0])
// Unknown host
ips = ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
// Test hosts file
table := ah.List()
names, ok := table["127.0.0.1"]
assert.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
// Test PTR
a, _ := dns.ReverseAddr("127.0.0.1")
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 2) {
assert.Equal(t, hosts[0], "host")
}
a, _ = dns.ReverseAddr("::1")
a = strings.TrimSuffix(a, ".")
hosts = ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 1) {
assert.Equal(t, hosts[0], "localhost")
}
</s> add t.Run("existing_host", func(t *testing.T) {
ips := ah.Process("localhost", dns.TypeA)
require.Len(t, ips, 1)
assert.Equal(t, net.IPv4(127, 0, 0, 1), ips[0])
})
t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Comment.
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
})
t.Run("hosts_file", func(t *testing.T) {
names, ok := ah.List()["127.0.0.1"]
require.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
})
t.Run("ptr", func(t *testing.T) {
testCases := []struct {
wantIP string
wantLen int
wantHost string
}{
{wantIP: "127.0.0.1", wantLen: 2, wantHost: "host"},
{wantIP: "::1", wantLen: 1, wantHost: "localhost"},
}
for _, tc := range testCases {
a, err := dns.ReverseAddr(tc.wantIP)
require.Nil(t, err)
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
require.Len(t, hosts, tc.wantLen)
assert.Equal(t, tc.wantHost, hosts[0])
}
}) </s> remove func TestIP(t *testing.T) {
assert.True(t, net.IP{127, 0, 0, 1}.Equal(DNSUnreverseAddr("1.0.0.127.in-addr.arpa")))
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Nil(t, DNSUnreverseAddr("1.0.0.127.in-addr.arpa."))
assert.Nil(t, DNSUnreverseAddr(".0.0.127.in-addr.arpa"))
assert.Nil(t, DNSUnreverseAddr(".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
</s> add func TestDNSReverseAddr(t *testing.T) {
testCases := []struct {
name string
have string
want net.IP
}{{
name: "good_ipv4",
have: "1.0.0.127.in-addr.arpa",
want: net.IP{127, 0, 0, 1},
}, {
name: "good_ipv6",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "good_ipv6_case",
have: "4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "bad_ipv4_dot",
have: "1.0.0.127.in-addr.arpa.",
}, {
name: "wrong_ipv4",
have: ".0.0.127.in-addr.arpa",
}, {
name: "wrong_ipv6",
have: ".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}, {
name: "bad_ipv6_dot",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa",
}, {
name: "bad_ipv6_space",
have: "4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
ip := DNSUnreverseAddr(tc.have)
assert.True(t, tc.want.Equal(ip))
})
} </s> remove dir := prepareTestDir()
defer func() { _ = os.RemoveAll(dir) }()
</s> add for _, str := range strs {
n, err := f.WriteString(str)
require.Nil(t, err)
assert.Equal(t, n, len(str))
}
} </s> remove if err != nil {
t.Fatalf("Cannot get net interfaces: %s", err)
}
if len(ifaces) == 0 {
t.Fatalf("No net interfaces found")
}
</s> add require.Nilf(t, err, "Cannot get net interfaces: %s", err)
require.NotEmpty(t, ifaces, "No net interfaces found") | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/sysutil/net_linux_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> r := bytes.NewReader(tc.data)
<mask> has, err := ifacesStaticConfig(r, "enp0s3")
<mask> assert.Nil(t, err)
<mask> assert.Equal(t, tc.want, has)
<mask> })
<mask> }
<mask> }
<mask>
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove assert.Nil(t, err)
</s> add require.Nil(t, err) </s> remove s = updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", nil, net.IP{192, 168, 0, 2})
assert.Equal(t, dhcpcdConf, s)
</s> add for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
s := updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", tc.routers, net.IP{192, 168, 0, 2})
assert.Equal(t, tc.dhcpcdConf, s)
})
} </s> remove // Existing host
ips := ah.Process("localhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.Equal(t, net.ParseIP("127.0.0.1"), ips[0])
// Unknown host
ips = ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
// Test hosts file
table := ah.List()
names, ok := table["127.0.0.1"]
assert.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
// Test PTR
a, _ := dns.ReverseAddr("127.0.0.1")
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 2) {
assert.Equal(t, hosts[0], "host")
}
a, _ = dns.ReverseAddr("::1")
a = strings.TrimSuffix(a, ".")
hosts = ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 1) {
assert.Equal(t, hosts[0], "localhost")
}
</s> add t.Run("existing_host", func(t *testing.T) {
ips := ah.Process("localhost", dns.TypeA)
require.Len(t, ips, 1)
assert.Equal(t, net.IPv4(127, 0, 0, 1), ips[0])
})
t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Comment.
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
})
t.Run("hosts_file", func(t *testing.T) {
names, ok := ah.List()["127.0.0.1"]
require.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
})
t.Run("ptr", func(t *testing.T) {
testCases := []struct {
wantIP string
wantLen int
wantHost string
}{
{wantIP: "127.0.0.1", wantLen: 2, wantHost: "host"},
{wantIP: "::1", wantLen: 1, wantHost: "localhost"},
}
for _, tc := range testCases {
a, err := dns.ReverseAddr(tc.wantIP)
require.Nil(t, err)
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
require.Len(t, hosts, tc.wantLen)
assert.Equal(t, tc.wantHost, hosts[0])
}
}) </s> remove func TestIP(t *testing.T) {
assert.True(t, net.IP{127, 0, 0, 1}.Equal(DNSUnreverseAddr("1.0.0.127.in-addr.arpa")))
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Nil(t, DNSUnreverseAddr("1.0.0.127.in-addr.arpa."))
assert.Nil(t, DNSUnreverseAddr(".0.0.127.in-addr.arpa"))
assert.Nil(t, DNSUnreverseAddr(".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
</s> add func TestDNSReverseAddr(t *testing.T) {
testCases := []struct {
name string
have string
want net.IP
}{{
name: "good_ipv4",
have: "1.0.0.127.in-addr.arpa",
want: net.IP{127, 0, 0, 1},
}, {
name: "good_ipv6",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "good_ipv6_case",
have: "4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "bad_ipv4_dot",
have: "1.0.0.127.in-addr.arpa.",
}, {
name: "wrong_ipv4",
have: ".0.0.127.in-addr.arpa",
}, {
name: "wrong_ipv6",
have: ".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}, {
name: "bad_ipv6_dot",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa",
}, {
name: "bad_ipv6_space",
have: "4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
ip := DNSUnreverseAddr(tc.have)
assert.True(t, tc.want.Equal(ip))
})
} </s> remove dir := prepareTestDir()
defer func() { _ = os.RemoveAll(dir) }()
</s> add for _, str := range strs {
n, err := f.WriteString(str)
require.Nil(t, err)
assert.Equal(t, n, len(str))
}
} </s> remove if err != nil {
t.Fatalf("Cannot get net interfaces: %s", err)
}
if len(ifaces) == 0 {
t.Fatalf("No net interfaces found")
}
</s> add require.Nilf(t, err, "Cannot get net interfaces: %s", err)
require.NotEmpty(t, ifaces, "No net interfaces found") | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/sysutil/net_linux_test.go |
keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace keep replace replace | <mask> }
<mask>
<mask> func TestSetStaticIPdhcpcdConf(t *testing.T) {
<mask> dhcpcdConf := nl + `interface wlan0` + nl +
<mask> `static ip_address=192.168.0.2/24` + nl +
<mask> `static routers=192.168.0.1` + nl +
<mask> `static domain_name_servers=192.168.0.2` + nl + nl
<mask>
<mask> s := updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", net.IP{192, 168, 0, 1}, net.IP{192, 168, 0, 2})
<mask> assert.Equal(t, dhcpcdConf, s)
<mask>
<mask> // without gateway
<mask> dhcpcdConf = nl + `interface wlan0` + nl +
<mask> `static ip_address=192.168.0.2/24` + nl +
<mask> `static domain_name_servers=192.168.0.2` + nl + nl
<mask>
<mask> s = updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", nil, net.IP{192, 168, 0, 2})
<mask> assert.Equal(t, dhcpcdConf, s)
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> add if filesNum == 0 {
return []string{}
}
</s> remove func prepareTestFiles(t *testing.T, dir string, filesNum, linesNum int) []string {
</s> add func prepareTestFiles(t *testing.T, filesNum, linesNum int) []string { </s> add "github.com/stretchr/testify/require" </s> remove // this code is a chunk copied from getData() that generates aggregate data per day
func aggregateDataPerDay(firstID uint32) int {
firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
a := []uint64{}
var sum uint64
id := firstDayID
nextDayID := firstDayID + 24
for i := firstDayID - firstID; int(i) != 720; i++ {
sum++
if id == nextDayID {
a = append(a, sum)
sum = 0
nextDayID += 24
}
id++
}
if id <= nextDayID {
a = append(a, sum)
</s> add func TestStatsCollector(t *testing.T) {
ng := func(_ *unitDB) uint64 {
return 0 </s> remove assert.True(t, ok)
assert.EqualValues(t, int(hour)*n, d.NumDNSQueries)
s.Close()
</s> add require.True(t, ok)
assert.EqualValues(t, hour*n, d.NumDNSQueries) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/sysutil/net_linux_test.go |
keep keep add keep keep keep keep | <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
<mask> func TestMain(m *testing.M) {
<mask> aghtest.DiscardLogOutput(m)
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> add "github.com/stretchr/testify/require" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest" </s> remove func prepareTestDir() string {
const dir = "./agh-test"
_ = os.RemoveAll(dir)
_ = os.MkdirAll(dir, 0o755)
return dir
</s> add func prepareTestFile(t *testing.T) (f *os.File) {
t.Helper()
dir := aghtest.PrepareTestDir(t)
f, err := ioutil.TempFile(dir, "")
require.Nil(t, err)
require.NotNil(t, f)
t.Cleanup(func() {
assert.Nil(t, f.Close())
})
return f </s> add "github.com/stretchr/testify/require" </s> remove func prepareTestDir(t *testing.T) string {
t.Helper()
wd, err := os.Getwd()
require.Nil(t, err)
dir, err := ioutil.TempDir(wd, "agh-tests")
require.Nil(t, err)
require.NotEmpty(t, dir)
t.Cleanup(func() {
// TODO(e.burkov): Replace with t.TempDir methods after updating
// go version to 1.15.
start := time.Now()
for {
err := os.RemoveAll(dir)
if err == nil {
break
}
if runtime.GOOS != "windows" || time.Since(start) >= 500*time.Millisecond {
break
}
time.Sleep(5 * time.Millisecond)
}
assert.Nil(t, err)
})
return dir
}
</s> add </s> add "github.com/stretchr/testify/require" | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep replace replace replace replace replace keep keep replace replace keep keep keep | <mask>
<mask> func prepareTestDir() string {
<mask> const dir = "./agh-test"
<mask> _ = os.RemoveAll(dir)
<mask> _ = os.MkdirAll(dir, 0o755)
<mask> return dir
<mask> }
<mask>
<mask> func TestAutoHostsResolution(t *testing.T) {
<mask> ah := AutoHosts{}
<mask>
<mask> dir := prepareTestDir()
<mask> defer func() { _ = os.RemoveAll(dir) }()
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove ah := AutoHosts{}
</s> add ah := &AutoHosts{} </s> remove dir := prepareTestDir()
defer func() { _ = os.RemoveAll(dir) }()
</s> add f := prepareTestFile(t) </s> remove dir := prepareTestDir()
defer func() { _ = os.RemoveAll(dir) }()
</s> add for _, str := range strs {
n, err := f.WriteString(str)
require.Nil(t, err)
assert.Equal(t, n, len(str))
}
} </s> remove f, _ := ioutil.TempFile(dir, "")
defer func() { _ = os.Remove(f.Name()) }()
defer f.Close()
</s> add func TestAutoHostsResolution(t *testing.T) {
ah := &AutoHosts{} </s> remove f, _ := ioutil.TempFile(dir, "")
defer func() { _ = os.Remove(f.Name()) }()
defer f.Close()
// Init
_, _ = f.WriteString(" 127.0.0.1 host localhost \n")
</s> add assertWriting(t, f, " 127.0.0.1 host localhost \n") | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep keep replace replace keep keep keep keep keep keep keep keep replace replace replace keep keep keep | <mask> ah := AutoHosts{}
<mask>
<mask> dir := prepareTestDir()
<mask> defer func() { _ = os.RemoveAll(dir) }()
<mask>
<mask> f, _ := ioutil.TempFile(dir, "")
<mask> defer func() { _ = os.Remove(f.Name()) }()
<mask> defer f.Close()
<mask>
<mask> dir := prepareTestDir()
<mask> defer func() { _ = os.RemoveAll(dir) }()
<mask>
<mask> f, _ := ioutil.TempFile(dir, "")
<mask> defer func() { _ = os.Remove(f.Name()) }()
<mask> defer f.Close()
<mask>
<mask> _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
<mask> _, _ = f.WriteString(" ::1 localhost#comment \n")
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove f, _ := ioutil.TempFile(dir, "")
defer func() { _ = os.Remove(f.Name()) }()
defer f.Close()
// Init
_, _ = f.WriteString(" 127.0.0.1 host localhost \n")
</s> add assertWriting(t, f, " 127.0.0.1 host localhost \n") </s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n")
</s> add f := prepareTestFile(t) </s> remove dir := prepareTestDir()
defer func() { _ = os.RemoveAll(dir) }()
</s> add f := prepareTestFile(t) </s> remove ah := AutoHosts{}
</s> add ah := &AutoHosts{} </s> remove func TestAutoHostsResolution(t *testing.T) {
ah := AutoHosts{}
</s> add func assertWriting(t *testing.T, f *os.File, strs ...string) {
t.Helper() | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> f, _ := ioutil.TempFile(dir, "")
<mask> defer func() { _ = os.Remove(f.Name()) }()
<mask> defer f.Close()
<mask>
<mask> _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
<mask> _, _ = f.WriteString(" ::1 localhost#comment \n")
<mask>
<mask> ah.Init(f.Name())
<mask>
<mask> // Existing host
<mask> ips := ah.Process("localhost", dns.TypeA)
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove f, _ := ioutil.TempFile(dir, "")
defer func() { _ = os.Remove(f.Name()) }()
defer f.Close()
</s> add func TestAutoHostsResolution(t *testing.T) {
ah := &AutoHosts{} </s> remove f, _ := ioutil.TempFile(dir, "")
defer func() { _ = os.Remove(f.Name()) }()
defer f.Close()
// Init
_, _ = f.WriteString(" 127.0.0.1 host localhost \n")
</s> add assertWriting(t, f, " 127.0.0.1 host localhost \n") </s> remove // Unknown host
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
</s> add t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
}) </s> remove dir := prepareTestDir()
defer func() { _ = os.RemoveAll(dir) }()
</s> add f := prepareTestFile(t) </s> add assertWriting(t, f,
" 127.0.0.1 host localhost # comment \n",
" ::1 localhost#comment \n",
) </s> remove dir := prepareTestDir()
defer func() { _ = os.RemoveAll(dir) }()
</s> add for _, str := range strs {
n, err := f.WriteString(str)
require.Nil(t, err)
assert.Equal(t, n, len(str))
}
} | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep keep add keep keep keep keep keep keep | <mask>
<mask> f := prepareTestFile(t)
<mask>
<mask> ah.Init(f.Name())
<mask>
<mask> t.Run("existing_host", func(t *testing.T) {
<mask> ips := ah.Process("localhost", dns.TypeA)
<mask> require.Len(t, ips, 1)
<mask> assert.Equal(t, net.IPv4(127, 0, 0, 1), ips[0])
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove // Existing host
ips := ah.Process("localhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.Equal(t, net.ParseIP("127.0.0.1"), ips[0])
// Unknown host
ips = ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
// Test hosts file
table := ah.List()
names, ok := table["127.0.0.1"]
assert.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
// Test PTR
a, _ := dns.ReverseAddr("127.0.0.1")
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 2) {
assert.Equal(t, hosts[0], "host")
}
a, _ = dns.ReverseAddr("::1")
a = strings.TrimSuffix(a, ".")
hosts = ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 1) {
assert.Equal(t, hosts[0], "localhost")
}
</s> add t.Run("existing_host", func(t *testing.T) {
ips := ah.Process("localhost", dns.TypeA)
require.Len(t, ips, 1)
assert.Equal(t, net.IPv4(127, 0, 0, 1), ips[0])
})
t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Comment.
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
})
t.Run("hosts_file", func(t *testing.T) {
names, ok := ah.List()["127.0.0.1"]
require.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
})
t.Run("ptr", func(t *testing.T) {
testCases := []struct {
wantIP string
wantLen int
wantHost string
}{
{wantIP: "127.0.0.1", wantLen: 2, wantHost: "host"},
{wantIP: "::1", wantLen: 1, wantHost: "localhost"},
}
for _, tc := range testCases {
a, err := dns.ReverseAddr(tc.wantIP)
require.Nil(t, err)
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
require.Len(t, hosts, tc.wantLen)
assert.Equal(t, tc.wantHost, hosts[0])
}
}) </s> remove // Check if we are notified about changes
ips = ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
</s> add t.Run("notified", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
require.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
}) </s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n")
</s> add f := prepareTestFile(t) </s> remove // Unknown host
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
</s> add t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
}) </s> remove func TestIP(t *testing.T) {
assert.True(t, net.IP{127, 0, 0, 1}.Equal(DNSUnreverseAddr("1.0.0.127.in-addr.arpa")))
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
assert.Nil(t, DNSUnreverseAddr("1.0.0.127.in-addr.arpa."))
assert.Nil(t, DNSUnreverseAddr(".0.0.127.in-addr.arpa"))
assert.Nil(t, DNSUnreverseAddr(".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa"))
assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
</s> add func TestDNSReverseAddr(t *testing.T) {
testCases := []struct {
name string
have string
want net.IP
}{{
name: "good_ipv4",
have: "1.0.0.127.in-addr.arpa",
want: net.IP{127, 0, 0, 1},
}, {
name: "good_ipv6",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "good_ipv6_case",
have: "4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "bad_ipv4_dot",
have: "1.0.0.127.in-addr.arpa.",
}, {
name: "wrong_ipv4",
have: ".0.0.127.in-addr.arpa",
}, {
name: "wrong_ipv6",
have: ".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}, {
name: "bad_ipv6_dot",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa",
}, {
name: "bad_ipv6_space",
have: "4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
ip := DNSUnreverseAddr(tc.have)
assert.True(t, tc.want.Equal(ip))
})
} </s> remove s = updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", nil, net.IP{192, 168, 0, 2})
assert.Equal(t, dhcpcdConf, s)
</s> add for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
s := updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", tc.routers, net.IP{192, 168, 0, 2})
assert.Equal(t, tc.dhcpcdConf, s)
})
} | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep replace keep keep | <mask>
<mask> // Existing host
<mask> ips := ah.Process("localhost", dns.TypeA)
<mask> assert.NotNil(t, ips)
<mask> assert.Len(t, ips, 1)
<mask> assert.Equal(t, net.ParseIP("127.0.0.1"), ips[0])
<mask>
<mask> // Unknown host
<mask> ips = ah.Process("newhost", dns.TypeA)
<mask> assert.Nil(t, ips)
<mask>
<mask> // Unknown host (comment)
<mask> ips = ah.Process("comment", dns.TypeA)
<mask> assert.Nil(t, ips)
<mask>
<mask> // Test hosts file
<mask> table := ah.List()
<mask> names, ok := table["127.0.0.1"]
<mask> assert.True(t, ok)
<mask> assert.Equal(t, []string{"host", "localhost"}, names)
<mask>
<mask> // Test PTR
<mask> a, _ := dns.ReverseAddr("127.0.0.1")
<mask> a = strings.TrimSuffix(a, ".")
<mask> hosts := ah.ProcessReverse(a, dns.TypePTR)
<mask> if assert.Len(t, hosts, 2) {
<mask> assert.Equal(t, hosts[0], "host")
<mask> }
<mask>
<mask> a, _ = dns.ReverseAddr("::1")
<mask> a = strings.TrimSuffix(a, ".")
<mask> hosts = ah.ProcessReverse(a, dns.TypePTR)
<mask> if assert.Len(t, hosts, 1) {
<mask> assert.Equal(t, hosts[0], "localhost")
<mask> }
<mask> }
<mask>
<mask> func TestAutoHostsFSNotify(t *testing.T) {
<mask> ah := AutoHosts{}
<mask>
<mask> dir := prepareTestDir()
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep keep replace replace keep keep keep keep keep keep keep keep replace replace replace replace replace replace keep keep keep keep | <mask> ah := AutoHosts{}
<mask>
<mask> dir := prepareTestDir()
<mask> defer func() { _ = os.RemoveAll(dir) }()
<mask>
<mask> f, _ := ioutil.TempFile(dir, "")
<mask> defer func() { _ = os.Remove(f.Name()) }()
<mask> defer f.Close()
<mask>
<mask> dir := prepareTestDir()
<mask> defer func() { _ = os.RemoveAll(dir) }()
<mask>
<mask> f, _ := ioutil.TempFile(dir, "")
<mask> defer func() { _ = os.Remove(f.Name()) }()
<mask> defer f.Close()
<mask>
<mask> // Init
<mask> _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
<mask> ah.Init(f.Name())
<mask>
<mask> // Unknown host
<mask> ips := ah.Process("newhost", dns.TypeA)
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove f, _ := ioutil.TempFile(dir, "")
defer func() { _ = os.Remove(f.Name()) }()
defer f.Close()
</s> add func TestAutoHostsResolution(t *testing.T) {
ah := &AutoHosts{} </s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n")
</s> add f := prepareTestFile(t) </s> remove dir := prepareTestDir()
defer func() { _ = os.RemoveAll(dir) }()
</s> add for _, str := range strs {
n, err := f.WriteString(str)
require.Nil(t, err)
assert.Equal(t, n, len(str))
}
} </s> remove ah := AutoHosts{}
</s> add ah := &AutoHosts{} </s> remove func TestAutoHostsResolution(t *testing.T) {
ah := AutoHosts{}
</s> add func assertWriting(t *testing.T, f *os.File, strs ...string) {
t.Helper() | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep keep keep keep replace replace replace keep replace keep keep keep keep | <mask> // Init
<mask> _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
<mask> ah.Init(f.Name())
<mask>
<mask> // Unknown host
<mask> ips := ah.Process("newhost", dns.TypeA)
<mask> assert.Nil(t, ips)
<mask>
<mask> // Stat monitoring for changes
<mask> ah.Start()
<mask> defer ah.Close()
<mask>
<mask> // Update file
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove f, _ := ioutil.TempFile(dir, "")
defer func() { _ = os.Remove(f.Name()) }()
defer f.Close()
// Init
_, _ = f.WriteString(" 127.0.0.1 host localhost \n")
</s> add assertWriting(t, f, " 127.0.0.1 host localhost \n") </s> remove defer ah.Close()
</s> add t.Cleanup(ah.Close) </s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n")
</s> add f := prepareTestFile(t) </s> remove f, _ := ioutil.TempFile(dir, "")
defer func() { _ = os.Remove(f.Name()) }()
defer f.Close()
</s> add func TestAutoHostsResolution(t *testing.T) {
ah := &AutoHosts{} </s> remove // Update file
_, _ = f.WriteString("127.0.0.2 newhost\n")
_ = f.Sync()
</s> add assertWriting(t, f, "127.0.0.2 newhost\n")
require.Nil(t, f.Sync()) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep keep keep replace keep replace replace replace keep keep keep | <mask>
<mask> // Stat monitoring for changes
<mask> ah.Start()
<mask> defer ah.Close()
<mask>
<mask> // Update file
<mask> _, _ = f.WriteString("127.0.0.2 newhost\n")
<mask> _ = f.Sync()
<mask>
<mask> // wait until fsnotify has triggerred and processed the file-modification event
<mask> time.Sleep(50 * time.Millisecond)
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove // wait until fsnotify has triggerred and processed the file-modification event
</s> add // Wait until fsnotify has triggerred and processed the
// file-modification event. </s> remove // Stat monitoring for changes
</s> add // Start monitoring for changes. </s> remove // Check if we are notified about changes
ips = ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
</s> add t.Run("notified", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
require.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
}) </s> remove // Unknown host
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
</s> add t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
}) </s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n")
</s> add f := prepareTestFile(t) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // Update file
<mask> _, _ = f.WriteString("127.0.0.2 newhost\n")
<mask> _ = f.Sync()
<mask>
<mask> // wait until fsnotify has triggerred and processed the file-modification event
<mask> time.Sleep(50 * time.Millisecond)
<mask>
<mask> // Check if we are notified about changes
<mask> ips = ah.Process("newhost", dns.TypeA)
<mask> assert.NotNil(t, ips)
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove // Update file
_, _ = f.WriteString("127.0.0.2 newhost\n")
_ = f.Sync()
</s> add assertWriting(t, f, "127.0.0.2 newhost\n")
require.Nil(t, f.Sync()) </s> remove // Check if we are notified about changes
ips = ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
</s> add t.Run("notified", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.NotNil(t, ips)
require.Len(t, ips, 1)
assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
}) </s> remove defer ah.Close()
</s> add t.Cleanup(ah.Close) </s> remove // Stat monitoring for changes
</s> add // Start monitoring for changes. </s> remove // Unknown host
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
</s> add t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
}) </s> remove // Existing host
ips := ah.Process("localhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.Equal(t, net.ParseIP("127.0.0.1"), ips[0])
// Unknown host
ips = ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
// Test hosts file
table := ah.List()
names, ok := table["127.0.0.1"]
assert.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
// Test PTR
a, _ := dns.ReverseAddr("127.0.0.1")
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 2) {
assert.Equal(t, hosts[0], "host")
}
a, _ = dns.ReverseAddr("::1")
a = strings.TrimSuffix(a, ".")
hosts = ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 1) {
assert.Equal(t, hosts[0], "localhost")
}
</s> add t.Run("existing_host", func(t *testing.T) {
ips := ah.Process("localhost", dns.TypeA)
require.Len(t, ips, 1)
assert.Equal(t, net.IPv4(127, 0, 0, 1), ips[0])
})
t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Comment.
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
})
t.Run("hosts_file", func(t *testing.T) {
names, ok := ah.List()["127.0.0.1"]
require.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
})
t.Run("ptr", func(t *testing.T) {
testCases := []struct {
wantIP string
wantLen int
wantHost string
}{
{wantIP: "127.0.0.1", wantLen: 2, wantHost: "host"},
{wantIP: "::1", wantLen: 1, wantHost: "localhost"},
}
for _, tc := range testCases {
a, err := dns.ReverseAddr(tc.wantIP)
require.Nil(t, err)
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
require.Len(t, hosts, tc.wantLen)
assert.Equal(t, tc.wantHost, hosts[0])
}
}) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep keep keep keep replace replace replace replace replace keep keep replace replace replace replace replace replace replace replace replace replace | <mask>
<mask> // wait until fsnotify has triggerred and processed the file-modification event
<mask> time.Sleep(50 * time.Millisecond)
<mask>
<mask> // Check if we are notified about changes
<mask> ips = ah.Process("newhost", dns.TypeA)
<mask> assert.NotNil(t, ips)
<mask> assert.Len(t, ips, 1)
<mask> assert.True(t, net.IP{127, 0, 0, 2}.Equal(ips[0]))
<mask> }
<mask>
<mask> func TestIP(t *testing.T) {
<mask> assert.True(t, net.IP{127, 0, 0, 1}.Equal(DNSUnreverseAddr("1.0.0.127.in-addr.arpa")))
<mask> assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
<mask> assert.Equal(t, "::abcd:1234", DNSUnreverseAddr("4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa").String())
<mask>
<mask> assert.Nil(t, DNSUnreverseAddr("1.0.0.127.in-addr.arpa."))
<mask> assert.Nil(t, DNSUnreverseAddr(".0.0.127.in-addr.arpa"))
<mask> assert.Nil(t, DNSUnreverseAddr(".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
<mask> assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa"))
<mask> assert.Nil(t, DNSUnreverseAddr("4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"))
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove // wait until fsnotify has triggerred and processed the file-modification event
</s> add // Wait until fsnotify has triggerred and processed the
// file-modification event. </s> remove // Update file
_, _ = f.WriteString("127.0.0.2 newhost\n")
_ = f.Sync()
</s> add assertWriting(t, f, "127.0.0.2 newhost\n")
require.Nil(t, f.Sync()) </s> remove // Existing host
ips := ah.Process("localhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.Equal(t, net.ParseIP("127.0.0.1"), ips[0])
// Unknown host
ips = ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
// Test hosts file
table := ah.List()
names, ok := table["127.0.0.1"]
assert.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
// Test PTR
a, _ := dns.ReverseAddr("127.0.0.1")
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 2) {
assert.Equal(t, hosts[0], "host")
}
a, _ = dns.ReverseAddr("::1")
a = strings.TrimSuffix(a, ".")
hosts = ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 1) {
assert.Equal(t, hosts[0], "localhost")
}
</s> add t.Run("existing_host", func(t *testing.T) {
ips := ah.Process("localhost", dns.TypeA)
require.Len(t, ips, 1)
assert.Equal(t, net.IPv4(127, 0, 0, 1), ips[0])
})
t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Comment.
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
})
t.Run("hosts_file", func(t *testing.T) {
names, ok := ah.List()["127.0.0.1"]
require.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
})
t.Run("ptr", func(t *testing.T) {
testCases := []struct {
wantIP string
wantLen int
wantHost string
}{
{wantIP: "127.0.0.1", wantLen: 2, wantHost: "host"},
{wantIP: "::1", wantLen: 1, wantHost: "localhost"},
}
for _, tc := range testCases {
a, err := dns.ReverseAddr(tc.wantIP)
require.Nil(t, err)
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
require.Len(t, hosts, tc.wantLen)
assert.Equal(t, tc.wantHost, hosts[0])
}
}) </s> remove // Unknown host
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
</s> add t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
}) </s> add require.NotEmpty(t, topClients) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/autohosts_test.go |
keep keep add keep keep keep keep | <mask> "testing"
<mask>
<mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
<mask> func TestSplitNext(t *testing.T) {
<mask> s := " a,b , c "
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove assert.Empty(t, s)
</s> add require.Empty(t, s) </s> add assertWriting(t, f,
" 127.0.0.1 host localhost # comment \n",
" ::1 localhost#comment \n",
) </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest" </s> add "github.com/stretchr/testify/require" </s> add "github.com/stretchr/testify/require" </s> add "github.com/stretchr/testify/require" | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/helpers_test.go |
keep keep keep keep replace keep | <mask> s := " a,b , c "
<mask> assert.Equal(t, "a", SplitNext(&s, ','))
<mask> assert.Equal(t, "b", SplitNext(&s, ','))
<mask> assert.Equal(t, "c", SplitNext(&s, ','))
<mask> assert.Empty(t, s)
<mask> }
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> add "github.com/stretchr/testify/require" </s> remove s = updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", nil, net.IP{192, 168, 0, 2})
assert.Equal(t, dhcpcdConf, s)
</s> add for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
s := updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", tc.routers, net.IP{192, 168, 0, 2})
assert.Equal(t, tc.dhcpcdConf, s)
})
} </s> add assertWriting(t, f,
" 127.0.0.1 host localhost # comment \n",
" ::1 localhost#comment \n",
) </s> remove dhcpcdConf := nl + `interface wlan0` + nl +
`static ip_address=192.168.0.2/24` + nl +
`static routers=192.168.0.1` + nl +
`static domain_name_servers=192.168.0.2` + nl + nl
s := updateStaticIPdhcpcdConf("wlan0", "192.168.0.2/24", net.IP{192, 168, 0, 1}, net.IP{192, 168, 0, 2})
assert.Equal(t, dhcpcdConf, s)
// without gateway
dhcpcdConf = nl + `interface wlan0` + nl +
`static ip_address=192.168.0.2/24` + nl +
`static domain_name_servers=192.168.0.2` + nl + nl
</s> add testCases := []struct {
name string
dhcpcdConf string
routers net.IP
}{{
name: "with_gateway",
dhcpcdConf: nl + `interface wlan0` + nl +
`static ip_address=192.168.0.2/24` + nl +
`static routers=192.168.0.1` + nl +
`static domain_name_servers=192.168.0.2` + nl + nl,
routers: net.IP{192, 168, 0, 1},
}, {
name: "without_gateway",
dhcpcdConf: nl + `interface wlan0` + nl +
`static ip_address=192.168.0.2/24` + nl +
`static domain_name_servers=192.168.0.2` + nl + nl,
routers: nil,
}} </s> remove // Existing host
ips := ah.Process("localhost", dns.TypeA)
assert.NotNil(t, ips)
assert.Len(t, ips, 1)
assert.Equal(t, net.ParseIP("127.0.0.1"), ips[0])
// Unknown host
ips = ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
// Test hosts file
table := ah.List()
names, ok := table["127.0.0.1"]
assert.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
// Test PTR
a, _ := dns.ReverseAddr("127.0.0.1")
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 2) {
assert.Equal(t, hosts[0], "host")
}
a, _ = dns.ReverseAddr("::1")
a = strings.TrimSuffix(a, ".")
hosts = ah.ProcessReverse(a, dns.TypePTR)
if assert.Len(t, hosts, 1) {
assert.Equal(t, hosts[0], "localhost")
}
</s> add t.Run("existing_host", func(t *testing.T) {
ips := ah.Process("localhost", dns.TypeA)
require.Len(t, ips, 1)
assert.Equal(t, net.IPv4(127, 0, 0, 1), ips[0])
})
t.Run("unknown_host", func(t *testing.T) {
ips := ah.Process("newhost", dns.TypeA)
assert.Nil(t, ips)
// Comment.
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
})
t.Run("hosts_file", func(t *testing.T) {
names, ok := ah.List()["127.0.0.1"]
require.True(t, ok)
assert.Equal(t, []string{"host", "localhost"}, names)
})
t.Run("ptr", func(t *testing.T) {
testCases := []struct {
wantIP string
wantLen int
wantHost string
}{
{wantIP: "127.0.0.1", wantLen: 2, wantHost: "host"},
{wantIP: "::1", wantLen: 1, wantHost: "localhost"},
}
for _, tc := range testCases {
a, err := dns.ReverseAddr(tc.wantIP)
require.Nil(t, err)
a = strings.TrimSuffix(a, ".")
hosts := ah.ProcessReverse(a, dns.TypePTR)
require.Len(t, hosts, tc.wantLen)
assert.Equal(t, tc.wantHost, hosts[0])
}
}) </s> remove assert.Nil(t, err)
</s> add require.Nil(t, err) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/helpers_test.go |
keep keep keep add keep keep keep keep | <mask> package util
<mask>
<mask> import (
<mask> "testing"
<mask> )
<mask>
<mask> func TestGetValidNetInterfacesForWeb(t *testing.T) {
<mask> ifaces, err := GetValidNetInterfacesForWeb()
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove if err != nil {
t.Fatalf("Cannot get net interfaces: %s", err)
}
if len(ifaces) == 0 {
t.Fatalf("No net interfaces found")
}
</s> add require.Nilf(t, err, "Cannot get net interfaces: %s", err)
require.NotEmpty(t, ifaces, "No net interfaces found") </s> remove "io/ioutil"
</s> add </s> add "github.com/stretchr/testify/require" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest" </s> remove func prepareTestDir(t *testing.T) string {
t.Helper()
wd, err := os.Getwd()
require.Nil(t, err)
dir, err := ioutil.TempDir(wd, "agh-tests")
require.Nil(t, err)
require.NotEmpty(t, dir)
t.Cleanup(func() {
// TODO(e.burkov): Replace with t.TempDir methods after updating
// go version to 1.15.
start := time.Now()
for {
err := os.RemoveAll(dir)
if err == nil {
break
}
if runtime.GOOS != "windows" || time.Since(start) >= 500*time.Millisecond {
break
}
time.Sleep(5 * time.Millisecond)
}
assert.Nil(t, err)
})
return dir
}
</s> add </s> remove BaseDir: prepareTestDir(t),
</s> add BaseDir: aghtest.PrepareTestDir(t), | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/network_test.go |
keep replace replace replace replace replace replace replace keep replace replace replace replace replace keep | <mask> ifaces, err := GetValidNetInterfacesForWeb()
<mask> if err != nil {
<mask> t.Fatalf("Cannot get net interfaces: %s", err)
<mask> }
<mask> if len(ifaces) == 0 {
<mask> t.Fatalf("No net interfaces found")
<mask> }
<mask>
<mask> for _, iface := range ifaces {
<mask> if len(iface.Addresses) == 0 {
<mask> t.Fatalf("No addresses found for %s", iface.Name)
<mask> }
<mask>
<mask> t.Logf("%v", iface)
<mask> }
</s> Pull request: 2639 use testify require vol.2
Merge in DNS/adguard-home from 2639-testify-require-2 to master
Updates #2639.
Squashed commit of the following:
commit 31cc29a166e2e48a73956853cbc6d6dd681ab6da
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 18:48:31 2021 +0300
all: deal with t.Run
commit 484f477fbfedd03aca4d322bc1cc9e131f30e1ce
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 17:44:02 2021 +0300
all: fix readability, imp tests
commit 1231a825b353c16e43eae1b660dbb4c87805f564
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Feb 9 16:06:29 2021 +0300
all: imp tests </s> remove // per time unit counters:
// 720 hours may span 31 days, so we skip data for the first day in this case
firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
statsCollector := func(numsGetter func(u *unitDB) (num uint64)) (nums []uint64) {
if timeUnit == Hours {
for _, u := range units {
nums = append(nums, numsGetter(u))
}
} else {
var sum uint64
id := firstDayID
nextDayID := firstDayID + 24
for i := int(firstDayID - firstID); i != len(units); i++ {
sum += numsGetter(units[i])
if id == nextDayID {
nums = append(nums, sum)
sum = 0
nextDayID += 24
}
id++
}
if id <= nextDayID {
nums = append(nums, sum)
}
}
return nums
}
topsCollector := func(max int, pairsGetter func(u *unitDB) (pairs []countPair)) []map[string]uint64 {
m := map[string]uint64{}
for _, u := range units {
for _, it := range pairsGetter(u) {
m[it.Name] += it.Count
}
}
a2 := convertMapToSlice(m, max)
return convertTopSlice(a2)
}
dnsQueries := statsCollector(func(u *unitDB) (num uint64) { return u.NTotal })
</s> add dnsQueries := statsCollector(units, firstID, timeUnit, func(u *unitDB) (num uint64) { return u.NTotal }) </s> remove func prepareTestDir(t *testing.T) string {
t.Helper()
wd, err := os.Getwd()
require.Nil(t, err)
dir, err := ioutil.TempDir(wd, "agh-tests")
require.Nil(t, err)
require.NotEmpty(t, dir)
t.Cleanup(func() {
// TODO(e.burkov): Replace with t.TempDir methods after updating
// go version to 1.15.
start := time.Now()
for {
err := os.RemoveAll(dir)
if err == nil {
break
}
if runtime.GOOS != "windows" || time.Since(start) >= 500*time.Millisecond {
break
}
time.Sleep(5 * time.Millisecond)
}
assert.Nil(t, err)
})
return dir
}
</s> add </s> remove // this code is a chunk copied from getData() that generates aggregate data per day
func aggregateDataPerDay(firstID uint32) int {
firstDayID := (firstID + 24 - 1) / 24 * 24 // align_ceil(24)
a := []uint64{}
var sum uint64
id := firstDayID
nextDayID := firstDayID + 24
for i := firstDayID - firstID; int(i) != 720; i++ {
sum++
if id == nextDayID {
a = append(a, sum)
sum = 0
nextDayID += 24
}
id++
}
if id <= nextDayID {
a = append(a, sum)
</s> add func TestStatsCollector(t *testing.T) {
ng := func(_ *unitDB) uint64 {
return 0 </s> remove // total counters:
sum := unitDB{}
sum.NResult = make([]uint64, rLast)
</s> add // Total counters:
sum := unitDB{
NResult: make([]uint64, rLast),
} </s> remove assert.Nil(t, err)
</s> add require.Nil(t, err) | https://github.com/AdguardTeam/AdGuardHome/commit/a3dddd72c1cd864749355c49ef5313a447709638 | internal/util/network_test.go |
keep keep add keep keep keep keep keep | <mask> ServerName string `plist:",omitempty"`
<mask>
<mask> // ServerAddresses is a list IP addresses of the server.
<mask> ServerAddresses []net.IP `plist:",omitempty"`
<mask> }
<mask>
<mask> // payloadContent is a Device Management Profile payload.
<mask> //
</s> Pull request: home: rollback serveraddresses in mobileconfig
Updates #3607.
Squashed commit of the following:
commit 1f0a970b4265a59819ec139e51c98dc9376d995b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Sep 30 13:26:49 2021 +0300
home: rollback serveraddresses in mobileconfig </s> remove
// collectDNSIPs returns a slice of IP addresses the server is listening
// on, including the addresses on all interfaces in cases of unspecified IPs but
// excluding loopback addresses.
func collectDNSIPs() (ips []net.IP, err error) {
// TODO(a.garipov): This really shouldn't be a function that parses
// a list of strings. Instead, we need a function that returns this
// data as []net.IP or []*netutil.IPPort. Maybe someday.
addrs, err := collectDNSAddresses()
if err != nil {
return nil, err
}
for _, addr := range addrs {
ip := net.ParseIP(addr)
if ip != nil && !ip.IsLoopback() {
ips = append(ips, ip)
}
}
return ips, nil
}
</s> add </s> remove dnsIPs, err := collectDNSIPs()
if err != nil {
// Don't add a lot of formatting, since the error is already
// wrapped by collectDNSIPs.
respondJSONError(w, http.StatusInternalServerError, err.Error())
return
}
</s> add </s> remove DNSProtocol: dnsp,
ServerName: host,
ServerAddresses: dnsIPs,
</s> add DNSProtocol: dnsp,
ServerName: host, </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a4e078271cec4efad5aea95a32dc46a3d86ea9ca | internal/home/mobileconfig.go |
keep keep keep replace replace replace replace replace replace replace replace replace keep replace replace replace keep keep keep | <mask> }
<mask> }
<mask>
<mask> dnsIPs, err := collectDNSIPs()
<mask> if err != nil {
<mask> // Don't add a lot of formatting, since the error is already
<mask> // wrapped by collectDNSIPs.
<mask> respondJSONError(w, http.StatusInternalServerError, err.Error())
<mask>
<mask> return
<mask> }
<mask>
<mask> d := &dnsSettings{
<mask> DNSProtocol: dnsp,
<mask> ServerName: host,
<mask> ServerAddresses: dnsIPs,
<mask> }
<mask>
<mask> mobileconfig, err := encodeMobileConfig(d, clientID)
</s> Pull request: home: rollback serveraddresses in mobileconfig
Updates #3607.
Squashed commit of the following:
commit 1f0a970b4265a59819ec139e51c98dc9376d995b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Sep 30 13:26:49 2021 +0300
home: rollback serveraddresses in mobileconfig </s> remove
// collectDNSIPs returns a slice of IP addresses the server is listening
// on, including the addresses on all interfaces in cases of unspecified IPs but
// excluding loopback addresses.
func collectDNSIPs() (ips []net.IP, err error) {
// TODO(a.garipov): This really shouldn't be a function that parses
// a list of strings. Instead, we need a function that returns this
// data as []net.IP or []*netutil.IPPort. Maybe someday.
addrs, err := collectDNSAddresses()
if err != nil {
return nil, err
}
for _, addr := range addrs {
ip := net.ParseIP(addr)
if ip != nil && !ip.IsLoopback() {
ips = append(ips, ip)
}
}
return ips, nil
}
</s> add </s> add //
// TODO(a.garipov): Allow users to set this.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3607. </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a4e078271cec4efad5aea95a32dc46a3d86ea9ca | internal/home/mobileconfig.go |
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 replace | <mask>
<mask> func handleMobileConfigDoT(w http.ResponseWriter, r *http.Request) {
<mask> handleMobileConfig(w, r, dnsProtoTLS)
<mask> }
<mask>
<mask> // collectDNSIPs returns a slice of IP addresses the server is listening
<mask> // on, including the addresses on all interfaces in cases of unspecified IPs but
<mask> // excluding loopback addresses.
<mask> func collectDNSIPs() (ips []net.IP, err error) {
<mask> // TODO(a.garipov): This really shouldn't be a function that parses
<mask> // a list of strings. Instead, we need a function that returns this
<mask> // data as []net.IP or []*netutil.IPPort. Maybe someday.
<mask> addrs, err := collectDNSAddresses()
<mask> if err != nil {
<mask> return nil, err
<mask> }
<mask>
<mask> for _, addr := range addrs {
<mask> ip := net.ParseIP(addr)
<mask> if ip != nil && !ip.IsLoopback() {
<mask> ips = append(ips, ip)
<mask> }
<mask> }
<mask>
<mask> return ips, nil
<mask> }
</s> Pull request: home: rollback serveraddresses in mobileconfig
Updates #3607.
Squashed commit of the following:
commit 1f0a970b4265a59819ec139e51c98dc9376d995b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Sep 30 13:26:49 2021 +0300
home: rollback serveraddresses in mobileconfig </s> remove dnsIPs, err := collectDNSIPs()
if err != nil {
// Don't add a lot of formatting, since the error is already
// wrapped by collectDNSIPs.
respondJSONError(w, http.StatusInternalServerError, err.Error())
return
}
</s> add </s> add //
// TODO(a.garipov): Allow users to set this.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3607. </s> remove DNSProtocol: dnsp,
ServerName: host,
ServerAddresses: dnsIPs,
</s> add DNSProtocol: dnsp,
ServerName: host, </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a4e078271cec4efad5aea95a32dc46a3d86ea9ca | internal/home/mobileconfig.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> s := mc.PayloadContent[0].DNSSettings
<mask> require.NotNil(t, s)
<mask>
<mask> assert.NotEmpty(t, s.ServerAddresses)
<mask> assert.Empty(t, s.ServerName)
<mask> assert.Equal(t, "https://example.org/dns-query", s.ServerURL)
<mask> })
<mask>
<mask> t.Run("error_no_host", func(t *testing.T) {
</s> Pull request: home: rollback serveraddresses in mobileconfig
Updates #3607.
Squashed commit of the following:
commit 1f0a970b4265a59819ec139e51c98dc9376d995b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Sep 30 13:26:49 2021 +0300
home: rollback serveraddresses in mobileconfig </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove DNSProtocol: dnsp,
ServerName: host,
ServerAddresses: dnsIPs,
</s> add DNSProtocol: dnsp,
ServerName: host, </s> remove
// collectDNSIPs returns a slice of IP addresses the server is listening
// on, including the addresses on all interfaces in cases of unspecified IPs but
// excluding loopback addresses.
func collectDNSIPs() (ips []net.IP, err error) {
// TODO(a.garipov): This really shouldn't be a function that parses
// a list of strings. Instead, we need a function that returns this
// data as []net.IP or []*netutil.IPPort. Maybe someday.
addrs, err := collectDNSAddresses()
if err != nil {
return nil, err
}
for _, addr := range addrs {
ip := net.ParseIP(addr)
if ip != nil && !ip.IsLoopback() {
ips = append(ips, ip)
}
}
return ips, nil
}
</s> add </s> remove dnsIPs, err := collectDNSIPs()
if err != nil {
// Don't add a lot of formatting, since the error is already
// wrapped by collectDNSIPs.
respondJSONError(w, http.StatusInternalServerError, err.Error())
return
}
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a4e078271cec4efad5aea95a32dc46a3d86ea9ca | internal/home/mobileconfig_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> s := mc.PayloadContent[0].DNSSettings
<mask> require.NotNil(t, s)
<mask>
<mask> assert.NotEmpty(t, s.ServerAddresses)
<mask> assert.Empty(t, s.ServerName)
<mask> assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL)
<mask> })
<mask> }
<mask>
</s> Pull request: home: rollback serveraddresses in mobileconfig
Updates #3607.
Squashed commit of the following:
commit 1f0a970b4265a59819ec139e51c98dc9376d995b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Sep 30 13:26:49 2021 +0300
home: rollback serveraddresses in mobileconfig </s> remove dnsIPs, err := collectDNSIPs()
if err != nil {
// Don't add a lot of formatting, since the error is already
// wrapped by collectDNSIPs.
respondJSONError(w, http.StatusInternalServerError, err.Error())
return
}
</s> add </s> remove DNSProtocol: dnsp,
ServerName: host,
ServerAddresses: dnsIPs,
</s> add DNSProtocol: dnsp,
ServerName: host, </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove
// collectDNSIPs returns a slice of IP addresses the server is listening
// on, including the addresses on all interfaces in cases of unspecified IPs but
// excluding loopback addresses.
func collectDNSIPs() (ips []net.IP, err error) {
// TODO(a.garipov): This really shouldn't be a function that parses
// a list of strings. Instead, we need a function that returns this
// data as []net.IP or []*netutil.IPPort. Maybe someday.
addrs, err := collectDNSAddresses()
if err != nil {
return nil, err
}
for _, addr := range addrs {
ip := net.ParseIP(addr)
if ip != nil && !ip.IsLoopback() {
ips = append(ips, ip)
}
}
return ips, nil
}
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a4e078271cec4efad5aea95a32dc46a3d86ea9ca | internal/home/mobileconfig_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> s := mc.PayloadContent[0].DNSSettings
<mask> require.NotNil(t, s)
<mask>
<mask> assert.NotEmpty(t, s.ServerAddresses)
<mask> assert.Equal(t, "example.org", s.ServerName)
<mask> assert.Empty(t, s.ServerURL)
<mask> })
<mask>
<mask> t.Run("error_no_host", func(t *testing.T) {
</s> Pull request: home: rollback serveraddresses in mobileconfig
Updates #3607.
Squashed commit of the following:
commit 1f0a970b4265a59819ec139e51c98dc9376d995b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Sep 30 13:26:49 2021 +0300
home: rollback serveraddresses in mobileconfig </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove DNSProtocol: dnsp,
ServerName: host,
ServerAddresses: dnsIPs,
</s> add DNSProtocol: dnsp,
ServerName: host, </s> remove
// collectDNSIPs returns a slice of IP addresses the server is listening
// on, including the addresses on all interfaces in cases of unspecified IPs but
// excluding loopback addresses.
func collectDNSIPs() (ips []net.IP, err error) {
// TODO(a.garipov): This really shouldn't be a function that parses
// a list of strings. Instead, we need a function that returns this
// data as []net.IP or []*netutil.IPPort. Maybe someday.
addrs, err := collectDNSAddresses()
if err != nil {
return nil, err
}
for _, addr := range addrs {
ip := net.ParseIP(addr)
if ip != nil && !ip.IsLoopback() {
ips = append(ips, ip)
}
}
return ips, nil
}
</s> add </s> remove dnsIPs, err := collectDNSIPs()
if err != nil {
// Don't add a lot of formatting, since the error is already
// wrapped by collectDNSIPs.
respondJSONError(w, http.StatusInternalServerError, err.Error())
return
}
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a4e078271cec4efad5aea95a32dc46a3d86ea9ca | internal/home/mobileconfig_test.go |
keep keep keep keep replace keep keep keep keep | <mask>
<mask> s := mc.PayloadContent[0].DNSSettings
<mask> require.NotNil(t, s)
<mask>
<mask> assert.NotEmpty(t, s.ServerAddresses)
<mask> assert.Equal(t, "cli42.example.org", s.ServerName)
<mask> assert.Empty(t, s.ServerURL)
<mask> })
<mask> }
</s> Pull request: home: rollback serveraddresses in mobileconfig
Updates #3607.
Squashed commit of the following:
commit 1f0a970b4265a59819ec139e51c98dc9376d995b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Sep 30 13:26:49 2021 +0300
home: rollback serveraddresses in mobileconfig </s> remove dnsIPs, err := collectDNSIPs()
if err != nil {
// Don't add a lot of formatting, since the error is already
// wrapped by collectDNSIPs.
respondJSONError(w, http.StatusInternalServerError, err.Error())
return
}
</s> add </s> remove DNSProtocol: dnsp,
ServerName: host,
ServerAddresses: dnsIPs,
</s> add DNSProtocol: dnsp,
ServerName: host, </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove
// collectDNSIPs returns a slice of IP addresses the server is listening
// on, including the addresses on all interfaces in cases of unspecified IPs but
// excluding loopback addresses.
func collectDNSIPs() (ips []net.IP, err error) {
// TODO(a.garipov): This really shouldn't be a function that parses
// a list of strings. Instead, we need a function that returns this
// data as []net.IP or []*netutil.IPPort. Maybe someday.
addrs, err := collectDNSAddresses()
if err != nil {
return nil, err
}
for _, addr := range addrs {
ip := net.ParseIP(addr)
if ip != nil && !ip.IsLoopback() {
ips = append(ips, ip)
}
}
return ips, nil
}
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add </s> remove assert.NotEmpty(t, s.ServerAddresses)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a4e078271cec4efad5aea95a32dc46a3d86ea9ca | internal/home/mobileconfig_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> import Card from '../ui/Card';
<mask> import Cell from '../ui/Cell';
<mask>
<mask> import { getPercent, getClientName } from '../../helpers/helpers';
<mask> import { STATUS_COLORS } from '../../helpers/constants';
<mask>
<mask> const getClientsPercentColor = (percent) => {
<mask> if (percent > 50) {
<mask> return STATUS_COLORS.green;
</s> + client: add whois info to dashboard and logs </s> add import { formatClientCell } from '../../helpers/formatClientCell'; </s> remove import { formatTime, formatDateTime, getClientName } from '../../helpers/helpers';
</s> add import { formatTime, formatDateTime } from '../../helpers/helpers'; </s> add import { formatClientCell } from '../../helpers/formatClientCell';
</s> remove export const getClientName = (clients, ip) => {
</s> add const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
export const getClientInfo = (clients, ip) => { </s> remove return (client && client.name) || '';
</s> add if (!client) {
return '';
}
const { name, whois_info } = client;
const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
return { name, whois }; </s> add const { clients, autoClients } = dashboard; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Dashboard/Clients.js |
keep add keep keep keep keep keep | <mask> import { getPercent } from '../../helpers/helpers';
<mask> import { STATUS_COLORS } from '../../helpers/constants';
<mask>
<mask> const getClientsPercentColor = (percent) => {
<mask> if (percent > 50) {
<mask> return STATUS_COLORS.green;
<mask> } else if (percent > 10) {
</s> + client: add whois info to dashboard and logs </s> remove import { getPercent, getClientName } from '../../helpers/helpers';
</s> add import { getPercent } from '../../helpers/helpers'; </s> remove import { formatTime, formatDateTime, getClientName } from '../../helpers/helpers';
</s> add import { formatTime, formatDateTime } from '../../helpers/helpers'; </s> add import { formatClientCell } from '../../helpers/formatClientCell';
</s> remove export const getClientName = (clients, ip) => {
</s> add const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
export const getClientInfo = (clients, ip) => { </s> remove return (client && client.name) || '';
</s> add if (!client) {
return '';
}
const { name, whois_info } = client;
const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
return { name, whois }; </s> remove return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
</s> add return <Cell value={value} percent={percent} color={percentColor} />; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Dashboard/Clients.js |
keep replace keep replace | <mask>
<mask> const ipCell = (clients, autoClients) =>
<mask> function cell(row) {
<mask> let client;
</s> + client: add whois info to dashboard and logs </s> remove const clientName = getClientName(clients, value) || getClientName(autoClients, value);
if (clientName) {
client = (
<span>
{clientName} <small>({value})</small>
</span>
);
} else {
client = value;
}
</s> add const percent = getPercent(dnsQueries, value);
const percentColor = getClientsPercentColor(percent); </s> remove const countCell = dnsQueries =>
</s> add const clientCell = (clients, autoClients) => </s> remove const percent = getPercent(dnsQueries, value);
const percentColor = getClientsPercentColor(percent);
</s> add </s> remove return (client && client.name) || '';
</s> add if (!client) {
return '';
}
const { name, whois_info } = client;
const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
return { name, whois }; </s> remove return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
</s> add return <Cell value={value} percent={percent} color={percentColor} />; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Dashboard/Clients.js |
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep replace replace replace replace replace replace replace keep | <mask> const ipCell = (clients, autoClients) =>
<mask> function cell(row) {
<mask> let client;
<mask> const { value } = row;
<mask> const clientName = getClientName(clients, value) || getClientName(autoClients, value);
<mask>
<mask> if (clientName) {
<mask> client = (
<mask> <span>
<mask> {clientName} <small>({value})</small>
<mask> </span>
<mask> );
<mask> } else {
<mask> client = value;
<mask> }
<mask>
<mask> return (
<mask> <div className="logs__row logs__row--overflow">
<mask> <span className="logs__text" title={value}>
<mask> {client}
<mask> </span>
<mask> </div>
<mask> );
<mask> };
</s> + client: add whois info to dashboard and logs </s> remove let client;
</s> add </s> remove const clientName =
getClientName(dashboard.clients, value) || getClientName(dashboard.autoClients, value);
let client = value;
if (clientName) {
client = (
<span>
{clientName} <small>({value})</small>
</span>
);
}
</s> add </s> remove const ipCell = (clients, autoClients) =>
</s> add const countCell = dnsQueries => </s> remove const countCell = dnsQueries =>
</s> add const clientCell = (clients, autoClients) => </s> remove return <Cell value={value} percent={percent} color={percentColor} />;
</s> add return (
<div className="logs__row logs__row--overflow logs__row--column">
{formatClientCell(value, clients, autoClients)}
</div>
); | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Dashboard/Clients.js |
keep keep keep replace keep keep keep keep keep keep keep keep replace replace keep keep | <mask> );
<mask> };
<mask>
<mask> const countCell = dnsQueries =>
<mask> function cell(row) {
<mask> const { value } = row;
<mask> const percent = getPercent(dnsQueries, value);
<mask> const percentColor = getClientsPercentColor(percent);
<mask>
<mask> const countCell = dnsQueries =>
<mask> function cell(row) {
<mask> const { value } = row;
<mask> const percent = getPercent(dnsQueries, value);
<mask> const percentColor = getClientsPercentColor(percent);
<mask>
<mask> return <Cell value={value} percent={percent} color={percentColor} />;
</s> + client: add whois info to dashboard and logs </s> remove return <Cell value={value} percent={percent} color={percentColor} />;
</s> add return (
<div className="logs__row logs__row--overflow logs__row--column">
{formatClientCell(value, clients, autoClients)}
</div>
); </s> remove return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
</s> add return <Cell value={value} percent={percent} color={percentColor} />; </s> remove const clientName = getClientName(clients, value) || getClientName(autoClients, value);
if (clientName) {
client = (
<span>
{clientName} <small>({value})</small>
</span>
);
} else {
client = value;
}
</s> add const percent = getPercent(dnsQueries, value);
const percentColor = getClientsPercentColor(percent); </s> remove const ipCell = (clients, autoClients) =>
</s> add const countCell = dnsQueries => </s> remove let client;
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Dashboard/Clients.js |
keep keep keep keep replace keep keep keep keep keep | <mask> const { value } = row;
<mask> const percent = getPercent(dnsQueries, value);
<mask> const percentColor = getClientsPercentColor(percent);
<mask>
<mask> return <Cell value={value} percent={percent} color={percentColor} />;
<mask> };
<mask>
<mask> const Clients = ({
<mask> t, refreshButton, topClients, subtitle, clients, autoClients, dnsQueries,
<mask> }) => (
</s> + client: add whois info to dashboard and logs </s> remove const percent = getPercent(dnsQueries, value);
const percentColor = getClientsPercentColor(percent);
</s> add </s> remove return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
</s> add return <Cell value={value} percent={percent} color={percentColor} />; </s> remove const countCell = dnsQueries =>
</s> add const clientCell = (clients, autoClients) => </s> remove const clientName = getClientName(clients, value) || getClientName(autoClients, value);
if (clientName) {
client = (
<span>
{clientName} <small>({value})</small>
</span>
);
} else {
client = value;
}
</s> add const percent = getPercent(dnsQueries, value);
const percentColor = getClientsPercentColor(percent); </s> add const { clients, autoClients } = dashboard; </s> remove const ipCell = (clients, autoClients) =>
</s> add const countCell = dnsQueries => | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Dashboard/Clients.js |
keep keep keep keep replace keep keep keep keep keep | <mask> Header: 'IP',
<mask> accessor: 'ip',
<mask> sortMethod: (a, b) =>
<mask> parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
<mask> Cell: ipCell(clients, autoClients),
<mask> },
<mask> {
<mask> Header: <Trans>requests_count</Trans>,
<mask> accessor: 'count',
<mask> Cell: countCell(dnsQueries),
</s> + client: add whois info to dashboard and logs </s> remove maxWidth: 220,
minWidth: 220,
</s> add maxWidth: 240,
minWidth: 240, </s> remove minWidth: 210,
</s> add minWidth: 180, </s> add minWidth: 120, </s> remove return (client && client.name) || '';
</s> add if (!client) {
return '';
}
const { name, whois_info } = client;
const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
return { name, whois }; </s> add import { formatClientCell } from '../../helpers/formatClientCell'; </s> remove export const getClientName = (clients, ip) => {
</s> add const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
export const getClientInfo = (clients, ip) => { | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Dashboard/Clients.js |
keep keep keep keep replace keep keep keep keep keep | <mask> justify-content: center;
<mask> }
<mask>
<mask> .logs__row--column {
<mask> align-items: flex-start;
<mask> flex-direction: column;
<mask> }
<mask>
<mask> .logs__row--overflow {
<mask> overflow: hidden;
</s> + client: add whois info to dashboard and logs </s> add align-items: flex-start;
justify-content: center; </s> add import { formatClientCell } from '../../helpers/formatClientCell'; </s> remove import { formatTime, formatDateTime, getClientName } from '../../helpers/helpers';
</s> add import { formatTime, formatDateTime } from '../../helpers/helpers'; </s> remove import { getPercent, getClientName } from '../../helpers/helpers';
</s> add import { getPercent } from '../../helpers/helpers'; </s> add line-height: 1.4; </s> add const { clients, autoClients } = dashboard; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Logs/Logs.css |
keep keep keep add keep keep keep keep keep keep | <mask> }
<mask>
<mask> .logs__row--column {
<mask> flex-direction: column;
<mask> }
<mask>
<mask> .logs__row--overflow {
<mask> overflow: hidden;
<mask> }
<mask>
</s> + client: add whois info to dashboard and logs </s> remove align-items: flex-start;
</s> add </s> add import { formatClientCell } from '../../helpers/formatClientCell'; </s> remove import { formatTime, formatDateTime, getClientName } from '../../helpers/helpers';
</s> add import { formatTime, formatDateTime } from '../../helpers/helpers'; </s> add line-height: 1.4; </s> remove import { getPercent, getClientName } from '../../helpers/helpers';
</s> add import { getPercent } from '../../helpers/helpers'; </s> add const { clients, autoClients } = dashboard; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Logs/Logs.css |
keep keep add keep keep keep keep keep keep | <mask> }
<mask>
<mask> .logs__text--wrap {
<mask> white-space: normal;
<mask> }
<mask>
<mask> .logs__row .tooltip-custom {
<mask> top: 0;
<mask> margin-left: 0;
</s> + client: add whois info to dashboard and logs </s> add import { formatClientCell } from '../../helpers/formatClientCell'; </s> add align-items: flex-start;
justify-content: center; </s> remove import { formatTime, formatDateTime, getClientName } from '../../helpers/helpers';
</s> add import { formatTime, formatDateTime } from '../../helpers/helpers'; </s> remove align-items: flex-start;
</s> add </s> remove import { getPercent, getClientName } from '../../helpers/helpers';
</s> add import { getPercent } from '../../helpers/helpers'; </s> add const { clients, autoClients } = dashboard; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Logs/Logs.css |
keep keep keep keep replace keep keep keep keep keep | <mask> import endsWith from 'lodash/endsWith';
<mask> import { Trans, withNamespaces } from 'react-i18next';
<mask> import { HashLink as Link } from 'react-router-hash-link';
<mask>
<mask> import { formatTime, formatDateTime, getClientName } from '../../helpers/helpers';
<mask> import { SERVICES, FILTERED_STATUS } from '../../helpers/constants';
<mask> import { getTrackerData } from '../../helpers/trackers/trackers';
<mask> import PageTitle from '../ui/PageTitle';
<mask> import Card from '../ui/Card';
<mask> import Loading from '../ui/Loading';
</s> + client: add whois info to dashboard and logs </s> add import { formatClientCell } from '../../helpers/formatClientCell';
</s> remove import { getPercent, getClientName } from '../../helpers/helpers';
</s> add import { getPercent } from '../../helpers/helpers'; </s> add import { formatClientCell } from '../../helpers/formatClientCell'; </s> add align-items: flex-start;
justify-content: center; </s> remove align-items: flex-start;
</s> add </s> add line-height: 1.4; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Logs/index.js |
keep keep keep add keep keep keep keep keep keep | <mask>
<mask> import { formatTime, formatDateTime } from '../../helpers/helpers';
<mask> import { SERVICES, FILTERED_STATUS } from '../../helpers/constants';
<mask> import { getTrackerData } from '../../helpers/trackers/trackers';
<mask> import PageTitle from '../ui/PageTitle';
<mask> import Card from '../ui/Card';
<mask> import Loading from '../ui/Loading';
<mask> import PopoverFiltered from '../ui/PopoverFilter';
<mask> import Popover from '../ui/Popover';
<mask> import './Logs.css';
</s> + client: add whois info to dashboard and logs </s> remove import { formatTime, formatDateTime, getClientName } from '../../helpers/helpers';
</s> add import { formatTime, formatDateTime } from '../../helpers/helpers'; </s> remove import { getPercent, getClientName } from '../../helpers/helpers';
</s> add import { getPercent } from '../../helpers/helpers'; </s> add import { formatClientCell } from '../../helpers/formatClientCell'; </s> add align-items: flex-start;
justify-content: center; </s> remove align-items: flex-start;
</s> add </s> add line-height: 1.4; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Logs/index.js |
keep add keep keep keep keep | <mask> getClientCell = ({ original, value }) => {
<mask> const { dashboard } = this.props;
<mask> const { reason, domain } = original;
<mask> const isFiltered = this.checkFiltered(reason);
<mask> const isRewrite = this.checkRewrite(reason);
<mask>
</s> + client: add whois info to dashboard and logs </s> remove const clientName =
getClientName(dashboard.clients, value) || getClientName(dashboard.autoClients, value);
let client = value;
if (clientName) {
client = (
<span>
{clientName} <small>({value})</small>
</span>
);
}
</s> add </s> remove const percent = getPercent(dnsQueries, value);
const percentColor = getClientsPercentColor(percent);
</s> add </s> remove return <Cell value={value} percent={percent} color={percentColor} />;
</s> add return (
<div className="logs__row logs__row--overflow logs__row--column">
{formatClientCell(value, clients, autoClients)}
</div>
); </s> remove const countCell = dnsQueries =>
</s> add const clientCell = (clients, autoClients) => </s> remove const ipCell = (clients, autoClients) =>
</s> add const countCell = dnsQueries => </s> remove let client;
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Logs/index.js |
keep keep replace replace replace replace replace replace replace replace replace replace replace keep keep keep replace | <mask> const isFiltered = this.checkFiltered(reason);
<mask> const isRewrite = this.checkRewrite(reason);
<mask> const clientName =
<mask> getClientName(dashboard.clients, value) || getClientName(dashboard.autoClients, value);
<mask> let client = value;
<mask>
<mask> if (clientName) {
<mask> client = (
<mask> <span>
<mask> {clientName} <small>({value})</small>
<mask> </span>
<mask> );
<mask> }
<mask>
<mask> return (
<mask> <Fragment>
<mask> <div className="logs__row">{client}</div>
</s> + client: add whois info to dashboard and logs | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Logs/index.js |
keep keep keep keep replace replace keep keep keep keep keep | <mask> },
<mask> {
<mask> Header: t('client_table_header'),
<mask> accessor: 'client',
<mask> maxWidth: 220,
<mask> minWidth: 220,
<mask> Cell: this.getClientCell,
<mask> },
<mask> ];
<mask>
<mask> if (logs) {
</s> + client: add whois info to dashboard and logs </s> remove minWidth: 210,
</s> add minWidth: 180, </s> remove Cell: ipCell(clients, autoClients),
</s> add Cell: clientCell(clients, autoClients), </s> add minWidth: 120, </s> add import { formatClientCell } from '../../helpers/formatClientCell'; </s> remove import { getPercent, getClientName } from '../../helpers/helpers';
</s> add import { getPercent } from '../../helpers/helpers'; </s> remove let client;
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Logs/index.js |
keep keep keep keep replace keep keep keep keep keep | <mask> },
<mask> {
<mask> Header: this.props.t('blocked_services'),
<mask> accessor: 'blocked_services',
<mask> minWidth: 210,
<mask> Cell: (row) => {
<mask> const { value, original } = row;
<mask>
<mask> if (original.use_global_blocked_services) {
<mask> return <Trans>settings_global</Trans>;
</s> + client: add whois info to dashboard and logs </s> add minWidth: 120, </s> remove maxWidth: 220,
minWidth: 220,
</s> add maxWidth: 240,
minWidth: 240, </s> remove Cell: ipCell(clients, autoClients),
</s> add Cell: clientCell(clients, autoClients), </s> remove export const getClientName = (clients, ip) => {
</s> add const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
export const getClientInfo = (clients, ip) => { </s> add import { formatClientCell } from '../../helpers/formatClientCell'; </s> remove return (client && client.name) || '';
</s> add if (!client) {
return '';
}
const { name, whois_info } = client;
const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
return { name, whois }; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Settings/Clients/ClientsTable.js |
keep keep add keep keep keep keep | <mask> {
<mask> Header: this.props.t('requests_count'),
<mask> accessor: 'statistics',
<mask> Cell: (row) => {
<mask> const clientIP = row.original.ip;
<mask> const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
<mask>
</s> + client: add whois info to dashboard and logs </s> remove minWidth: 210,
</s> add minWidth: 180, </s> remove return (client && client.name) || '';
</s> add if (!client) {
return '';
}
const { name, whois_info } = client;
const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
return { name, whois }; </s> remove Cell: ipCell(clients, autoClients),
</s> add Cell: clientCell(clients, autoClients), </s> remove export const getClientName = (clients, ip) => {
</s> add const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
export const getClientInfo = (clients, ip) => { </s> remove maxWidth: 220,
minWidth: 220,
</s> add maxWidth: 240,
minWidth: 240, </s> add const { clients, autoClients } = dashboard; | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/components/Settings/Clients/ClientsTable.js |
keep keep replace keep replace keep keep keep keep | <mask> export const normalizeTextarea = text => text && text.replace(/[;, ]/g, '\n').split('\n').filter(n => n);
<mask>
<mask> export const getClientName = (clients, ip) => {
<mask> const client = clients.find(item => ip === item.ip);
<mask> return (client && client.name) || '';
<mask> };
<mask>
<mask> export const sortClients = (clients) => {
<mask> const compare = (a, b) => {
</s> + client: add whois info to dashboard and logs </s> remove const ipCell = (clients, autoClients) =>
</s> add const countCell = dnsQueries => </s> add minWidth: 120, </s> remove let client;
</s> add </s> remove const countCell = dnsQueries =>
</s> add const clientCell = (clients, autoClients) => </s> remove const clientName = getClientName(clients, value) || getClientName(autoClients, value);
if (clientName) {
client = (
<span>
{clientName} <small>({value})</small>
</span>
);
} else {
client = value;
}
</s> add const percent = getPercent(dnsQueries, value);
const percentColor = getClientsPercentColor(percent); | https://github.com/AdguardTeam/AdGuardHome/commit/a52715e0863af0a9e1b26dbf96fc7cced02ae4f6 | client/src/helpers/helpers.js |
keep add keep keep keep keep | <mask>
<mask> var configBytes bytes.Buffer
<mask> // run the template
<mask> err = t.Execute(&configBytes, &temporaryConfig)
<mask> if err != nil {
<mask> log.Printf("Couldn't generate DNS config: %s", err)
</s> Stop requiring current working directory to be the location of AdGuardHome.
Fixes #381. </s> remove err = t.Execute(&configBytes, config.CoreDNS)
</s> add err = t.Execute(&configBytes, &temporaryConfig) </s> add configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
os.Args = os.Args[:1]
os.Args = append(os.Args, "-conf")
os.Args = append(os.Args, configpath)
</s> remove
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
</s> add </s> remove "sync"
</s> add "os"
"path/filepath"
"sync" // Include all plugins. </s> remove // Include all plugins.
</s> add </s> add "github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain" | https://github.com/AdguardTeam/AdGuardHome/commit/a528ed9f947d42f4324cd4f2263a015d34d7341f | config.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> var configBytes bytes.Buffer
<mask> // run the template
<mask> err = t.Execute(&configBytes, config.CoreDNS)
<mask> if err != nil {
<mask> log.Printf("Couldn't generate DNS config: %s", err)
<mask> return "", err
<mask> }
<mask> configtext := configBytes.String()
</s> Stop requiring current working directory to be the location of AdGuardHome.
Fixes #381. </s> add temporaryConfig := config.CoreDNS
temporaryConfig.FilterFile = filepath.Join(config.ourBinaryDir, config.CoreDNS.FilterFile) </s> add configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
os.Args = os.Args[:1]
os.Args = append(os.Args, "-conf")
os.Args = append(os.Args, configpath)
</s> remove
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
</s> add </s> remove "sync"
</s> add "os"
"path/filepath"
"sync" // Include all plugins. </s> remove // Include all plugins.
</s> add </s> add "github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain" | https://github.com/AdguardTeam/AdGuardHome/commit/a528ed9f947d42f4324cd4f2263a015d34d7341f | config.go |
keep replace keep replace | <mask> "log"
<mask> "sync"
<mask>
<mask> // Include all plugins.
</s> Stop requiring current working directory to be the location of AdGuardHome.
Fixes #381. </s> add "github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain" </s> remove
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
</s> add </s> add temporaryConfig := config.CoreDNS
temporaryConfig.FilterFile = filepath.Join(config.ourBinaryDir, config.CoreDNS.FilterFile) </s> remove err = t.Execute(&configBytes, config.CoreDNS)
</s> add err = t.Execute(&configBytes, &temporaryConfig) </s> add configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
os.Args = os.Args[:1]
os.Args = append(os.Args, "-conf")
os.Args = append(os.Args, configpath)
| https://github.com/AdguardTeam/AdGuardHome/commit/a528ed9f947d42f4324cd4f2263a015d34d7341f | coredns.go |
keep keep keep add keep keep keep keep keep keep | <mask> "path/filepath"
<mask> "sync" // Include all plugins.
<mask>
<mask> _ "github.com/AdguardTeam/AdGuardHome/coredns_plugin"
<mask> _ "github.com/coredns/coredns/plugin/auto"
<mask> _ "github.com/coredns/coredns/plugin/autopath"
<mask> _ "github.com/coredns/coredns/plugin/bind"
<mask> _ "github.com/coredns/coredns/plugin/cache"
<mask> _ "github.com/coredns/coredns/plugin/chaos"
<mask> _ "github.com/coredns/coredns/plugin/debug"
</s> Stop requiring current working directory to be the location of AdGuardHome.
Fixes #381. </s> remove // Include all plugins.
</s> add </s> remove "sync"
</s> add "os"
"path/filepath"
"sync" // Include all plugins. </s> remove
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
</s> add </s> add temporaryConfig := config.CoreDNS
temporaryConfig.FilterFile = filepath.Join(config.ourBinaryDir, config.CoreDNS.FilterFile) </s> remove err = t.Execute(&configBytes, config.CoreDNS)
</s> add err = t.Execute(&configBytes, &temporaryConfig) </s> add configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
os.Args = os.Args[:1]
os.Args = append(os.Args, "-conf")
os.Args = append(os.Args, configpath)
| https://github.com/AdguardTeam/AdGuardHome/commit/a528ed9f947d42f4324cd4f2263a015d34d7341f | coredns.go |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask> _ "github.com/coredns/coredns/plugin/template"
<mask> _ "github.com/coredns/coredns/plugin/tls"
<mask> _ "github.com/coredns/coredns/plugin/whoami"
<mask> _ "github.com/mholt/caddy/onevent"
<mask>
<mask> "github.com/coredns/coredns/core/dnsserver"
<mask> "github.com/coredns/coredns/coremain"
<mask> )
<mask>
<mask> // Directives are registered in the order they should be
<mask> // executed.
<mask> //
</s> Stop requiring current working directory to be the location of AdGuardHome.
Fixes #381. </s> add "github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain" </s> remove // Include all plugins.
</s> add </s> remove "sync"
</s> add "os"
"path/filepath"
"sync" // Include all plugins. </s> add temporaryConfig := config.CoreDNS
temporaryConfig.FilterFile = filepath.Join(config.ourBinaryDir, config.CoreDNS.FilterFile) </s> remove err = t.Execute(&configBytes, config.CoreDNS)
</s> add err = t.Execute(&configBytes, &temporaryConfig) </s> add configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
os.Args = os.Args[:1]
os.Args = append(os.Args, "-conf")
os.Args = append(os.Args, configpath)
| https://github.com/AdguardTeam/AdGuardHome/commit/a528ed9f947d42f4324cd4f2263a015d34d7341f | coredns.go |
keep add keep keep keep keep keep | <mask> isCoreDNSRunningLock.Unlock()
<mask>
<mask> err := writeCoreDNSConfig()
<mask> if err != nil {
<mask> errortext := fmt.Errorf("Unable to write coredns config: %s", err)
<mask> log.Println(errortext)
<mask> return errortext
</s> Stop requiring current working directory to be the location of AdGuardHome.
Fixes #381. </s> remove err = t.Execute(&configBytes, config.CoreDNS)
</s> add err = t.Execute(&configBytes, &temporaryConfig) </s> add temporaryConfig := config.CoreDNS
temporaryConfig.FilterFile = filepath.Join(config.ourBinaryDir, config.CoreDNS.FilterFile) </s> remove
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
</s> add </s> add "github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain" </s> remove // Include all plugins.
</s> add </s> remove "sync"
</s> add "os"
"path/filepath"
"sync" // Include all plugins. | https://github.com/AdguardTeam/AdGuardHome/commit/a528ed9f947d42f4324cd4f2263a015d34d7341f | coredns.go |
keep keep keep keep replace keep keep keep replace keep keep keep keep | <mask>
<mask> return clientID, nil
<mask> }
<mask>
<mask> // clientServerName returns the TLS server name based on the protocol.
<mask> func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) {
<mask> switch proto {
<mask> case proxy.ProtoHTTPS:
<mask> srvName = pctx.HTTPRequest.TLS.ServerName
<mask> case proxy.ProtoQUIC:
<mask> qConn := pctx.QUICConnection
<mask> conn, ok := qConn.(quicConnection)
<mask> if !ok {
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove httpReq = newHTTPReq(tc.cliSrvName)
</s> add httpReq = newHTTPReq(tc.cliSrvName, tc.inclHTTPTLS) </s> remove func newHTTPReq(cliSrvName string) (r *http.Request) {
</s> add func newHTTPReq(cliSrvName string, inclTLS bool) (r *http.Request) { </s> add return r </s> remove hostSrvName string
</s> add confSrvName string </s> remove },
</s> add } | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func TestServer_clientIDFromDNSContext(t *testing.T) {
<mask> testCases := []struct {
<mask> name string
<mask> proto proxy.Proto
<mask> hostSrvName string
<mask> cliSrvName string
<mask> wantClientID string
<mask> wantErrMsg string
<mask> strictSNI bool
<mask> }{{
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> add inclHTTPTLS bool </s> add return r </s> remove },
</s> add } </s> remove srvName = pctx.HTTPRequest.TLS.ServerName
</s> add r := pctx.HTTPRequest
if connState := r.TLS; connState != nil {
srvName = connState.ServerName
} else if r.Host != "" {
var host string
host, err = netutil.SplitHost(r.Host)
if err != nil {
return "", fmt.Errorf("parsing host: %w", err)
}
srvName = host
} </s> remove hostSrvName: "",
</s> add confSrvName: "", </s> remove ServerName: tc.hostSrvName,
</s> add ServerName: tc.confSrvName, | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep add keep keep keep keep | <mask> confSrvName string
<mask> cliSrvName string
<mask> wantClientID string
<mask> wantErrMsg string
<mask> strictSNI bool
<mask> }{{
<mask> name: "udp",
<mask> proto: proxy.ProtoUDP,
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName string
</s> add confSrvName string </s> remove hostSrvName: "",
</s> add confSrvName: "", </s> add return r </s> remove srvName = pctx.HTTPRequest.TLS.ServerName
</s> add r := pctx.HTTPRequest
if connState := r.TLS; connState != nil {
srvName = connState.ServerName
} else if r.Host != "" {
var host string
host, err = netutil.SplitHost(r.Host)
if err != nil {
return "", fmt.Errorf("parsing host: %w", err)
}
srvName = host
} </s> add inclHTTPTLS: true, </s> add inclHTTPTLS: false, | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> strictSNI bool
<mask> }{{
<mask> name: "udp",
<mask> proto: proxy.ProtoUDP,
<mask> hostSrvName: "",
<mask> cliSrvName: "",
<mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> strictSNI: false,
<mask> }, {
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> add inclHTTPTLS bool </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep add keep keep keep keep | <mask> confSrvName: "",
<mask> cliSrvName: "",
<mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> strictSNI: false,
<mask> }, {
<mask> name: "tls_no_clientid",
<mask> proto: proxy.ProtoTLS,
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "",
</s> add confSrvName: "", </s> add inclHTTPTLS: false, </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> strictSNI: false,
<mask> }, {
<mask> name: "tls_no_clientid",
<mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "example.com",
<mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> strictSNI: true,
<mask> }, {
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep add keep keep keep keep | <mask> cliSrvName: "example.com",
<mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> strictSNI: true,
<mask> }, {
<mask> name: "tls_no_client_server_name",
<mask> proto: proxy.ProtoTLS,
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep replace keep keep keep keep replace keep keep | <mask> }, {
<mask> name: "tls_no_client_server_name",
<mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "",
<mask> wantClientID: "",
<mask> wantErrMsg: `clientid check: client server name "" ` +
<mask> `doesn't match host server name "example.com"`,
<mask> strictSNI: true,
<mask> }, {
<mask> name: "tls_no_client_server_name_no_strict",
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> strictSNI: true,
<mask> }, {
<mask> name: "tls_no_client_server_name_no_strict",
<mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "",
<mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> strictSNI: false,
<mask> }, {
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep add keep keep keep keep keep | <mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> strictSNI: false,
<mask> }, {
<mask> name: "tls_clientid",
<mask> proto: proxy.ProtoTLS,
<mask> confSrvName: "example.com",
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> strictSNI: false,
<mask> }, {
<mask> name: "tls_clientid",
<mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "cli.example.com",
<mask> wantClientID: "cli",
<mask> wantErrMsg: "",
<mask> strictSNI: true,
<mask> }, {
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep add keep keep keep keep | <mask> cliSrvName: "cli.example.com",
<mask> wantClientID: "cli",
<mask> wantErrMsg: "",
<mask> strictSNI: true,
<mask> }, {
<mask> name: "tls_clientid_hostname_error",
<mask> proto: proxy.ProtoTLS,
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep replace keep keep keep keep replace keep keep | <mask> name: "tls_clientid_hostname_error",
<mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "cli.example.net",
<mask> wantClientID: "",
<mask> wantErrMsg: `clientid check: client server name "cli.example.net" ` +
<mask> `doesn't match host server name "example.com"`,
<mask> strictSNI: true,
<mask> }, {
<mask> name: "tls_invalid_clientid",
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep replace keep keep keep keep replace keep keep keep keep | <mask> }, {
<mask> name: "tls_invalid_clientid",
<mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "!!!.example.com",
<mask> wantClientID: "",
<mask> wantErrMsg: `clientid check: invalid clientid "!!!": ` +
<mask> `bad domain name label rune '!'`,
<mask> strictSNI: true,
<mask> }, {
<mask> name: "tls_clientid_too_long",
<mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> strictSNI: true,
<mask> }, {
<mask> name: "tls_clientid_too_long",
<mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: `abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmno` +
<mask> `pqrstuvwxyz0123456789.example.com`,
<mask> wantClientID: "",
<mask> wantErrMsg: `clientid check: invalid clientid "abcdefghijklmno` +
<mask> `pqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789": ` +
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep replace keep keep keep replace keep keep | <mask> `domain name label is too long: got 72, max 63`,
<mask> strictSNI: true,
<mask> }, {
<mask> name: "quic_clientid",
<mask> proto: proxy.ProtoQUIC,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "cli.example.com",
<mask> wantClientID: "cli",
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep add keep keep keep keep keep | <mask> wantClientID: "cli",
<mask> wantErrMsg: "",
<mask> strictSNI: true,
<mask> }, {
<mask> name: "tls_clientid_issue3437",
<mask> proto: proxy.ProtoTLS,
<mask> confSrvName: "example.com",
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep replace keep keep keep keep replace | <mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "cli.myexample.com",
<mask> wantClientID: "",
<mask> wantErrMsg: `clientid check: client server name "cli.myexample.com" ` +
<mask> `doesn't match host server name "example.com"`,
<mask> strictSNI: true,
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> strictSNI: true,
<mask> }, {
<mask> name: "tls_case",
<mask> proto: proxy.ProtoTLS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "InSeNsItIvE.example.com",
<mask> wantClientID: "insensitive",
<mask> wantErrMsg: ``,
<mask> strictSNI: true,
<mask> }, {
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> add inclHTTPTLS: false, </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep add keep keep keep keep | <mask> cliSrvName: "InSeNsItIvE.example.com",
<mask> wantClientID: "insensitive",
<mask> wantErrMsg: ``,
<mask> strictSNI: true,
<mask> }, {
<mask> name: "quic_case",
<mask> proto: proxy.ProtoQUIC,
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove strictSNI: true,
</s> add inclHTTPTLS: false,
strictSNI: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> strictSNI: true,
<mask> }, {
<mask> name: "quic_case",
<mask> proto: proxy.ProtoQUIC,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "InSeNsItIvE.example.com",
<mask> wantClientID: "insensitive",
<mask> wantErrMsg: ``,
<mask> strictSNI: true,
<mask> }, {
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep add keep keep keep keep keep | <mask> cliSrvName: "InSeNsItIvE.example.com",
<mask> wantClientID: "insensitive",
<mask> wantErrMsg: ``,
<mask> strictSNI: true,
<mask> }, {
<mask> name: "https_no_clientid",
<mask> proto: proxy.ProtoHTTPS,
<mask> confSrvName: "example.com",
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: true, | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> strictSNI: true,
<mask> }, {
<mask> name: "https_no_clientid",
<mask> proto: proxy.ProtoHTTPS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "example.com",
<mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> strictSNI: true,
<mask> }, {
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep add keep keep keep keep | <mask> wantClientID: "",
<mask> wantErrMsg: "",
<mask> strictSNI: true,
<mask> }, {
<mask> name: "https_clientid",
<mask> proto: proxy.ProtoHTTPS,
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> strictSNI: true,
<mask> }, {
<mask> name: "https_clientid",
<mask> proto: proxy.ProtoHTTPS,
<mask> hostSrvName: "example.com",
<mask> cliSrvName: "cli.example.com",
<mask> wantClientID: "cli",
<mask> wantErrMsg: "",
<mask> strictSNI: true,
<mask> }}
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> add inclHTTPTLS: true, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, </s> remove hostSrvName: "example.com",
</s> add confSrvName: "example.com", </s> add inclHTTPTLS: false, | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> tlsConf := TLSConfig{
<mask> ServerName: tc.hostSrvName,
<mask> StrictSNICheck: tc.strictSNI,
<mask> }
<mask>
<mask> srv := &Server{
<mask> conf: ServerConfig{TLSConfig: tlsConf},
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove },
</s> add } </s> add return r </s> remove hostSrvName string
</s> add confSrvName string </s> remove func newHTTPReq(cliSrvName string) (r *http.Request) {
</s> add func newHTTPReq(cliSrvName string, inclTLS bool) (r *http.Request) { </s> remove srvName = pctx.HTTPRequest.TLS.ServerName
</s> add r := pctx.HTTPRequest
if connState := r.TLS; connState != nil {
srvName = connState.ServerName
} else if r.Host != "" {
var host string
host, err = netutil.SplitHost(r.Host)
if err != nil {
return "", fmt.Errorf("parsing host: %w", err)
}
srvName = host
} </s> remove return &http.Request{
</s> add r = &http.Request{ | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> )
<mask>
<mask> switch tc.proto {
<mask> case proxy.ProtoHTTPS:
<mask> httpReq = newHTTPReq(tc.cliSrvName)
<mask> case proxy.ProtoQUIC:
<mask> qconn = testQUICConnection{
<mask> serverName: tc.cliSrvName,
<mask> }
<mask> case proxy.ProtoTLS:
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove srvName = pctx.HTTPRequest.TLS.ServerName
</s> add r := pctx.HTTPRequest
if connState := r.TLS; connState != nil {
srvName = connState.ServerName
} else if r.Host != "" {
var host string
host, err = netutil.SplitHost(r.Host)
if err != nil {
return "", fmt.Errorf("parsing host: %w", err)
}
srvName = host
} </s> remove // clientServerName returns the TLS server name based on the protocol.
</s> add // clientServerName returns the TLS server name based on the protocol. For
// DNS-over-HTTPS requests, it will return the hostname part of the Host header
// if there is one. </s> remove TLS: &tls.ConnectionState{
</s> add }
if inclTLS {
r.TLS = &tls.ConnectionState{ </s> remove return &http.Request{
</s> add r = &http.Request{ </s> add return r </s> remove },
</s> add } | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep replace keep keep keep keep replace keep keep | <mask> }
<mask>
<mask> // newHTTPReq is a helper to create HTTP requests for tests.
<mask> func newHTTPReq(cliSrvName string) (r *http.Request) {
<mask> u := &url.URL{
<mask> Path: "/dns-query",
<mask> }
<mask>
<mask> return &http.Request{
<mask> ProtoMajor: 1,
<mask> ProtoMinor: 1,
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove TLS: &tls.ConnectionState{
</s> add }
if inclTLS {
r.TLS = &tls.ConnectionState{ </s> add return r </s> remove // clientServerName returns the TLS server name based on the protocol.
</s> add // clientServerName returns the TLS server name based on the protocol. For
// DNS-over-HTTPS requests, it will return the hostname part of the Host header
// if there is one. </s> remove srvName = pctx.HTTPRequest.TLS.ServerName
</s> add r := pctx.HTTPRequest
if connState := r.TLS; connState != nil {
srvName = connState.ServerName
} else if r.Host != "" {
var host string
host, err = netutil.SplitHost(r.Host)
if err != nil {
return "", fmt.Errorf("parsing host: %w", err)
}
srvName = host
} </s> remove },
</s> add } | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep replace keep replace keep keep | <mask> URL: u,
<mask> Host: cliSrvName,
<mask> TLS: &tls.ConnectionState{
<mask> ServerName: cliSrvName,
<mask> },
<mask> }
<mask> }
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove return &http.Request{
</s> add r = &http.Request{ </s> remove ServerName: tc.hostSrvName,
</s> add ServerName: tc.confSrvName, </s> add return r </s> remove func newHTTPReq(cliSrvName string) (r *http.Request) {
</s> add func newHTTPReq(cliSrvName string, inclTLS bool) (r *http.Request) { </s> remove httpReq = newHTTPReq(tc.cliSrvName)
</s> add httpReq = newHTTPReq(tc.cliSrvName, tc.inclHTTPTLS) | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep add keep keep keep keep keep keep | <mask> }
<mask> }
<mask> }
<mask>
<mask> func TestClientIDFromDNSContextHTTPS(t *testing.T) {
<mask> testCases := []struct {
<mask> name string
<mask> path string
</s> Pull request 1742: 5518-doh-panic
Updates #5425.
Updates #5518.
Squashed commit of the following:
commit 74873bd47bab569d0a45361f2d87c0e33e0ed3fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:54:44 2023 +0300
dnsforward: use Host when available
commit 4eee3d655ec7eb84e0327dcf30603578772609e1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 20 17:24:24 2023 +0300
dnsforward: fix panic on unencrypted doh </s> remove },
</s> add } </s> remove hostSrvName string
</s> add confSrvName string </s> remove ServerName: tc.hostSrvName,
</s> add ServerName: tc.confSrvName, </s> remove func newHTTPReq(cliSrvName string) (r *http.Request) {
</s> add func newHTTPReq(cliSrvName string, inclTLS bool) (r *http.Request) { </s> remove srvName = pctx.HTTPRequest.TLS.ServerName
</s> add r := pctx.HTTPRequest
if connState := r.TLS; connState != nil {
srvName = connState.ServerName
} else if r.Host != "" {
var host string
host, err = netutil.SplitHost(r.Host)
if err != nil {
return "", fmt.Errorf("parsing host: %w", err)
}
srvName = host
} </s> add inclHTTPTLS bool | https://github.com/AdguardTeam/AdGuardHome/commit/a556ce8fb872284fe9d20dbe2109458cd50629ff | internal/dnsforward/clientid_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> go 1.17
<mask>
<mask> require (
<mask> github.com/AdguardTeam/dnsproxy v0.42.1
<mask> github.com/AdguardTeam/golibs v0.10.8
<mask> github.com/AdguardTeam/urlfilter v0.16.0
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/ameshkov/dnscrypt/v2 v2.2.3
<mask> github.com/digineo/go-ipset/v2 v2.2.1
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> remove github.com/fsnotify/fsnotify v1.5.1
</s> add github.com/fsnotify/fsnotify v1.5.4 </s> remove github.com/AdguardTeam/dnsproxy v0.42.1 h1:RZAtW75cvMX1d9Mibg0CA343V7VWV5PLrXsLhBZfdYc=
github.com/AdguardTeam/dnsproxy v0.42.1/go.mod h1:thHuk3599mgmucsv5J9HR9lBVQHnf4YleE08EbxNrN0=
</s> add github.com/AdguardTeam/dnsproxy v0.42.2 h1:aBhbuvqg/rZN8Rab5ILSfPFJDkiTviWXXcceJgajnNs=
github.com/AdguardTeam/dnsproxy v0.42.2/go.mod h1:thHuk3599mgmucsv5J9HR9lBVQHnf4YleE08EbxNrN0= </s> remove honnef.co/go/tools v0.3.0
</s> add honnef.co/go/tools v0.3.1 </s> remove github.com/google/go-cmp v0.5.7 // indirect
</s> add github.com/google/go-cmp v0.5.8 // indirect </s> add golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= </s> remove golang.org/x/net v0.0.0-20220412020605-290c469a71a5
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
</s> add golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.mod |
keep keep keep keep replace keep keep keep keep keep | <mask> github.com/AdguardTeam/urlfilter v0.16.0
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/ameshkov/dnscrypt/v2 v2.2.3
<mask> github.com/digineo/go-ipset/v2 v2.2.1
<mask> github.com/fsnotify/fsnotify v1.5.1
<mask> github.com/go-ping/ping v0.0.0-20211130115550-779d1e919534
<mask> github.com/google/go-cmp v0.5.7
<mask> github.com/google/gopacket v1.1.19
<mask> github.com/google/renameio v1.0.1
<mask> github.com/insomniacslk/dhcp v0.0.0-20220405050111-12fbdcb11b41
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> remove github.com/AdguardTeam/dnsproxy v0.42.1
</s> add github.com/AdguardTeam/dnsproxy v0.42.2 </s> remove github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
</s> add </s> remove github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
</s> add </s> remove github.com/google/go-cmp v0.5.7 // indirect
</s> add github.com/google/go-cmp v0.5.8 // indirect </s> add github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= </s> add github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.mod |
keep keep keep keep replace replace keep keep keep keep keep | <mask> github.com/stretchr/testify v1.7.0
<mask> github.com/ti-mo/netfilter v0.4.0
<mask> go.etcd.io/bbolt v1.3.6
<mask> golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
<mask> golang.org/x/net v0.0.0-20220412020605-290c469a71a5
<mask> golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
<mask> gopkg.in/natefinch/lumberjack.v2 v2.0.0
<mask> gopkg.in/yaml.v2 v2.4.0
<mask> howett.net/plist v1.0.0
<mask> )
<mask>
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> remove golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
</s> add golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect </s> remove golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=
golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
</s> add golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= </s> remove golang.org/x/exp/typeparams v0.0.0-20220407100705-7b9b53b0aca4 // indirect
</s> add golang.org/x/exp/typeparams v0.0.0-20220426173459-3bcf042a4bf5 // indirect </s> remove golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
</s> add </s> remove golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
</s> add golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.mod |
keep keep keep keep replace keep keep replace keep | <mask> github.com/pkg/errors v0.9.1 // indirect
<mask> github.com/pmezard/go-difflib v1.0.0 // indirect
<mask> github.com/stretchr/objx v0.1.1 // indirect
<mask> github.com/u-root/uio v0.0.0-20220204230159-dac05f7d2cb4 // indirect
<mask> golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
<mask> golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
<mask> golang.org/x/text v0.3.7 // indirect
<mask> golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a // indirect
<mask> golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> remove golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
</s> add golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect </s> remove golang.org/x/exp/typeparams v0.0.0-20220407100705-7b9b53b0aca4 // indirect
</s> add golang.org/x/exp/typeparams v0.0.0-20220426173459-3bcf042a4bf5 // indirect </s> remove github.com/google/go-cmp v0.5.7 // indirect
</s> add github.com/google/go-cmp v0.5.8 // indirect </s> remove golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a h1:ofrrl6c6NG5/IOSx/R1cyiQxxjqlur0h/TvbUhkH0II=
golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
</s> add golang.org/x/tools v0.1.11-0.20220426200323-dcaea06afc12 h1:pODAJF0uBqx6zFa1MYaiTobVo5FzCbnTVUXeO8o71fE=
golang.org/x/tools v0.1.11-0.20220426200323-dcaea06afc12/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= </s> remove honnef.co/go/tools v0.3.0
</s> add honnef.co/go/tools v0.3.1 | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.mod |
keep keep keep keep replace replace keep keep keep keep keep | <mask> dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU=
<mask> dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
<mask> dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
<mask> git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
<mask> github.com/AdguardTeam/dnsproxy v0.42.1 h1:RZAtW75cvMX1d9Mibg0CA343V7VWV5PLrXsLhBZfdYc=
<mask> github.com/AdguardTeam/dnsproxy v0.42.1/go.mod h1:thHuk3599mgmucsv5J9HR9lBVQHnf4YleE08EbxNrN0=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.10.4/go.mod h1:rSfQRGHIdgfxriDDNgNJ7HmE5zRoURq8R+VdR81Zuzw=
<mask> github.com/AdguardTeam/golibs v0.10.8 h1:diU9gP9qG1qeLbAkzIwfUerpHSqzR6zaBgzvRMR/m6Q=
<mask> github.com/AdguardTeam/golibs v0.10.8/go.mod h1:rSfQRGHIdgfxriDDNgNJ7HmE5zRoURq8R+VdR81Zuzw=
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> remove github.com/AdguardTeam/dnsproxy v0.42.1
</s> add github.com/AdguardTeam/dnsproxy v0.42.2 </s> remove github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
</s> add </s> remove golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
</s> add </s> add golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= </s> remove golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=
golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
</s> add golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= </s> remove github.com/fsnotify/fsnotify v1.5.1
</s> add github.com/fsnotify/fsnotify v1.5.4 | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.sum |
keep keep keep keep replace keep keep keep keep keep | <mask> github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
<mask> github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
<mask> github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
<mask> github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
<mask> github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
<mask> github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
<mask> github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
<mask> github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
<mask> github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
<mask> github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> add github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= </s> remove github.com/fsnotify/fsnotify v1.5.1
</s> add github.com/fsnotify/fsnotify v1.5.4 </s> remove golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a h1:ofrrl6c6NG5/IOSx/R1cyiQxxjqlur0h/TvbUhkH0II=
golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
</s> add golang.org/x/tools v0.1.11-0.20220426200323-dcaea06afc12 h1:pODAJF0uBqx6zFa1MYaiTobVo5FzCbnTVUXeO8o71fE=
golang.org/x/tools v0.1.11-0.20220426200323-dcaea06afc12/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= </s> add github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= </s> remove github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
</s> add </s> remove honnef.co/go/tools v0.3.0 h1:2LdYUZ7CIxnYgskbUZfY7FPggmqnh6shBqfWa8Tn3XU=
honnef.co/go/tools v0.3.0/go.mod h1:vlRD9XErLMGT+mDuofSr0mMMquscM/1nQqtRSsh6m70=
</s> add honnef.co/go/tools v0.3.1 h1:1kJlrWJLkaGXgcaeosRXViwviqjI7nkBvU2+sZW0AYc=
honnef.co/go/tools v0.3.1/go.mod h1:vlRD9XErLMGT+mDuofSr0mMMquscM/1nQqtRSsh6m70= | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.sum |
keep keep keep add keep keep keep keep keep | <mask> github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
<mask> github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
<mask> github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
<mask> github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
<mask> github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
<mask> github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
<mask> github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
<mask> github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
<mask> github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> remove github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
</s> add </s> remove github.com/fsnotify/fsnotify v1.5.1
</s> add github.com/fsnotify/fsnotify v1.5.4 </s> remove golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a h1:ofrrl6c6NG5/IOSx/R1cyiQxxjqlur0h/TvbUhkH0II=
golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
</s> add golang.org/x/tools v0.1.11-0.20220426200323-dcaea06afc12 h1:pODAJF0uBqx6zFa1MYaiTobVo5FzCbnTVUXeO8o71fE=
golang.org/x/tools v0.1.11-0.20220426200323-dcaea06afc12/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= </s> add github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= </s> remove github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
</s> add </s> remove honnef.co/go/tools v0.3.0 h1:2LdYUZ7CIxnYgskbUZfY7FPggmqnh6shBqfWa8Tn3XU=
honnef.co/go/tools v0.3.0/go.mod h1:vlRD9XErLMGT+mDuofSr0mMMquscM/1nQqtRSsh6m70=
</s> add honnef.co/go/tools v0.3.1 h1:1kJlrWJLkaGXgcaeosRXViwviqjI7nkBvU2+sZW0AYc=
honnef.co/go/tools v0.3.1/go.mod h1:vlRD9XErLMGT+mDuofSr0mMMquscM/1nQqtRSsh6m70= | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.sum |
keep keep keep keep replace keep keep keep keep keep | <mask> golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
<mask> golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
<mask> golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
<mask> golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
<mask> golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
<mask> golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
<mask> golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> add golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= </s> remove golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=
golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
</s> add golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= </s> remove golang.org/x/net v0.0.0-20220412020605-290c469a71a5
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
</s> add golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 </s> remove golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
</s> add golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect </s> remove golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
</s> add golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect </s> remove golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a // indirect
</s> add golang.org/x/tools v0.1.11-0.20220426200323-dcaea06afc12 // indirect | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.sum |
keep keep add keep keep keep keep keep | <mask> golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
<mask> golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
<mask> golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
<mask> golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> remove golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
</s> add </s> remove golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=
golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
</s> add golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= </s> remove golang.org/x/net v0.0.0-20220412020605-290c469a71a5
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
</s> add golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 </s> remove golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
</s> add golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect </s> remove golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
</s> add golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect </s> remove golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a // indirect
</s> add golang.org/x/tools v0.1.11-0.20220426200323-dcaea06afc12 // indirect | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.sum |
keep keep keep keep replace replace keep keep keep keep keep | <mask> golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
<mask> golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
<mask> golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
<mask> golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
<mask> golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=
<mask> golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
<mask> golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
<mask> golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
<mask> golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
<mask> golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
<mask> golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw=
</s> Pull request: all: upd dnsproxy, tools
Merge in DNS/adguard-home from upd-dnsproxy to master
Squashed commit of the following:
commit ea2a88dfd6e3820f0b3319d6aa09313de467e423
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Apr 27 14:24:49 2022 +0300
all: upd dnsproxy, tools </s> add golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= </s> remove golang.org/x/net v0.0.0-20220412020605-290c469a71a5
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
</s> add golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 </s> remove golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
</s> add </s> remove honnef.co/go/tools v0.3.0 h1:2LdYUZ7CIxnYgskbUZfY7FPggmqnh6shBqfWa8Tn3XU=
honnef.co/go/tools v0.3.0/go.mod h1:vlRD9XErLMGT+mDuofSr0mMMquscM/1nQqtRSsh6m70=
</s> add honnef.co/go/tools v0.3.1 h1:1kJlrWJLkaGXgcaeosRXViwviqjI7nkBvU2+sZW0AYc=
honnef.co/go/tools v0.3.1/go.mod h1:vlRD9XErLMGT+mDuofSr0mMMquscM/1nQqtRSsh6m70= </s> remove github.com/fsnotify/fsnotify v1.5.1
</s> add github.com/fsnotify/fsnotify v1.5.4 </s> remove golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
</s> add golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect | https://github.com/AdguardTeam/AdGuardHome/commit/a580149ad67b604a1e3c6e7b3483d856a51c905a | go.sum |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.