docstring_tokens
stringlengths 18
16.9k
| code_tokens
stringlengths 75
1.81M
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|
keep keep replace replace keep keep replace replace replace replace replace replace replace replace keep keep keep | <mask>
<mask> func BenchmarkSafeBrowsingParallel(b *testing.B) {
<mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
<mask> defer d.Close()
<mask> b.RunParallel(func(pb *testing.PB) {
<mask> for pb.Next() {
<mask> hostname := "wmconvirus.narod.ru"
<mask> res, err := d.CheckHost(hostname, dns.TypeA, &setts)
<mask> if err != nil {
<mask> b.Errorf("Error while matching host %s: %s", hostname, err)
<mask> }
<mask> if !res.IsFiltered {
<mask> b.Errorf("Expected hostname %s to match", hostname)
<mask> }
<mask> }
<mask> })
<mask> }
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove hostname := "wmconvirus.narod.ru"
res, err := d.CheckHost(hostname, dns.TypeA, &setts)
if err != nil {
b.Errorf("Error while matching host %s: %s", hostname, err)
}
if !res.IsFiltered {
b.Errorf("Expected hostname %s to match", hostname)
}
</s> add res, err := d.CheckHost(blocked, dns.TypeA, &setts)
assert.Nilf(b, err, "Error while matching host %s: %s", blocked, err)
assert.True(b, res.IsFiltered, "Expected hostname %s to match", blocked) </s> remove if err != nil {
t.Errorf("Error while matching host %s: %s", hostname, err)
}
if !res.IsFiltered {
t.Errorf("Expected hostname %s to match", hostname)
}
</s> add assert.Nilf(t, err, "Error while matching host %s: %s", hostname, err)
assert.Truef(t, res.IsFiltered, "Expected hostname %s to match", hostname) </s> remove if err != nil {
t.Errorf("Error while matching host %s: %s", hostname, err)
}
if res.IsFiltered {
t.Errorf("Expected hostname %s to not match", hostname)
}
</s> add assert.Nilf(t, err, "Error while matching host %s: %s", hostname, err)
assert.Falsef(t, res.IsFiltered, "Expected hostname %s to not match", hostname) </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
b.Cleanup(d.Close)
blocked := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: blocked,
block: true,
} </s> remove if err != nil {
t.Errorf("Error while matching host %s: %s", hostname, err)
}
if !res.IsFiltered {
t.Errorf("Expected hostname %s to match", hostname)
}
if len(res.Rules) == 0 {
t.Errorf("Expected result to have rules")
return
}
r := res.Rules[0]
if r.IP == nil || r.IP.String() != ip {
t.Errorf("Expected ip %s to match, actual: %v", ip, r.IP)
</s> add assert.Nilf(t, err, "Error while matching host %s: %s", hostname, err)
assert.Truef(t, res.IsFiltered, "Expected hostname %s to match", hostname)
if assert.NotEmpty(t, res.Rules, "Expected result to have rules") {
r := res.Rules[0]
assert.NotNilf(t, r.IP, "Expected ip %s to match, actual: %v", ip, r.IP)
assert.Equalf(t, ip, r.IP.String(), "Expected ip %s to match, actual: %v", ip, r.IP) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/dnsfilter_test.go |
keep keep replace replace keep keep replace replace replace replace replace replace keep | <mask>
<mask> func BenchmarkSafeSearch(b *testing.B) {
<mask> d := NewForTest(&Config{SafeSearchEnabled: true}, nil)
<mask> defer d.Close()
<mask> for n := 0; n < b.N; n++ {
<mask> val, ok := d.SafeSearchDomain("www.google.com")
<mask> if !ok {
<mask> b.Errorf("Expected safesearch to find result for www.google.com")
<mask> }
<mask> if val != "forcesafesearch.google.com" {
<mask> b.Errorf("Expected safesearch for google.com to be forcesafesearch.google.com")
<mask> }
<mask> }
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove if !ok {
b.Errorf("Expected safesearch to find result for www.google.com")
}
if val != "forcesafesearch.google.com" {
b.Errorf("Expected safesearch for google.com to be forcesafesearch.google.com")
}
</s> add assert.True(b, ok, "Expected safesearch to find result for www.google.com")
assert.Equal(b, "forcesafesearch.google.com", val, "Expected safesearch for google.com to be forcesafesearch.google.com") </s> remove if !ok {
t.Errorf("Expected safesearch to find result for www.google.com")
}
if val != "forcesafesearch.google.com" {
t.Errorf("Expected safesearch for google.com to be forcesafesearch.google.com")
}
</s> add assert.True(t, ok, "Expected safesearch to find result for www.google.com")
assert.Equal(t, "forcesafesearch.google.com", val, "Expected safesearch for google.com to be forcesafesearch.google.com") </s> remove d := NewForTest(&Config{SafeSearchEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeSearchEnabled: true}, nil)
b.Cleanup(d.Close) </s> remove d := NewForTest(&Config{SafeSearchEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeSearchEnabled: true}, nil)
t.Cleanup(d.Close) </s> remove hostname := "wmconvirus.narod.ru"
res, err := d.CheckHost(hostname, dns.TypeA, &setts)
if err != nil {
b.Errorf("Error while matching host %s: %s", hostname, err)
}
if !res.IsFiltered {
b.Errorf("Expected hostname %s to match", hostname)
}
</s> add res, err := d.CheckHost(blocked, dns.TypeA, &setts)
assert.Nilf(b, err, "Error while matching host %s: %s", blocked, err)
assert.True(b, res.IsFiltered, "Expected hostname %s to match", blocked) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/dnsfilter_test.go |
keep keep keep keep replace replace keep keep keep replace replace replace replace replace replace keep | <mask> }
<mask> }
<mask>
<mask> func BenchmarkSafeSearchParallel(b *testing.B) {
<mask> d := NewForTest(&Config{SafeSearchEnabled: true}, nil)
<mask> defer d.Close()
<mask> b.RunParallel(func(pb *testing.PB) {
<mask> for pb.Next() {
<mask> val, ok := d.SafeSearchDomain("www.google.com")
<mask> if !ok {
<mask> b.Errorf("Expected safesearch to find result for www.google.com")
<mask> }
<mask> if val != "forcesafesearch.google.com" {
<mask> b.Errorf("Expected safesearch for google.com to be forcesafesearch.google.com")
<mask> }
<mask> }
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove if !ok {
b.Errorf("Expected safesearch to find result for www.google.com")
}
if val != "forcesafesearch.google.com" {
b.Errorf("Expected safesearch for google.com to be forcesafesearch.google.com")
}
</s> add assert.True(b, ok, "Expected safesearch to find result for www.google.com")
assert.Equal(b, "forcesafesearch.google.com", val, "Expected safesearch for google.com to be forcesafesearch.google.com") </s> remove if !ok {
t.Errorf("Expected safesearch to find result for www.google.com")
}
if val != "forcesafesearch.google.com" {
t.Errorf("Expected safesearch for google.com to be forcesafesearch.google.com")
}
</s> add assert.True(t, ok, "Expected safesearch to find result for www.google.com")
assert.Equal(t, "forcesafesearch.google.com", val, "Expected safesearch for google.com to be forcesafesearch.google.com") </s> remove d := NewForTest(&Config{SafeSearchEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeSearchEnabled: true}, nil)
b.Cleanup(d.Close) </s> remove d := NewForTest(&Config{SafeSearchEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeSearchEnabled: true}, nil)
t.Cleanup(d.Close) </s> remove hostname := "wmconvirus.narod.ru"
res, err := d.CheckHost(hostname, dns.TypeA, &setts)
if err != nil {
b.Errorf("Error while matching host %s: %s", hostname, err)
}
if !res.IsFiltered {
b.Errorf("Expected hostname %s to match", hostname)
}
</s> add res, err := d.CheckHost(blocked, dns.TypeA, &setts)
assert.Nilf(b, err, "Error while matching host %s: %s", blocked, err)
assert.True(b, res.IsFiltered, "Expected hostname %s to match", blocked) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/dnsfilter_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> |disable-all^$dnsrewrite=127.0.0.2
<mask> @@||disable-all^$dnsrewrite
<mask> `
<mask>
<mask> f := NewForTest(nil, []Filter{{ID: 0, Data: []byte(text)}})
<mask> setts := &RequestFilteringSettings{
<mask> FilteringEnabled: true,
<mask> }
<mask>
<mask> ipv4p1 := net.IPv4(127, 0, 0, 1)
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove d := NewForTest(nil, filters)
</s> add d := newForTest(nil, filters) </s> remove // ...and 1 IPv6 address
</s> add // One IPv6 address. </s> remove loopback6 := net.IP{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
assert.Equal(t, res.Rules[0].IP, loopback6)
</s> add assert.Equal(t, res.Rules[0].IP, net.IPv6loopback) </s> remove d := NewForTest(nil, filters)
defer d.Close()
</s> add d := newForTest(nil, filters)
t.Cleanup(d.Close) </s> remove defer d.Close()
</s> add t.Cleanup(d.Close) </s> remove var r Result
filters := []Filter{{
ID: 0, Data: []byte("||example.org^\n"),
</s> add d := newForTest(
&Config{
ParentalEnabled: true,
SafeBrowsingEnabled: false,
},
[]Filter{{
ID: 0, Data: []byte("||example.org^\n"),
}},
)
t.Cleanup(d.Close)
d.parentalUpstream = &testSbUpstream{
hostname: "pornhub.com",
block: true,
}
d.safeBrowsingUpstream = &testSbUpstream{
hostname: "wmconvirus.narod.ru",
block: true,
}
type testCase struct {
name string
host string
before bool
wantReason Reason
}
testCases := []testCase{{
name: "filters",
host: "example.org",
before: true,
wantReason: FilteredBlockList,
}, {
name: "parental",
host: "pornhub.com",
before: true,
wantReason: FilteredParental,
}, {
name: "safebrowsing",
host: "wmconvirus.narod.ru",
before: false,
wantReason: FilteredSafeBrowsing,
}, {
name: "additional_rules",
host: "facebook.com",
before: false,
wantReason: FilteredBlockedService, | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/dnsrewrite_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
<mask> func TestRewrites(t *testing.T) {
<mask> d := DNSFilter{}
<mask> // CNAME, A, AAAA
<mask> d.Rewrites = []RewriteEntry{
<mask> {"somecname", "somehost.com", 0, nil},
<mask> {"somehost.com", "0.0.0.0", 0, nil},
<mask>
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove // ...and 1 IPv6 address
</s> add // One IPv6 address. </s> remove loopback6 := net.IP{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
assert.Equal(t, res.Rules[0].IP, loopback6)
</s> add assert.Equal(t, res.Rules[0].IP, net.IPv6loopback) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/rewrites_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> assert.True(t, r.IPList[0].Equal(net.IP{1, 2, 3, 4}))
<mask> }
<mask>
<mask> func TestRewritesLevels(t *testing.T) {
<mask> d := DNSFilter{}
<mask> // exact host, wildcard L2, wildcard L3
<mask> d.Rewrites = []RewriteEntry{
<mask> {"host.com", "1.1.1.1", 0, nil},
<mask> {"*.host.com", "2.2.2.2", 0, nil},
<mask> {"*.sub.host.com", "3.3.3.3", 0, nil},
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove loopback6 := net.IP{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
assert.Equal(t, res.Rules[0].IP, loopback6)
</s> add assert.Equal(t, res.Rules[0].IP, net.IPv6loopback) </s> remove // ...and 1 IPv6 address
</s> add // One IPv6 address. | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/rewrites_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> assert.True(t, net.IP{3, 3, 3, 3}.Equal(r.IPList[0]))
<mask> }
<mask>
<mask> func TestRewritesExceptionCNAME(t *testing.T) {
<mask> d := DNSFilter{}
<mask> // wildcard; exception for a sub-domain
<mask> d.Rewrites = []RewriteEntry{
<mask> {"*.host.com", "2.2.2.2", 0, nil},
<mask> {"sub.host.com", "sub.host.com", 0, nil},
<mask> }
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove loopback6 := net.IP{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
assert.Equal(t, res.Rules[0].IP, loopback6)
</s> add assert.Equal(t, res.Rules[0].IP, net.IPv6loopback) </s> remove // ...and 1 IPv6 address
</s> add // One IPv6 address. | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/rewrites_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> assert.Equal(t, NotFilteredNotFound, r.Reason)
<mask> }
<mask>
<mask> func TestRewritesExceptionWC(t *testing.T) {
<mask> d := DNSFilter{}
<mask> // wildcard; exception for a sub-wildcard
<mask> d.Rewrites = []RewriteEntry{
<mask> {"*.host.com", "2.2.2.2", 0, nil},
<mask> {"*.sub.host.com", "*.sub.host.com", 0, nil},
<mask> }
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove loopback6 := net.IP{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
assert.Equal(t, res.Rules[0].IP, loopback6)
</s> add assert.Equal(t, res.Rules[0].IP, net.IPv6loopback) </s> remove // ...and 1 IPv6 address
</s> add // One IPv6 address. | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/rewrites_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> assert.Equal(t, NotFilteredNotFound, r.Reason)
<mask> }
<mask>
<mask> func TestRewritesExceptionIP(t *testing.T) {
<mask> d := DNSFilter{}
<mask> // exception for AAAA record
<mask> d.Rewrites = []RewriteEntry{
<mask> {"host.com", "1.2.3.4", 0, nil},
<mask> {"host.com", "AAAA", 0, nil},
<mask> {"host2.com", "::1", 0, nil},
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove loopback6 := net.IP{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
assert.Equal(t, res.Rules[0].IP, loopback6)
</s> add assert.Equal(t, res.Rules[0].IP, net.IPv6loopback) </s> remove // ...and 1 IPv6 address
</s> add // One IPv6 address. | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/rewrites_test.go |
keep keep keep add keep keep keep keep keep keep | <mask> import (
<mask> "crypto/sha256"
<mask> "encoding/hex"
<mask> "strings"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr"
<mask> "github.com/AdguardTeam/golibs/cache"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> add "github.com/AdguardTeam/golibs/cache" </s> add "context"
"crypto/sha256" </s> add "context" </s> add "context" </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) </s> remove // FILTERING
const nl = "\n"
const (
blockingRules = `||example.org^` + nl
allowlistRules = `||example.org^` + nl + `@@||test.example.org` + nl
importantRules = `@@||example.org^` + nl + `||test.example.org^$important` + nl
regexRules = `/example\.org/` + nl + `@@||test.example.org^` + nl
maskRules = `test*.example.org^` + nl + `exam*.com` + nl
dnstypeRules = `||example.org^$dnstype=AAAA` + nl + `@@||test.example.org^` + nl
)
var tests = []struct {
testname string
rules string
hostname string
isFiltered bool
reason Reason
dnsType uint16
}{
{"sanity", "||doubleclick.net^", "www.doubleclick.net", true, FilteredBlockList, dns.TypeA},
{"sanity", "||doubleclick.net^", "nodoubleclick.net", false, NotFilteredNotFound, dns.TypeA},
{"sanity", "||doubleclick.net^", "doubleclick.net.ru", false, NotFilteredNotFound, dns.TypeA},
{"sanity", "||doubleclick.net^", "wmconvirus.narod.ru", false, NotFilteredNotFound, dns.TypeA},
{"blocking", blockingRules, "example.org", true, FilteredBlockList, dns.TypeA},
{"blocking", blockingRules, "test.example.org", true, FilteredBlockList, dns.TypeA},
{"blocking", blockingRules, "test.test.example.org", true, FilteredBlockList, dns.TypeA},
{"blocking", blockingRules, "testexample.org", false, NotFilteredNotFound, dns.TypeA},
{"blocking", blockingRules, "onemoreexample.org", false, NotFilteredNotFound, dns.TypeA},
{"allowlist", allowlistRules, "example.org", true, FilteredBlockList, dns.TypeA},
{"allowlist", allowlistRules, "test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"allowlist", allowlistRules, "test.test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"allowlist", allowlistRules, "testexample.org", false, NotFilteredNotFound, dns.TypeA},
{"allowlist", allowlistRules, "onemoreexample.org", false, NotFilteredNotFound, dns.TypeA},
{"important", importantRules, "example.org", false, NotFilteredAllowList, dns.TypeA},
{"important", importantRules, "test.example.org", true, FilteredBlockList, dns.TypeA},
{"important", importantRules, "test.test.example.org", true, FilteredBlockList, dns.TypeA},
{"important", importantRules, "testexample.org", false, NotFilteredNotFound, dns.TypeA},
{"important", importantRules, "onemoreexample.org", false, NotFilteredNotFound, dns.TypeA},
{"regex", regexRules, "example.org", true, FilteredBlockList, dns.TypeA},
{"regex", regexRules, "test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"regex", regexRules, "test.test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"regex", regexRules, "testexample.org", true, FilteredBlockList, dns.TypeA},
{"regex", regexRules, "onemoreexample.org", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "test.example.org", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "test2.example.org", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "example.com", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "exampleeee.com", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "onemoreexamsite.com", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "example.org", false, NotFilteredNotFound, dns.TypeA},
{"mask", maskRules, "testexample.org", false, NotFilteredNotFound, dns.TypeA},
{"mask", maskRules, "example.co.uk", false, NotFilteredNotFound, dns.TypeA},
{"dnstype", dnstypeRules, "onemoreexample.org", false, NotFilteredNotFound, dns.TypeA},
{"dnstype", dnstypeRules, "example.org", false, NotFilteredNotFound, dns.TypeA},
{"dnstype", dnstypeRules, "example.org", true, FilteredBlockList, dns.TypeAAAA},
{"dnstype", dnstypeRules, "test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"dnstype", dnstypeRules, "test.example.org", false, NotFilteredAllowList, dns.TypeAAAA},
}
</s> add // Filtering. | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safebrowsing_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> return ""
<mask> }
<mask>
<mask> func TestSBPC_checkErrorUpstream(t *testing.T) {
<mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
<mask> defer d.Close()
<mask>
<mask> ups := &testErrUpstream{}
<mask>
<mask> d.safeBrowsingUpstream = ups
<mask> d.parentalUpstream = ups
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close) </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close) </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close)
matching := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: matching,
block: true,
}
</s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
b.Cleanup(d.Close)
blocked := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: blocked,
block: true,
} </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
b.Cleanup(d.Close)
blocked := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: blocked,
block: true,
} </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
d.checkMatch(t, "wmconvirus.narod.ru")
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close)
matching := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: matching,
block: true,
}
d.checkMatch(t, matching) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safebrowsing_test.go |
keep keep keep add keep keep keep keep keep | <mask> type testSbUpstream struct {
<mask> hostname string
<mask> block bool
<mask> requestsCount int
<mask> }
<mask>
<mask> // Exchange returns a message depending on the upstream settings (hostname, block)
<mask> func (u *testSbUpstream) Exchange(r *dns.Msg) (*dns.Msg, error) {
<mask> u.counterLock.Lock()
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> add u.counterLock.Lock() </s> add u.counterLock.Unlock() </s> add // resolver only looks up the IP address of the host while safe search.
//
// TODO(e.burkov): Use upstream that configured in dnsforward instead.
resolver Resolver </s> add // Resolver is the interface for net.Resolver to simplify testing.
type Resolver interface {
// TODO(e.burkov): Replace with LookupIP after upgrading go to v1.15.
LookupIPAddr(ctx context.Context, host string) (ips []net.IPAddr, err error)
}
</s> remove var r Result
filters := []Filter{{
ID: 0, Data: []byte("||example.org^\n"),
</s> add d := newForTest(
&Config{
ParentalEnabled: true,
SafeBrowsingEnabled: false,
},
[]Filter{{
ID: 0, Data: []byte("||example.org^\n"),
}},
)
t.Cleanup(d.Close)
d.parentalUpstream = &testSbUpstream{
hostname: "pornhub.com",
block: true,
}
d.safeBrowsingUpstream = &testSbUpstream{
hostname: "wmconvirus.narod.ru",
block: true,
}
type testCase struct {
name string
host string
before bool
wantReason Reason
}
testCases := []testCase{{
name: "filters",
host: "example.org",
before: true,
wantReason: FilteredBlockList,
}, {
name: "parental",
host: "pornhub.com",
before: true,
wantReason: FilteredParental,
}, {
name: "safebrowsing",
host: "wmconvirus.narod.ru",
before: false,
wantReason: FilteredSafeBrowsing,
}, {
name: "additional_rules",
host: "facebook.com",
before: false,
wantReason: FilteredBlockedService, </s> remove func TestCheckHostSafeSearchGoogle(t *testing.T) {
d := NewForTest(&Config{SafeSearchEnabled: true}, nil)
defer d.Close()
// Slice of google domains
googleDomains := []string{"www.google.com", "www.google.im", "www.google.co.in", "www.google.iq", "www.google.is", "www.google.it", "www.google.je"}
</s> add // testResolver is a Resolver for tests.
type testResolver struct{}
// LookupIP implements Resolver interface for *testResolver.
func (r *testResolver) LookupIPAddr(_ context.Context, host string) (ips []net.IPAddr, err error) {
hash := sha256.Sum256([]byte(host))
addrs := []net.IPAddr{{
IP: net.IP(hash[:4]),
Zone: "somezone",
}, {
IP: net.IP(hash[4:20]),
Zone: "somezone",
}}
return addrs, nil
} | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safebrowsing_test.go |
keep keep add keep keep keep keep | <mask>
<mask> // Exchange returns a message depending on the upstream settings (hostname, block)
<mask> func (u *testSbUpstream) Exchange(r *dns.Msg) (*dns.Msg, error) {
<mask> u.requestsCount++
<mask> u.counterLock.Unlock()
<mask>
<mask> hash := sha256.Sum256([]byte(u.hostname))
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> add u.counterLock.Unlock() </s> add counterLock sync.RWMutex </s> add // resolver only looks up the IP address of the host while safe search.
//
// TODO(e.burkov): Use upstream that configured in dnsforward instead.
resolver Resolver </s> remove func TestCheckHostSafeSearchGoogle(t *testing.T) {
d := NewForTest(&Config{SafeSearchEnabled: true}, nil)
defer d.Close()
// Slice of google domains
googleDomains := []string{"www.google.com", "www.google.im", "www.google.co.in", "www.google.iq", "www.google.is", "www.google.it", "www.google.je"}
</s> add // testResolver is a Resolver for tests.
type testResolver struct{}
// LookupIP implements Resolver interface for *testResolver.
func (r *testResolver) LookupIPAddr(_ context.Context, host string) (ips []net.IPAddr, err error) {
hash := sha256.Sum256([]byte(host))
addrs := []net.IPAddr{{
IP: net.IP(hash[:4]),
Zone: "somezone",
}, {
IP: net.IP(hash[4:20]),
Zone: "somezone",
}}
return addrs, nil
} </s> add // Resolver is the interface for net.Resolver to simplify testing.
type Resolver interface {
// TODO(e.burkov): Replace with LookupIP after upgrading go to v1.15.
LookupIPAddr(ctx context.Context, host string) (ips []net.IPAddr, err error)
}
</s> remove // 2 IPv4 (return only the first one)
</s> add // Two IPv4, the first one returned. | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safebrowsing_test.go |
keep keep keep add keep keep keep keep | <mask> // Exchange returns a message depending on the upstream settings (hostname, block)
<mask> func (u *testSbUpstream) Exchange(r *dns.Msg) (*dns.Msg, error) {
<mask> u.counterLock.Lock()
<mask> u.requestsCount++
<mask>
<mask> hash := sha256.Sum256([]byte(u.hostname))
<mask> prefix := hash[0:2]
<mask> hashToReturn := hex.EncodeToString(prefix) + strings.Repeat("ab", 28)
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> add u.counterLock.Lock() </s> add counterLock sync.RWMutex </s> remove func TestCheckHostSafeSearchGoogle(t *testing.T) {
d := NewForTest(&Config{SafeSearchEnabled: true}, nil)
defer d.Close()
// Slice of google domains
googleDomains := []string{"www.google.com", "www.google.im", "www.google.co.in", "www.google.iq", "www.google.is", "www.google.it", "www.google.je"}
</s> add // testResolver is a Resolver for tests.
type testResolver struct{}
// LookupIP implements Resolver interface for *testResolver.
func (r *testResolver) LookupIPAddr(_ context.Context, host string) (ips []net.IPAddr, err error) {
hash := sha256.Sum256([]byte(host))
addrs := []net.IPAddr{{
IP: net.IP(hash[:4]),
Zone: "somezone",
}, {
IP: net.IP(hash[4:20]),
Zone: "somezone",
}}
return addrs, nil
} </s> add // resolver only looks up the IP address of the host while safe search.
//
// TODO(e.burkov): Use upstream that configured in dnsforward instead.
resolver Resolver </s> remove // 2 IPv4 (return only the first one)
</s> add // Two IPv4, the first one returned. </s> remove d := DNSFilter{}
</s> add d := newForTest(nil, nil)
t.Cleanup(d.Close) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safebrowsing_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> return ""
<mask> }
<mask>
<mask> func TestSBPC_sbValidResponse(t *testing.T) {
<mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
<mask> defer d.Close()
<mask>
<mask> ups := &testSbUpstream{}
<mask> d.safeBrowsingUpstream = ups
<mask> d.parentalUpstream = ups
<mask>
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close) </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close) </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close)
matching := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: matching,
block: true,
}
</s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
b.Cleanup(d.Close)
blocked := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: blocked,
block: true,
} </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
b.Cleanup(d.Close)
blocked := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: blocked,
block: true,
} </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
d.checkMatch(t, "wmconvirus.narod.ru")
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close)
matching := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: matching,
block: true,
}
d.checkMatch(t, matching) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safebrowsing_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> assert.Equal(t, 1, ups.requestsCount)
<mask> }
<mask>
<mask> func TestSBPC_pcBlockedResponse(t *testing.T) {
<mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
<mask> defer d.Close()
<mask>
<mask> ups := &testSbUpstream{}
<mask> d.safeBrowsingUpstream = ups
<mask> d.parentalUpstream = ups
<mask>
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close) </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close) </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close)
matching := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: matching,
block: true,
}
</s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
b.Cleanup(d.Close)
blocked := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: blocked,
block: true,
} </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
b.Cleanup(d.Close)
blocked := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: blocked,
block: true,
} </s> remove d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
defer d.Close()
d.checkMatch(t, "wmconvirus.narod.ru")
</s> add d := newForTest(&Config{SafeBrowsingEnabled: true}, nil)
t.Cleanup(d.Close)
matching := "wmconvirus.narod.ru"
d.safeBrowsingUpstream = &testSbUpstream{
hostname: matching,
block: true,
}
d.checkMatch(t, matching) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safebrowsing_test.go |
keep keep keep add keep keep keep keep | <mask> package dnsfilter
<mask>
<mask> import (
<mask> "bytes"
<mask> "encoding/binary"
<mask> "encoding/gob"
<mask> "encoding/json"
<mask> "fmt"
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> add "context"
"crypto/sha256" </s> add "context" </s> add "sync" </s> remove // FILTERING
const nl = "\n"
const (
blockingRules = `||example.org^` + nl
allowlistRules = `||example.org^` + nl + `@@||test.example.org` + nl
importantRules = `@@||example.org^` + nl + `||test.example.org^$important` + nl
regexRules = `/example\.org/` + nl + `@@||test.example.org^` + nl
maskRules = `test*.example.org^` + nl + `exam*.com` + nl
dnstypeRules = `||example.org^$dnstype=AAAA` + nl + `@@||test.example.org^` + nl
)
var tests = []struct {
testname string
rules string
hostname string
isFiltered bool
reason Reason
dnsType uint16
}{
{"sanity", "||doubleclick.net^", "www.doubleclick.net", true, FilteredBlockList, dns.TypeA},
{"sanity", "||doubleclick.net^", "nodoubleclick.net", false, NotFilteredNotFound, dns.TypeA},
{"sanity", "||doubleclick.net^", "doubleclick.net.ru", false, NotFilteredNotFound, dns.TypeA},
{"sanity", "||doubleclick.net^", "wmconvirus.narod.ru", false, NotFilteredNotFound, dns.TypeA},
{"blocking", blockingRules, "example.org", true, FilteredBlockList, dns.TypeA},
{"blocking", blockingRules, "test.example.org", true, FilteredBlockList, dns.TypeA},
{"blocking", blockingRules, "test.test.example.org", true, FilteredBlockList, dns.TypeA},
{"blocking", blockingRules, "testexample.org", false, NotFilteredNotFound, dns.TypeA},
{"blocking", blockingRules, "onemoreexample.org", false, NotFilteredNotFound, dns.TypeA},
{"allowlist", allowlistRules, "example.org", true, FilteredBlockList, dns.TypeA},
{"allowlist", allowlistRules, "test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"allowlist", allowlistRules, "test.test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"allowlist", allowlistRules, "testexample.org", false, NotFilteredNotFound, dns.TypeA},
{"allowlist", allowlistRules, "onemoreexample.org", false, NotFilteredNotFound, dns.TypeA},
{"important", importantRules, "example.org", false, NotFilteredAllowList, dns.TypeA},
{"important", importantRules, "test.example.org", true, FilteredBlockList, dns.TypeA},
{"important", importantRules, "test.test.example.org", true, FilteredBlockList, dns.TypeA},
{"important", importantRules, "testexample.org", false, NotFilteredNotFound, dns.TypeA},
{"important", importantRules, "onemoreexample.org", false, NotFilteredNotFound, dns.TypeA},
{"regex", regexRules, "example.org", true, FilteredBlockList, dns.TypeA},
{"regex", regexRules, "test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"regex", regexRules, "test.test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"regex", regexRules, "testexample.org", true, FilteredBlockList, dns.TypeA},
{"regex", regexRules, "onemoreexample.org", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "test.example.org", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "test2.example.org", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "example.com", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "exampleeee.com", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "onemoreexamsite.com", true, FilteredBlockList, dns.TypeA},
{"mask", maskRules, "example.org", false, NotFilteredNotFound, dns.TypeA},
{"mask", maskRules, "testexample.org", false, NotFilteredNotFound, dns.TypeA},
{"mask", maskRules, "example.co.uk", false, NotFilteredNotFound, dns.TypeA},
{"dnstype", dnstypeRules, "onemoreexample.org", false, NotFilteredNotFound, dns.TypeA},
{"dnstype", dnstypeRules, "example.org", false, NotFilteredNotFound, dns.TypeA},
{"dnstype", dnstypeRules, "example.org", true, FilteredBlockList, dns.TypeAAAA},
{"dnstype", dnstypeRules, "test.example.org", false, NotFilteredAllowList, dns.TypeA},
{"dnstype", dnstypeRules, "test.example.org", false, NotFilteredAllowList, dns.TypeAAAA},
}
</s> add // Filtering. </s> remove for _, test := range tests {
t.Run(fmt.Sprintf("%s-%s", test.testname, test.hostname), func(t *testing.T) {
filters := []Filter{{
ID: 0, Data: []byte(test.rules),
}}
d := NewForTest(nil, filters)
defer d.Close()
res, err := d.CheckHost(test.hostname, test.dnsType, &setts)
if err != nil {
t.Errorf("Error while matching host %s: %s", test.hostname, err)
}
if res.IsFiltered != test.isFiltered {
t.Errorf("Hostname %s has wrong result (%v must be %v)", test.hostname, res.IsFiltered, test.isFiltered)
}
if res.Reason != test.reason {
t.Errorf("Hostname %s has wrong reason (%v must be %v)", test.hostname, res.Reason.String(), test.reason.String())
}
</s> add const nl = "\n"
const (
blockingRules = `||example.org^` + nl
allowlistRules = `||example.org^` + nl + `@@||test.example.org` + nl
importantRules = `@@||example.org^` + nl + `||test.example.org^$important` + nl
regexRules = `/example\.org/` + nl + `@@||test.example.org^` + nl
maskRules = `test*.example.org^` + nl + `exam*.com` + nl
dnstypeRules = `||example.org^$dnstype=AAAA` + nl + `@@||test.example.org^` + nl
)
testCases := []struct {
name string
rules string
host string
wantIsFiltered bool
wantReason Reason
wantDNSType uint16
}{{
name: "sanity",
rules: "||doubleclick.net^",
host: "www.doubleclick.net",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "sanity",
rules: "||doubleclick.net^",
host: "nodoubleclick.net",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "sanity",
rules: "||doubleclick.net^",
host: "doubleclick.net.ru",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "sanity",
rules: "||doubleclick.net^",
host: "wmconvirus.narod.ru",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "blocking",
rules: blockingRules,
host: "example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "blocking",
rules: blockingRules,
host: "test.example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "blocking",
rules: blockingRules,
host: "test.test.example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "blocking",
rules: blockingRules,
host: "testexample.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "blocking",
rules: blockingRules,
host: "onemoreexample.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "allowlist",
rules: allowlistRules,
host: "example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "allowlist",
rules: allowlistRules,
host: "test.example.org",
wantIsFiltered: false,
wantReason: NotFilteredAllowList,
wantDNSType: dns.TypeA,
}, {
name: "allowlist",
rules: allowlistRules,
host: "test.test.example.org",
wantIsFiltered: false,
wantReason: NotFilteredAllowList,
wantDNSType: dns.TypeA,
}, {
name: "allowlist",
rules: allowlistRules,
host: "testexample.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "allowlist",
rules: allowlistRules,
host: "onemoreexample.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "important",
rules: importantRules,
host: "example.org",
wantIsFiltered: false,
wantReason: NotFilteredAllowList,
wantDNSType: dns.TypeA,
}, {
name: "important",
rules: importantRules,
host: "test.example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "important",
rules: importantRules,
host: "test.test.example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "important",
rules: importantRules,
host: "testexample.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "important",
rules: importantRules,
host: "onemoreexample.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "regex",
rules: regexRules,
host: "example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "regex",
rules: regexRules,
host: "test.example.org",
wantIsFiltered: false,
wantReason: NotFilteredAllowList,
wantDNSType: dns.TypeA,
}, {
name: "regex",
rules: regexRules,
host: "test.test.example.org",
wantIsFiltered: false,
wantReason: NotFilteredAllowList,
wantDNSType: dns.TypeA,
}, {
name: "regex",
rules: regexRules,
host: "testexample.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "regex",
rules: regexRules,
host: "onemoreexample.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "mask",
rules: maskRules,
host: "test.example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "mask",
rules: maskRules,
host: "test2.example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "mask",
rules: maskRules,
host: "example.com",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "mask",
rules: maskRules,
host: "exampleeee.com",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "mask",
rules: maskRules,
host: "onemoreexamsite.com",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeA,
}, {
name: "mask",
rules: maskRules,
host: "example.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "mask",
rules: maskRules,
host: "testexample.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "mask",
rules: maskRules,
host: "example.co.uk",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "dnstype",
rules: dnstypeRules,
host: "onemoreexample.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "dnstype",
rules: dnstypeRules,
host: "example.org",
wantIsFiltered: false,
wantReason: NotFilteredNotFound,
wantDNSType: dns.TypeA,
}, {
name: "dnstype",
rules: dnstypeRules,
host: "example.org",
wantIsFiltered: true,
wantReason: FilteredBlockList,
wantDNSType: dns.TypeAAAA,
}, {
name: "dnstype",
rules: dnstypeRules,
host: "test.example.org",
wantIsFiltered: false,
wantReason: NotFilteredAllowList,
wantDNSType: dns.TypeA,
}, {
name: "dnstype",
rules: dnstypeRules,
host: "test.example.org",
wantIsFiltered: false,
wantReason: NotFilteredAllowList,
wantDNSType: dns.TypeAAAA,
}}
for _, tc := range testCases {
t.Run(fmt.Sprintf("%s-%s", tc.name, tc.host), func(t *testing.T) {
filters := []Filter{{ID: 0, Data: []byte(tc.rules)}}
d := newForTest(nil, filters)
t.Cleanup(d.Close)
res, err := d.CheckHost(tc.host, tc.wantDNSType, &setts)
assert.Nilf(t, err, "Error while matching host %s: %s", tc.host, err)
assert.Equalf(t, tc.wantIsFiltered, res.IsFiltered, "Hostname %s has wrong result (%v must be %v)", tc.host, res.IsFiltered, tc.wantIsFiltered)
assert.Equalf(t, tc.wantReason, res.Reason, "Hostname %s has wrong reason (%v must be %v)", tc.host, res.Reason, tc.wantReason) </s> remove if err != nil {
t.Fatalf("CheckHost for safesearh domain %s failed cause %s", domain, err)
}
</s> add assert.Nilf(t, err, "CheckHost for safesearh domain %s failed cause %s", domain, err) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safesearch.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> return res, nil
<mask> }
<mask>
<mask> // TODO this address should be resolved with upstream that was configured in dnsforward
<mask> ips, err := net.LookupIP(safeHost)
<mask> if err != nil {
<mask> log.Tracef("SafeSearchDomain for %s was found but failed to lookup for %s cause %s", host, safeHost, err)
<mask> return Result{}, err
<mask> }
<mask>
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove for _, ip := range ips {
if ipv4 := ip.To4(); ipv4 != nil {
</s> add for _, ipAddr := range ipAddrs {
if ipv4 := ipAddr.IP.To4(); ipv4 != nil { </s> remove if err != nil {
t.Fatalf("CheckHost for safesearh domain %s failed cause %s", domain, err)
}
</s> add assert.Nilf(t, err, "CheckHost for safesearh domain %s failed cause %s", domain, err) </s> add // resolver only looks up the IP address of the host while safe search.
//
// TODO(e.burkov): Use upstream that configured in dnsforward instead.
resolver Resolver </s> remove // For yandex we already know valid ip.
</s> add // For yandex we already know valid IP. </s> remove ips, err := net.LookupIP(safeDomain)
</s> add ipAddrs, err := resolver.LookupIPAddr(context.Background(), safeDomain) </s> remove if !ok {
t.Fatalf("Failed to get safesearch domain for %s", domain)
}
</s> add assert.Truef(t, ok, "Failed to get safesearch domain for %s", domain) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safesearch.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> log.Tracef("SafeSearchDomain for %s was found but failed to lookup for %s cause %s", host, safeHost, err)
<mask> return Result{}, err
<mask> }
<mask>
<mask> for _, ip := range ips {
<mask> if ipv4 := ip.To4(); ipv4 != nil {
<mask> res.Rules[0].IP = ipv4
<mask>
<mask> l := d.setCacheResult(gctx.safeSearchCache, host, res)
<mask> log.Debug("SafeSearch: stored in cache: %s (%d bytes)", host, l)
<mask>
</s> Pull request: 2574 external tests vol.1
Merge in DNS/adguard-home from 2574-external-tests to master
Updates #2574.
Squashed commit of the following:
commit cb7017aa7fc1c81c014c1fa7e0972b06748aff29
Merge: 2a073431 eeeb0383
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:43:41 2021 +0300
Merge branch 'master' into 2574-external-tests
commit 2a0734311c5a6ddd2d9c3f56a4494a20b4197955
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 15:16:40 2021 +0300
dnsfilter: imp docs
commit 49aff871282e2739d27fcbceefdf1bd005c21174
Author: Eugene Burkov <[email protected]>
Date: Fri Jan 29 14:10:56 2021 +0300
dnsfilter: imp docs
commit 11be89a5378c0e451f1b88dc48a2e8827ba38358
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 21:20:55 2021 +0300
dnsfilter: fix go version trouble
commit 1ba4afd95bd739c18818ab0bea0ae70d59b880dc
Author: Eugene Burkov <[email protected]>
Date: Thu Jan 28 17:42:29 2021 +0300
dnsfilter: imp tests </s> remove // TODO this address should be resolved with upstream that was configured in dnsforward
ips, err := net.LookupIP(safeHost)
</s> add ipAddrs, err := d.resolver.LookupIPAddr(context.Background(), safeHost) </s> remove ip := ips[0]
for _, i := range ips {
if i.To4() != nil {
ip = i
</s> add ip := ipAddrs[0].IP
for _, ipAddr := range ipAddrs {
if ipAddr.IP.To4() != nil {
ip = ipAddr.IP </s> remove if err != nil {
t.Errorf("Error while matching host %s: %s", hostname, err)
}
if !res.IsFiltered {
t.Errorf("Expected hostname %s to match", hostname)
}
if len(res.Rules) == 0 {
t.Errorf("Expected result to have rules")
return
}
r := res.Rules[0]
if r.IP == nil || r.IP.String() != ip {
t.Errorf("Expected ip %s to match, actual: %v", ip, r.IP)
</s> add assert.Nilf(t, err, "Error while matching host %s: %s", hostname, err)
assert.Truef(t, res.IsFiltered, "Expected hostname %s to match", hostname)
if assert.NotEmpty(t, res.Rules, "Expected result to have rules") {
r := res.Rules[0]
assert.NotNilf(t, r.IP, "Expected ip %s to match, actual: %v", ip, r.IP)
assert.Equalf(t, ip, r.IP.String(), "Expected ip %s to match, actual: %v", ip, r.IP) </s> remove if err != nil {
t.Fatalf("CheckHost for safesearh domain %s failed cause %s", domain, err)
}
</s> add assert.Nilf(t, err, "CheckHost for safesearh domain %s failed cause %s", domain, err) </s> remove if err != nil {
t.Errorf("Error while matching host %s: %s", hostname, err)
}
if !res.IsFiltered {
t.Errorf("Expected hostname %s to match", hostname)
}
</s> add assert.Nilf(t, err, "Error while matching host %s: %s", hostname, err)
assert.Truef(t, res.IsFiltered, "Expected hostname %s to match", hostname) </s> remove d = NewForTest(&Config{SafeSearchEnabled: true}, nil)
defer d.Close()
</s> add d = newForTest(&Config{SafeSearchEnabled: true}, nil)
t.Cleanup(d.Close) | https://github.com/AdguardTeam/AdGuardHome/commit/0d0a419bd34dd8fe612f790ace698aebd930bfcc | internal/dnsfilter/safesearch.go |
keep keep keep keep replace replace replace replace replace keep keep keep keep keep | <mask> }
<mask> log.Info("Available network interfaces: %s", buf.String())
<mask> }
<mask>
<mask> // Start will listen on port 67 and serve DHCP requests.
<mask> // Even though config can be nil, it is not optional (at least for now), since there are no default values (yet).
<mask> func (s *Server) Start(config *ServerConfig) error {
<mask> if config != nil {
<mask> s.ServerConfig = *config
<mask> }
<mask>
<mask> iface, err := net.InterfaceByName(s.InterfaceName)
<mask> if err != nil {
<mask> s.closeConn() // in case it was already started
</s> * dhcpd: move code from Start() to Init() </s> add return nil
}
// Start will listen on port 67 and serve DHCP requests.
func (s *Server) Start() error {
</s> add s.dbLoad()
return nil
}
func (s *Server) setConfig(config ServerConfig) error {
s.ServerConfig = config </s> remove s.dbLoad()
</s> add iface, err := net.InterfaceByName(s.InterfaceName)
if err != nil {
return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName)
} </s> remove s.closeConn() // in case it was already started
</s> add </s> remove // s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep keep add keep keep keep keep keep keep | <mask> if err != nil {
<mask> return err
<mask> }
<mask>
<mask> iface, err := net.InterfaceByName(s.InterfaceName)
<mask> if err != nil {
<mask> printInterfaces()
<mask> return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName)
<mask> }
</s> * dhcpd: move code from Start() to Init() </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.dbLoad()
</s> add iface, err := net.InterfaceByName(s.InterfaceName)
if err != nil {
return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName)
} </s> remove s.closeConn() // in case it was already started
</s> add </s> remove
s.closeConn() // in case it was already started
</s> add </s> remove // s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> iface, err := net.InterfaceByName(s.InterfaceName)
<mask> if err != nil {
<mask> s.closeConn() // in case it was already started
<mask> printInterfaces()
<mask> return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName)
<mask> }
<mask>
<mask> // get ipv4 address of an interface
</s> * dhcpd: move code from Start() to Init() </s> remove s.closeConn() // in case it was already started
</s> add </s> add s.dbLoad()
return nil
}
func (s *Server) setConfig(config ServerConfig) error {
s.ServerConfig = config </s> remove s.dbLoad()
</s> add iface, err := net.InterfaceByName(s.InterfaceName)
if err != nil {
return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName)
} </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove
s.closeConn() // in case it was already started
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> // get ipv4 address of an interface
<mask> s.ipnet = getIfaceIPv4(iface)
<mask> if s.ipnet == nil {
<mask> s.closeConn() // in case it was already started
<mask> return wrapErrPrint(err, "Couldn't find IPv4 address of interface %s %+v", s.InterfaceName, iface)
<mask> }
<mask>
<mask> if s.LeaseDuration == 0 {
<mask> s.leaseTime = time.Hour * 2
</s> * dhcpd: move code from Start() to Init() </s> remove s.closeConn() // in case it was already started
</s> add </s> remove // s.closeConn() // in case it was already started
</s> add </s> remove
s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> }
<mask>
<mask> s.leaseStart, err = parseIPv4(s.RangeStart)
<mask> if err != nil {
<mask>
<mask> s.closeConn() // in case it was already started
<mask> return wrapErrPrint(err, "Failed to parse range start address %s", s.RangeStart)
<mask> }
<mask>
<mask> s.leaseStop, err = parseIPv4(s.RangeEnd)
<mask> if err != nil {
</s> * dhcpd: move code from Start() to Init() </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.dbLoad()
</s> add iface, err := net.InterfaceByName(s.InterfaceName)
if err != nil {
return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName)
} </s> remove s.closeConn() // in case it was already started
</s> add </s> remove // s.closeConn() // in case it was already started
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> s.leaseStop, err = parseIPv4(s.RangeEnd)
<mask> if err != nil {
<mask> s.closeConn() // in case it was already started
<mask> return wrapErrPrint(err, "Failed to parse range end address %s", s.RangeEnd)
<mask> }
<mask>
<mask> subnet, err := parseIPv4(s.SubnetMask)
<mask> if err != nil {
</s> * dhcpd: move code from Start() to Init() </s> remove
s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove // s.closeConn() // in case it was already started
</s> add </s> remove s.dbLoad()
</s> add iface, err := net.InterfaceByName(s.InterfaceName)
if err != nil {
return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName)
} | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep keep replace keep keep keep keep replace keep | <mask> subnet, err := parseIPv4(s.SubnetMask)
<mask> if err != nil {
<mask> s.closeConn() // in case it was already started
<mask> return wrapErrPrint(err, "Failed to parse subnet mask %s", s.SubnetMask)
<mask> }
<mask>
<mask> // if !bytes.Equal(subnet, s.ipnet.Mask) {
<mask> // s.closeConn() // in case it was already started
<mask> // return wrapErrPrint(err, "specified subnet mask %s does not meatch interface %s subnet mask %s", s.SubnetMask, s.InterfaceName, s.ipnet.Mask)
</s> * dhcpd: move code from Start() to Init() </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove
s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // }
<mask>
<mask> router, err := parseIPv4(s.GatewayIP)
<mask> if err != nil {
<mask> s.closeConn() // in case it was already started
<mask> return wrapErrPrint(err, "Failed to parse gateway IP %s", s.GatewayIP)
<mask> }
<mask>
<mask> s.leaseOptions = dhcp4.Options{
<mask> dhcp4.OptionSubnetMask: subnet,
</s> * dhcpd: move code from Start() to Init() </s> remove // s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove
s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.dbLoad()
</s> add iface, err := net.InterfaceByName(s.InterfaceName)
if err != nil {
return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName)
} | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep add keep keep keep keep keep keep | <mask> }
<mask>
<mask> // TODO: don't close if interface and addresses are the same
<mask> if s.conn != nil {
<mask> s.closeConn()
<mask> }
<mask>
<mask> iface, err := net.InterfaceByName(s.InterfaceName)
</s> * dhcpd: move code from Start() to Init() </s> remove // Start will listen on port 67 and serve DHCP requests.
// Even though config can be nil, it is not optional (at least for now), since there are no default values (yet).
func (s *Server) Start(config *ServerConfig) error {
if config != nil {
s.ServerConfig = *config
</s> add // Init checks the configuration and initializes the server
func (s *Server) Init(config ServerConfig) error {
err := s.setConfig(config)
if err != nil {
return err </s> remove s.dbLoad()
</s> add iface, err := net.InterfaceByName(s.InterfaceName)
if err != nil {
return wrapErrPrint(err, "Couldn't find interface by name %s", s.InterfaceName)
} </s> remove s.closeConn() // in case it was already started
</s> add </s> add s.dbLoad()
return nil
}
func (s *Server) setConfig(config ServerConfig) error {
s.ServerConfig = config </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep keep keep keep replace keep keep keep keep keep | <mask> if s.conn != nil {
<mask> s.closeConn()
<mask> }
<mask>
<mask> s.dbLoad()
<mask>
<mask> c, err := newFilterConn(*iface, ":67") // it has to be bound to 0.0.0.0:67, otherwise it won't see DHCP discover/request packets
<mask> if err != nil {
<mask> return wrapErrPrint(err, "Couldn't start listening socket on 0.0.0.0:67")
<mask> }
</s> * dhcpd: move code from Start() to Init() </s> remove
s.closeConn() // in case it was already started
</s> add </s> add return nil
}
// Start will listen on port 67 and serve DHCP requests.
func (s *Server) Start() error {
</s> add s.dbLoad()
return nil
}
func (s *Server) setConfig(config ServerConfig) error {
s.ServerConfig = config </s> remove // Start will listen on port 67 and serve DHCP requests.
// Even though config can be nil, it is not optional (at least for now), since there are no default values (yet).
func (s *Server) Start(config *ServerConfig) error {
if config != nil {
s.ServerConfig = *config
</s> add // Init checks the configuration and initializes the server
func (s *Server) Init(config ServerConfig) error {
err := s.setConfig(config)
if err != nil {
return err </s> remove s.closeConn() // in case it was already started
</s> add </s> remove s.closeConn() // in case it was already started
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0d405c0af84d87e3d24b608eb3f7690078ee52ca | dhcpd/dhcpd.go |
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep | <mask> var a []byte
<mask> var err error
<mask> ip := getIPString(addr)
<mask>
<mask> if question != nil {
<mask> q, err = question.Pack()
<mask> if err != nil {
<mask> log.Printf("failed to pack question for querylog: %s", err)
<mask> return
<mask> }
<mask> }
<mask>
<mask> if answer != nil {
<mask> a, err = answer.Pack()
<mask> if err != nil {
</s> * querylog: don't return entries without Question data </s> remove if len(entry.Question) > 0 {
q = new(dns.Msg)
if err := q.Unpack(entry.Question); err != nil {
// ignore, log and move on
log.Printf("Failed to unpack dns message question: %s", err)
q = nil
}
</s> add if len(entry.Question) == 0 {
continue
}
q = new(dns.Msg)
if err := q.Unpack(entry.Question); err != nil {
log.Tracef("q.Unpack(): %s", err)
continue </s> add if len(q.Question) != 1 {
log.Tracef("len(q.Question) != 1")
continue
}
</s> remove // ignore, log and move on
log.Printf("Failed to unpack dns message question: %s", err)
</s> add log.Debug("Failed to unpack dns message answer: %s", err) </s> remove if q != nil {
jsonEntry["question"] = map[string]interface{}{
"host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")),
"type": dns.Type(q.Question[0].Qtype).String(),
"class": dns.Class(q.Question[0].Qclass).String(),
}
</s> add jsonEntry["question"] = map[string]interface{}{
"host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")),
"type": dns.Type(q.Question[0].Qtype).String(),
"class": dns.Class(q.Question[0].Qclass).String(), | https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8 | querylog/qlog.go |
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep | <mask> entry := entries[i]
<mask> var q *dns.Msg
<mask> var a *dns.Msg
<mask>
<mask> if len(entry.Question) > 0 {
<mask> q = new(dns.Msg)
<mask> if err := q.Unpack(entry.Question); err != nil {
<mask> // ignore, log and move on
<mask> log.Printf("Failed to unpack dns message question: %s", err)
<mask> q = nil
<mask> }
<mask> }
<mask> if len(entry.Answer) > 0 {
<mask> a = new(dns.Msg)
<mask> if err := a.Unpack(entry.Answer); err != nil {
<mask> // ignore, log and move on
</s> * querylog: don't return entries without Question data </s> remove // ignore, log and move on
log.Printf("Failed to unpack dns message question: %s", err)
</s> add log.Debug("Failed to unpack dns message answer: %s", err) </s> add if len(q.Question) != 1 {
log.Tracef("len(q.Question) != 1")
continue
}
</s> remove if question != nil {
q, err = question.Pack()
if err != nil {
log.Printf("failed to pack question for querylog: %s", err)
return
}
</s> add if question == nil {
return
}
q, err = question.Pack()
if err != nil {
log.Printf("failed to pack question for querylog: %s", err)
return </s> remove if q != nil {
jsonEntry["question"] = map[string]interface{}{
"host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")),
"type": dns.Type(q.Question[0].Qtype).String(),
"class": dns.Class(q.Question[0].Qclass).String(),
}
</s> add jsonEntry["question"] = map[string]interface{}{
"host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")),
"type": dns.Type(q.Question[0].Qtype).String(),
"class": dns.Class(q.Question[0].Qclass).String(), | https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8 | querylog/qlog.go |
keep keep keep add keep keep keep keep | <mask> if err := q.Unpack(entry.Question); err != nil {
<mask> log.Tracef("q.Unpack(): %s", err)
<mask> continue
<mask> }
<mask> if len(entry.Answer) > 0 {
<mask> a = new(dns.Msg)
<mask> if err := a.Unpack(entry.Answer); err != nil {
<mask> log.Debug("Failed to unpack dns message answer: %s", err)
</s> * querylog: don't return entries without Question data </s> remove if len(entry.Question) > 0 {
q = new(dns.Msg)
if err := q.Unpack(entry.Question); err != nil {
// ignore, log and move on
log.Printf("Failed to unpack dns message question: %s", err)
q = nil
}
</s> add if len(entry.Question) == 0 {
continue
}
q = new(dns.Msg)
if err := q.Unpack(entry.Question); err != nil {
log.Tracef("q.Unpack(): %s", err)
continue </s> remove // ignore, log and move on
log.Printf("Failed to unpack dns message question: %s", err)
</s> add log.Debug("Failed to unpack dns message answer: %s", err) </s> remove if question != nil {
q, err = question.Pack()
if err != nil {
log.Printf("failed to pack question for querylog: %s", err)
return
}
</s> add if question == nil {
return
}
q, err = question.Pack()
if err != nil {
log.Printf("failed to pack question for querylog: %s", err)
return </s> remove if q != nil {
jsonEntry["question"] = map[string]interface{}{
"host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")),
"type": dns.Type(q.Question[0].Qtype).String(),
"class": dns.Class(q.Question[0].Qclass).String(),
}
</s> add jsonEntry["question"] = map[string]interface{}{
"host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")),
"type": dns.Type(q.Question[0].Qtype).String(),
"class": dns.Class(q.Question[0].Qclass).String(), | https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8 | querylog/qlog.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> }
<mask> if len(entry.Answer) > 0 {
<mask> a = new(dns.Msg)
<mask> if err := a.Unpack(entry.Answer); err != nil {
<mask> // ignore, log and move on
<mask> log.Printf("Failed to unpack dns message question: %s", err)
<mask> a = nil
<mask> }
<mask> }
<mask>
<mask> jsonEntry := map[string]interface{}{
</s> * querylog: don't return entries without Question data </s> remove if len(entry.Question) > 0 {
q = new(dns.Msg)
if err := q.Unpack(entry.Question); err != nil {
// ignore, log and move on
log.Printf("Failed to unpack dns message question: %s", err)
q = nil
}
</s> add if len(entry.Question) == 0 {
continue
}
q = new(dns.Msg)
if err := q.Unpack(entry.Question); err != nil {
log.Tracef("q.Unpack(): %s", err)
continue </s> add if len(q.Question) != 1 {
log.Tracef("len(q.Question) != 1")
continue
}
</s> remove if question != nil {
q, err = question.Pack()
if err != nil {
log.Printf("failed to pack question for querylog: %s", err)
return
}
</s> add if question == nil {
return
}
q, err = question.Pack()
if err != nil {
log.Printf("failed to pack question for querylog: %s", err)
return </s> remove if q != nil {
jsonEntry["question"] = map[string]interface{}{
"host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")),
"type": dns.Type(q.Question[0].Qtype).String(),
"class": dns.Class(q.Question[0].Qclass).String(),
}
</s> add jsonEntry["question"] = map[string]interface{}{
"host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")),
"type": dns.Type(q.Question[0].Qtype).String(),
"class": dns.Class(q.Question[0].Qclass).String(), | https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8 | querylog/qlog.go |
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep | <mask> "elapsedMs": strconv.FormatFloat(entry.Elapsed.Seconds()*1000, 'f', -1, 64),
<mask> "time": entry.Time.Format(time.RFC3339Nano),
<mask> "client": entry.IP,
<mask> }
<mask> if q != nil {
<mask> jsonEntry["question"] = map[string]interface{}{
<mask> "host": strings.ToLower(strings.TrimSuffix(q.Question[0].Name, ".")),
<mask> "type": dns.Type(q.Question[0].Qtype).String(),
<mask> "class": dns.Class(q.Question[0].Qclass).String(),
<mask> }
<mask> }
<mask>
<mask> if a != nil {
<mask> jsonEntry["status"] = dns.RcodeToString[a.Rcode]
<mask> }
</s> * querylog: don't return entries without Question data </s> remove if len(entry.Question) > 0 {
q = new(dns.Msg)
if err := q.Unpack(entry.Question); err != nil {
// ignore, log and move on
log.Printf("Failed to unpack dns message question: %s", err)
q = nil
}
</s> add if len(entry.Question) == 0 {
continue
}
q = new(dns.Msg)
if err := q.Unpack(entry.Question); err != nil {
log.Tracef("q.Unpack(): %s", err)
continue </s> remove // ignore, log and move on
log.Printf("Failed to unpack dns message question: %s", err)
</s> add log.Debug("Failed to unpack dns message answer: %s", err) </s> remove if question != nil {
q, err = question.Pack()
if err != nil {
log.Printf("failed to pack question for querylog: %s", err)
return
}
</s> add if question == nil {
return
}
q, err = question.Pack()
if err != nil {
log.Printf("failed to pack question for querylog: %s", err)
return </s> add if len(q.Question) != 1 {
log.Tracef("len(q.Question) != 1")
continue
}
| https://github.com/AdguardTeam/AdGuardHome/commit/0d4e95b36d02e8aadfe6cbdd87d357efba6f02e8 | querylog/qlog.go |
keep keep keep add keep keep keep keep keep | <mask> import (
<mask> "encoding/json"
<mask> "fmt"
<mask> "io/ioutil"
<mask> "net/http"
<mask> "net/url"
<mask> "os"
<mask> "strings"
<mask> "time"
</s> + GET /filtering/check_host: Check if host name is filtered </s> add "github.com/miekg/dns" </s> add - "ReasonRewrite" </s> add /filtering/check_host:
get:
tags:
- filtering
operationId: filteringCheckHost
summary: 'Check if host name is filtered'
parameters:
- name: name
in: query
type: string
responses:
200:
description: OK
schema:
$ref: "#/definitions/FilterCheckHostResponse"
</s> remove version: '0.99.3'
</s> add version: '0.101' </s> remove httpRegister(http.MethodGet, "/control/filtering/status", handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", handleFilteringSetRules)
</s> add httpRegister("GET", "/control/filtering/status", handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", handleCheckHost) | https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445 | home/control_filtering.go |
keep keep keep add keep keep keep keep keep | <mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
<mask> // IsValidURL - return TRUE if URL is valid
<mask> func IsValidURL(rawurl string) bool {
<mask> url, err := url.ParseRequestURI(rawurl)
</s> + GET /filtering/check_host: Check if host name is filtered </s> remove httpRegister(http.MethodGet, "/control/filtering/status", handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", handleFilteringSetRules)
</s> add httpRegister("GET", "/control/filtering/status", handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", handleCheckHost) </s> add "net" </s> add - "ReasonRewrite" </s> remove version: '0.99.3'
</s> add version: '0.101' </s> add /filtering/check_host:
get:
tags:
- filtering
operationId: filteringCheckHost
summary: 'Check if host name is filtered'
parameters:
- name: name
in: query
type: string
responses:
200:
description: OK
schema:
$ref: "#/definitions/FilterCheckHostResponse"
| https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445 | home/control_filtering.go |
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep | <mask> }
<mask>
<mask> // RegisterFilteringHandlers - register handlers
<mask> func RegisterFilteringHandlers() {
<mask> httpRegister(http.MethodGet, "/control/filtering/status", handleFilteringStatus)
<mask> httpRegister(http.MethodPost, "/control/filtering/config", handleFilteringConfig)
<mask> httpRegister(http.MethodPost, "/control/filtering/add_url", handleFilteringAddURL)
<mask> httpRegister(http.MethodPost, "/control/filtering/remove_url", handleFilteringRemoveURL)
<mask> httpRegister(http.MethodPost, "/control/filtering/set_url", handleFilteringSetURL)
<mask> httpRegister(http.MethodPost, "/control/filtering/refresh", handleFilteringRefresh)
<mask> httpRegister(http.MethodPost, "/control/filtering/set_rules", handleFilteringSetRules)
<mask> }
<mask>
<mask> func checkFiltersUpdateIntervalHours(i uint32) bool {
<mask> return i == 0 || i == 1 || i == 12 || i == 1*24 || i == 3*24 || i == 7*24
<mask> }
</s> + GET /filtering/check_host: Check if host name is filtered </s> add "github.com/miekg/dns" </s> add - "ReasonRewrite" </s> remove version: '0.99.3'
</s> add version: '0.101' </s> add /filtering/check_host:
get:
tags:
- filtering
operationId: filteringCheckHost
summary: 'Check if host name is filtered'
parameters:
- name: name
in: query
type: string
responses:
200:
description: OK
schema:
$ref: "#/definitions/FilterCheckHostResponse"
</s> add "net" | https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445 | home/control_filtering.go |
keep keep keep keep replace keep keep keep keep keep | <mask> swagger: '2.0'
<mask> info:
<mask> title: 'AdGuard Home'
<mask> description: 'AdGuard Home REST API. Admin web interface is built on top of this REST API.'
<mask> version: '0.99.3'
<mask> schemes:
<mask> - http
<mask> basePath: /control
<mask> produces:
<mask> - application/json
</s> + GET /filtering/check_host: Check if host name is filtered </s> add - "ReasonRewrite" </s> add /filtering/check_host:
get:
tags:
- filtering
operationId: filteringCheckHost
summary: 'Check if host name is filtered'
parameters:
- name: name
in: query
type: string
responses:
200:
description: OK
schema:
$ref: "#/definitions/FilterCheckHostResponse"
</s> add "github.com/miekg/dns" </s> remove httpRegister(http.MethodGet, "/control/filtering/status", handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", handleFilteringSetRules)
</s> add httpRegister("GET", "/control/filtering/status", handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", handleCheckHost) </s> add "net" | https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445 | openapi/openapi.yaml |
keep add keep keep keep keep keep | <mask> description: OK
<mask>
<mask> # --------------------------------------------------
<mask> # Safebrowsing methods
<mask> # --------------------------------------------------
<mask>
<mask> /safebrowsing/enable:
</s> + GET /filtering/check_host: Check if host name is filtered </s> add - "ReasonRewrite" </s> remove version: '0.99.3'
</s> add version: '0.101' </s> remove httpRegister(http.MethodGet, "/control/filtering/status", handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", handleFilteringSetRules)
</s> add httpRegister("GET", "/control/filtering/status", handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", handleCheckHost) </s> add "github.com/miekg/dns" </s> add "net" | https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445 | openapi/openapi.yaml |
keep keep keep add keep keep keep keep keep keep | <mask> - "FilteredParental"
<mask> - "FilteredInvalid"
<mask> - "FilteredSafeSearch"
<mask> - "FilteredBlockedService"
<mask> service_name:
<mask> type: "string"
<mask> description: "Set if reason=FilteredBlockedService"
<mask> status:
<mask> type: "string"
<mask> description: "DNS response status"
</s> + GET /filtering/check_host: Check if host name is filtered </s> add /filtering/check_host:
get:
tags:
- filtering
operationId: filteringCheckHost
summary: 'Check if host name is filtered'
parameters:
- name: name
in: query
type: string
responses:
200:
description: OK
schema:
$ref: "#/definitions/FilterCheckHostResponse"
</s> remove version: '0.99.3'
</s> add version: '0.101' </s> add "github.com/miekg/dns" </s> remove httpRegister(http.MethodGet, "/control/filtering/status", handleFilteringStatus)
httpRegister(http.MethodPost, "/control/filtering/config", handleFilteringConfig)
httpRegister(http.MethodPost, "/control/filtering/add_url", handleFilteringAddURL)
httpRegister(http.MethodPost, "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister(http.MethodPost, "/control/filtering/set_url", handleFilteringSetURL)
httpRegister(http.MethodPost, "/control/filtering/refresh", handleFilteringRefresh)
httpRegister(http.MethodPost, "/control/filtering/set_rules", handleFilteringSetRules)
</s> add httpRegister("GET", "/control/filtering/status", handleFilteringStatus)
httpRegister("POST", "/control/filtering/config", handleFilteringConfig)
httpRegister("POST", "/control/filtering/add_url", handleFilteringAddURL)
httpRegister("POST", "/control/filtering/remove_url", handleFilteringRemoveURL)
httpRegister("POST", "/control/filtering/set_url", handleFilteringSetURL)
httpRegister("POST", "/control/filtering/refresh", handleFilteringRefresh)
httpRegister("POST", "/control/filtering/set_rules", handleFilteringSetRules)
httpRegister("GET", "/control/filtering/check_host", handleCheckHost) </s> add "net" | https://github.com/AdguardTeam/AdGuardHome/commit/0d7c01d50f8efdc55203178cafe091ee07780445 | openapi/openapi.yaml |
keep keep replace keep replace keep keep | <mask> defer clients.lock.Unlock()
<mask>
<mask> clientObjects := []clientObject{}
<mask> for _, cli := range clients.list {
<mask> cy := clientObject{
<mask> Name: cli.Name,
<mask> UseGlobalSettings: !cli.UseOwnSettings,
</s> all: doc changes, imp names </s> remove // above loop can generate different orderings when writing to the
// config file: this produces lots of diffs in config files, so sort
// objects by name before writing.
</s> add // above loop can generate different orderings when writing to the config
// file: this produces lots of diffs in config files, so sort objects by
// name before writing. </s> remove clientObjects = append(clientObjects, cy)
</s> add clientObjects = append(clientObjects, cliObj) </s> remove cy.Tags = stringutil.CloneSlice(cli.Tags)
cy.IDs = stringutil.CloneSlice(cli.IDs)
cy.BlockedServices = stringutil.CloneSlice(cli.BlockedServices)
cy.Upstreams = stringutil.CloneSlice(cli.Upstreams)
</s> add cliObj.Tags = stringutil.CloneSlice(cli.Tags)
cliObj.IDs = stringutil.CloneSlice(cli.IDs)
cliObj.BlockedServices = stringutil.CloneSlice(cli.BlockedServices)
cliObj.Upstreams = stringutil.CloneSlice(cli.Upstreams) | https://github.com/AdguardTeam/AdGuardHome/commit/0e1015a4ee7f4101ef21cb2b2688beb50a11dc83 | internal/home/clients.go |
keep replace replace replace replace keep replace keep keep keep keep | <mask>
<mask> cy.Tags = stringutil.CloneSlice(cli.Tags)
<mask> cy.IDs = stringutil.CloneSlice(cli.IDs)
<mask> cy.BlockedServices = stringutil.CloneSlice(cli.BlockedServices)
<mask> cy.Upstreams = stringutil.CloneSlice(cli.Upstreams)
<mask>
<mask> clientObjects = append(clientObjects, cy)
<mask> }
<mask>
<mask> // Maps aren't guaranteed to iterate in the same order each time, so the
<mask> // above loop can generate different orderings when writing to the
</s> all: doc changes, imp names </s> remove // above loop can generate different orderings when writing to the
// config file: this produces lots of diffs in config files, so sort
// objects by name before writing.
</s> add // above loop can generate different orderings when writing to the config
// file: this produces lots of diffs in config files, so sort objects by
// name before writing. </s> remove clientObjects := []clientObject{}
</s> add var clientObjects []clientObject </s> remove cy := clientObject{
</s> add cliObj := clientObject{ | https://github.com/AdguardTeam/AdGuardHome/commit/0e1015a4ee7f4101ef21cb2b2688beb50a11dc83 | internal/home/clients.go |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask> clientObjects = append(clientObjects, cy)
<mask> }
<mask>
<mask> // Maps aren't guaranteed to iterate in the same order each time, so the
<mask> // above loop can generate different orderings when writing to the
<mask> // config file: this produces lots of diffs in config files, so sort
<mask> // objects by name before writing.
<mask> sort.Slice(clientObjects, func(i, j int) bool {
<mask> return clientObjects[i].Name < clientObjects[j].Name
<mask> })
<mask> *objects = append(*objects, clientObjects...)
<mask> }
</s> all: doc changes, imp names </s> remove clientObjects = append(clientObjects, cy)
</s> add clientObjects = append(clientObjects, cliObj) </s> remove cy.Tags = stringutil.CloneSlice(cli.Tags)
cy.IDs = stringutil.CloneSlice(cli.IDs)
cy.BlockedServices = stringutil.CloneSlice(cli.BlockedServices)
cy.Upstreams = stringutil.CloneSlice(cli.Upstreams)
</s> add cliObj.Tags = stringutil.CloneSlice(cli.Tags)
cliObj.IDs = stringutil.CloneSlice(cli.IDs)
cliObj.BlockedServices = stringutil.CloneSlice(cli.BlockedServices)
cliObj.Upstreams = stringutil.CloneSlice(cli.Upstreams) </s> remove clientObjects := []clientObject{}
</s> add var clientObjects []clientObject </s> remove cy := clientObject{
</s> add cliObj := clientObject{ | https://github.com/AdguardTeam/AdGuardHome/commit/0e1015a4ee7f4101ef21cb2b2688beb50a11dc83 | internal/home/clients.go |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask>
<mask> // configure log level and output
<mask> configureLogger(args)
<mask>
<mask> // Go memory hacks
<mask> memoryUsage(args)
<mask>
<mask> // Print the first message after logger is configured.
<mask> log.Println(version.Full())
<mask> log.Debug("current working directory is %s", Context.workDir)
<mask> if args.runningAsService {
<mask> log.Info("AdGuard Home is running as a service")
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> remove // disableMemoryOptimization - disables memory optimization hacks
// see memoryUsage() function for the details
disableMemoryOptimization bool
</s> add </s> add // TODO(e.burkov): Remove after v0.108.0. </s> add "github.com/AdguardTeam/golibs/log" </s> remove nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
</s> add nil, nil, func(_ options, _ string) (f effect, err error) {
log.Info("warning: using --no-mem-optimization flag has no effect and is deprecated")
return nil, nil
},
func(o options) []string { return nil }, </s> remove assert.False(t, testParseOK(t).disableMemoryOptimization, "empty is not disable update")
assert.True(t, testParseOK(t, "--no-mem-optimization").disableMemoryOptimization, "--no-mem-optimization is disable update")
</s> add o, eff, err := parse("", []string{"--no-mem-optimization"})
require.NoError(t, err)
assert.Nil(t, eff)
assert.Zero(t, o) </s> remove }, {
name: "disable_mem_opt",
opts: options{disableMemoryOptimization: true},
ss: []string{"--no-mem-optimization"},
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/home.go |
keep keep add keep keep keep keep | <mask> "strconv"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/version"
<mask> )
<mask>
<mask> // options passed from command-line arguments
<mask> type options struct {
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> remove // disableMemoryOptimization - disables memory optimization hacks
// see memoryUsage() function for the details
disableMemoryOptimization bool
</s> add </s> remove const reportFmt = "expected %s but got %s"
</s> add </s> remove // Go memory hacks
memoryUsage(args)
</s> add </s> add // TODO(e.burkov): Remove after v0.108.0. </s> remove }, {
name: "disable_mem_opt",
opts: options{disableMemoryOptimization: true},
ss: []string{"--no-mem-optimization"},
</s> add </s> remove "--no-mem-optimization",
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/options.go |
keep keep keep keep replace replace replace replace keep keep keep keep keep | <mask>
<mask> // runningAsService flag is set to true when options are passed from the service runner
<mask> runningAsService bool
<mask>
<mask> // disableMemoryOptimization - disables memory optimization hacks
<mask> // see memoryUsage() function for the details
<mask> disableMemoryOptimization bool
<mask>
<mask> glinetMode bool // Activate GL-Inet compatibility mode
<mask>
<mask> // noEtcHosts flag should be provided when /etc/hosts file shouldn't be
<mask> // used.
<mask> noEtcHosts bool
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> remove // Go memory hacks
memoryUsage(args)
</s> add </s> add "github.com/AdguardTeam/golibs/log" </s> add // TODO(e.burkov): Remove after v0.108.0. </s> remove nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
</s> add nil, nil, func(_ options, _ string) (f effect, err error) {
log.Info("warning: using --no-mem-optimization flag has no effect and is deprecated")
return nil, nil
},
func(o options) []string { return nil }, </s> remove assert.False(t, testParseOK(t).disableMemoryOptimization, "empty is not disable update")
assert.True(t, testParseOK(t, "--no-mem-optimization").disableMemoryOptimization, "--no-mem-optimization is disable update")
</s> add o, eff, err := parse("", []string{"--no-mem-optimization"})
require.NoError(t, err)
assert.Nil(t, eff)
assert.Zero(t, o) </s> remove require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result)
for i, r := range result {
assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, result)
}
</s> add assert.ElementsMatch(t, tc.ss, result) | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/options.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> var disableMemoryOptimizationArg = arg{
<mask> "Disable memory optimization.",
<mask> "no-mem-optimization", "",
<mask> nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
<mask> func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
<mask> }
<mask>
<mask> var verboseArg = arg{
<mask> "Enable verbose output.",
<mask> "verbose", "v",
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> remove const reportFmt = "expected %s but got %s"
</s> add </s> remove }, {
name: "disable_mem_opt",
opts: options{disableMemoryOptimization: true},
ss: []string{"--no-mem-optimization"},
</s> add </s> remove assert.False(t, testParseOK(t).disableMemoryOptimization, "empty is not disable update")
assert.True(t, testParseOK(t, "--no-mem-optimization").disableMemoryOptimization, "--no-mem-optimization is disable update")
</s> add o, eff, err := parse("", []string{"--no-mem-optimization"})
require.NoError(t, err)
assert.Nil(t, eff)
assert.Zero(t, o) </s> remove "--no-mem-optimization",
</s> add </s> remove serviceControlAction: "run",
configFilename: "config",
workDir: "work",
pidFile: "pid",
disableUpdate: true,
disableMemoryOptimization: true,
</s> add serviceControlAction: "run",
configFilename: "config",
workDir: "work",
pidFile: "pid",
disableUpdate: true, </s> add // TODO(e.burkov): Remove after v0.108.0. | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/options.go |
keep keep keep add keep keep keep keep keep keep | <mask> assert.False(t, testParseOK(t).disableUpdate, "empty is not disable update")
<mask> assert.True(t, testParseOK(t, "--no-check-update").disableUpdate, "--no-check-update is disable update")
<mask> }
<mask>
<mask> func TestParseDisableMemoryOptimization(t *testing.T) {
<mask> o, eff, err := parse("", []string{"--no-mem-optimization"})
<mask> require.NoError(t, err)
<mask>
<mask> assert.Nil(t, eff)
<mask> assert.Zero(t, o)
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> remove assert.False(t, testParseOK(t).disableMemoryOptimization, "empty is not disable update")
assert.True(t, testParseOK(t, "--no-mem-optimization").disableMemoryOptimization, "--no-mem-optimization is disable update")
</s> add o, eff, err := parse("", []string{"--no-mem-optimization"})
require.NoError(t, err)
assert.Nil(t, eff)
assert.Zero(t, o) </s> remove nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
</s> add nil, nil, func(_ options, _ string) (f effect, err error) {
log.Info("warning: using --no-mem-optimization flag has no effect and is deprecated")
return nil, nil
},
func(o options) []string { return nil }, </s> remove const reportFmt = "expected %s but got %s"
</s> add </s> remove require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result)
for i, r := range result {
assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, result)
}
</s> add assert.ElementsMatch(t, tc.ss, result) </s> remove "--no-mem-optimization",
</s> add </s> remove // Go memory hacks
memoryUsage(args)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/options_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> assert.True(t, testParseOK(t, "--no-check-update").disableUpdate, "--no-check-update is disable update")
<mask> }
<mask>
<mask> func TestParseDisableMemoryOptimization(t *testing.T) {
<mask> assert.False(t, testParseOK(t).disableMemoryOptimization, "empty is not disable update")
<mask> assert.True(t, testParseOK(t, "--no-mem-optimization").disableMemoryOptimization, "--no-mem-optimization is disable update")
<mask> }
<mask>
<mask> func TestParseService(t *testing.T) {
<mask> assert.Equal(t, "", testParseOK(t).serviceControlAction, "empty is not service cmd")
<mask> assert.Equal(t, "cmd", testParseOK(t, "-s", "cmd").serviceControlAction, "-s is service cmd")
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> add // TODO(e.burkov): Remove after v0.108.0. </s> remove const reportFmt = "expected %s but got %s"
</s> add </s> remove nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
</s> add nil, nil, func(_ options, _ string) (f effect, err error) {
log.Info("warning: using --no-mem-optimization flag has no effect and is deprecated")
return nil, nil
},
func(o options) []string { return nil }, </s> remove "--no-mem-optimization",
</s> add </s> remove // disableMemoryOptimization - disables memory optimization hacks
// see memoryUsage() function for the details
disableMemoryOptimization bool
</s> add </s> remove require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result)
for i, r := range result {
assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, result)
}
</s> add assert.ElementsMatch(t, tc.ss, result) | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/options_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> testParseErr(t, "unknown dash", "-")
<mask> }
<mask>
<mask> func TestSerialize(t *testing.T) {
<mask> const reportFmt = "expected %s but got %s"
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> opts options
<mask> ss []string
<mask> }{{
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> remove nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
</s> add nil, nil, func(_ options, _ string) (f effect, err error) {
log.Info("warning: using --no-mem-optimization flag has no effect and is deprecated")
return nil, nil
},
func(o options) []string { return nil }, </s> remove require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result)
for i, r := range result {
assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, result)
}
</s> add assert.ElementsMatch(t, tc.ss, result) </s> remove "--no-mem-optimization",
</s> add </s> add "github.com/AdguardTeam/golibs/log" </s> remove assert.False(t, testParseOK(t).disableMemoryOptimization, "empty is not disable update")
assert.True(t, testParseOK(t, "--no-mem-optimization").disableMemoryOptimization, "--no-mem-optimization is disable update")
</s> add o, eff, err := parse("", []string{"--no-mem-optimization"})
require.NoError(t, err)
assert.Nil(t, eff)
assert.Zero(t, o) </s> add // TODO(e.burkov): Remove after v0.108.0. | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/options_test.go |
keep keep keep keep replace replace replace replace keep keep keep replace replace replace replace replace replace keep keep keep keep | <mask> }, {
<mask> name: "glinet_mode",
<mask> opts: options{glinetMode: true},
<mask> ss: []string{"--glinet"},
<mask> }, {
<mask> name: "disable_mem_opt",
<mask> opts: options{disableMemoryOptimization: true},
<mask> ss: []string{"--no-mem-optimization"},
<mask> }, {
<mask> name: "multiple",
<mask> opts: options{
<mask> serviceControlAction: "run",
<mask> configFilename: "config",
<mask> workDir: "work",
<mask> pidFile: "pid",
<mask> disableUpdate: true,
<mask> disableMemoryOptimization: true,
<mask> },
<mask> ss: []string{
<mask> "-c", "config",
<mask> "-w", "work",
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> remove "--no-mem-optimization",
</s> add </s> remove nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
</s> add nil, nil, func(_ options, _ string) (f effect, err error) {
log.Info("warning: using --no-mem-optimization flag has no effect and is deprecated")
return nil, nil
},
func(o options) []string { return nil }, </s> remove require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result)
for i, r := range result {
assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, result)
}
</s> add assert.ElementsMatch(t, tc.ss, result) </s> remove const reportFmt = "expected %s but got %s"
</s> add </s> add "github.com/AdguardTeam/golibs/log" | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/options_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> "-w", "work",
<mask> "-s", "run",
<mask> "--pidfile", "pid",
<mask> "--no-check-update",
<mask> "--no-mem-optimization",
<mask> },
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> remove require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result)
for i, r := range result {
assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, result)
}
</s> add assert.ElementsMatch(t, tc.ss, result) </s> remove serviceControlAction: "run",
configFilename: "config",
workDir: "work",
pidFile: "pid",
disableUpdate: true,
disableMemoryOptimization: true,
</s> add serviceControlAction: "run",
configFilename: "config",
workDir: "work",
pidFile: "pid",
disableUpdate: true, </s> remove }, {
name: "disable_mem_opt",
opts: options{disableMemoryOptimization: true},
ss: []string{"--no-mem-optimization"},
</s> add </s> remove const reportFmt = "expected %s but got %s"
</s> add </s> remove nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
</s> add nil, nil, func(_ options, _ string) (f effect, err error) {
log.Info("warning: using --no-mem-optimization flag has no effect and is deprecated")
return nil, nil
},
func(o options) []string { return nil }, </s> remove assert.False(t, testParseOK(t).disableMemoryOptimization, "empty is not disable update")
assert.True(t, testParseOK(t, "--no-mem-optimization").disableMemoryOptimization, "--no-mem-optimization is disable update")
</s> add o, eff, err := parse("", []string{"--no-mem-optimization"})
require.NoError(t, err)
assert.Nil(t, eff)
assert.Zero(t, o) | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/options_test.go |
keep keep keep keep replace replace replace replace replace keep keep keep | <mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> result := serialize(tc.opts)
<mask> require.Lenf(t, result, len(tc.ss), reportFmt, tc.ss, result)
<mask>
<mask> for i, r := range result {
<mask> assert.Equalf(t, tc.ss[i], r, reportFmt, tc.ss, result)
<mask> }
<mask> })
<mask> }
<mask> }
</s> Pull request: 4437 depr memory opt
Merge in DNS/adguard-home from 4437-rm-mem-opt to master
Updates #4437.
Updates #2044.
Squashed commit of the following:
commit d1e5520213f6b68570d18a8d831d4923112901ba
Merge: 73a6b494 8bb95469
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 19:37:09 2022 +0300
Merge branch 'master' into 4437-rm-mem-opt
commit 73a6b4948cb32f1cb79a54b244018b29382fad76
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:33:23 2022 +0300
all: imp log of changes
commit a62efcdcd44de300726c906c7f6198c0a02d4ccf
Author: Eugene Burkov <[email protected]>
Date: Wed Apr 6 18:27:42 2022 +0300
home: depr memory opt </s> remove "--no-mem-optimization",
</s> add </s> remove const reportFmt = "expected %s but got %s"
</s> add </s> remove assert.False(t, testParseOK(t).disableMemoryOptimization, "empty is not disable update")
assert.True(t, testParseOK(t, "--no-mem-optimization").disableMemoryOptimization, "--no-mem-optimization is disable update")
</s> add o, eff, err := parse("", []string{"--no-mem-optimization"})
require.NoError(t, err)
assert.Nil(t, eff)
assert.Zero(t, o) </s> add // TODO(e.burkov): Remove after v0.108.0. </s> remove nil, func(o options) (options, error) { o.disableMemoryOptimization = true; return o, nil }, nil,
func(o options) []string { return boolSliceOrNil(o.disableMemoryOptimization) },
</s> add nil, nil, func(_ options, _ string) (f effect, err error) {
log.Info("warning: using --no-mem-optimization flag has no effect and is deprecated")
return nil, nil
},
func(o options) []string { return nil }, </s> remove }, {
name: "disable_mem_opt",
opts: options{disableMemoryOptimization: true},
ss: []string{"--no-mem-optimization"},
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0e608fda1367c33e8da1b8fc28029f45b3d69fab | internal/home/options_test.go |
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 replace | <mask> .DS_Store
<mask> /.git
<mask> /.github
<mask> /.vscode
<mask> .idea
<mask> /AdGuardHome
<mask> /AdGuardHome.exe
<mask> /AdGuardHome.yaml
<mask> /AdGuardHome.log
<mask> /data
<mask> /build
<mask> /build2
<mask> /dist
<mask> /client/node_modules
<mask> /client2/node_modules
<mask> /.gitattributes
<mask> /.gitignore
<mask> /.goreleaser.yml
<mask> /changelog.config.js
<mask> /coverage.txt
<mask> /Dockerfile
<mask> /LICENSE.txt
<mask> /Makefile
<mask> /querylog.json
<mask> /querylog.json.1
<mask> /*.md
<mask>
<mask> # Test output
<mask> dnsfilter/tests/top-1m.csv
<mask> dnsfilter/tests/dnsfilter.TestLotsOfRules*.pprof
<mask>
<mask> # Snapcraft build temporary files
<mask> *.snap
<mask> launchpad_credentials
<mask> snapcraft_login
<mask> snapcraft.yaml.bak
<mask>
<mask> # IntelliJ IDEA project files
<mask> *.iml
<mask>
<mask> # Packr
<mask> *-packr.go
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove # * build -- builds AdGuardHome for the current platform
# * client -- builds client-side code of AdGuard Home
# * client-watch -- builds client-side code of AdGuard Home and watches for changes there
# * docker -- builds a docker image for the current platform
# * clean -- clean everything created by previous builds
# * lint -- run all linters
# * test -- run all unit-tests
# * dependencies -- installs dependencies (go and npm modules)
# * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
#
# Building releases:
#
# * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
# * release_and_sign -- builds AdGuard Home distros and signs the binary files.
# CHANNEL must be specified (edge, release or beta).
# * sign -- Repacks all release archive files and signs the binary files inside them.
# For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
# gpg --import public.txt
# gpg --import private.txt
# GPG_KEY_PASSPHRASE must contain the GPG key passphrase
# * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
# you must specify:
# * DOCKER_IMAGE_NAME - adguard/adguard-home
# * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
GO := go
GOPATH := $(shell $(GO) env GOPATH)
PWD := $(shell pwd)
TARGET=AdGuardHome
BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
GPG_KEY := [email protected]
GPG_KEY_PASSPHRASE :=
GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
VERBOSE := -v
REBUILD_CLIENT = 1
# See release target
DIST_DIR=dist
# Update channel. Can be release, beta or edge. Uses edge by default.
CHANNEL ?= edge
# Validate channel
ifneq ($(CHANNEL),release)
ifneq ($(CHANNEL),beta)
ifneq ($(CHANNEL),edge)
$(error CHANNEL value is not valid. Valid values are release,beta or edge)
endif
endif
endif
# Version history URL (see
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
ifeq ($(CHANNEL),edge)
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
endif
# goreleaser command depends on the $CHANNEL
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
ifneq ($(CHANNEL),edge)
# If this is not an "edge" build, use normal release command
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
endif
# Version properties
COMMIT=$(shell git rev-parse --short HEAD)
TAG_NAME=$(shell git describe --abbrev=0)
PRERELEASE_VERSION=$(shell git describe --abbrev=0)
# TODO(a.garipov): The cut call is a temporary solution to trim
# prerelease versions. See the comment in .goreleaser.yml.
RELEASE_VERSION=$(shell git describe --abbrev=0 | cut -c 1-8)
SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
# Set proper version
VERSION=
ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
ifeq ($(CHANNEL),edge)
VERSION=$(SNAPSHOT_VERSION)
else ifeq ($(CHANNEL),beta)
VERSION=$(PRERELEASE_VERSION)
else
VERSION=$(RELEASE_VERSION)
endif
else
VERSION=$(SNAPSHOT_VERSION)
endif
# Docker target parameters
DOCKER_IMAGE_NAME ?= adguardhome-dev
DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
# Docker tags (can be redefined)
DOCKER_TAGS ?=
ifndef DOCKER_TAGS
ifeq ($(CHANNEL),release)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
endif
ifeq ($(CHANNEL),beta)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
endif
ifeq ($(CHANNEL),edge)
# Don't set the version tag when pushing to "edge"
DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
# DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
endif
endif
# Validate docker build arguments
ifndef DOCKER_IMAGE_NAME
$(error DOCKER_IMAGE_NAME value is not set)
endif
# OS-specific flags
TEST_FLAGS := --race $(VERBOSE)
ifeq ($(OS),Windows_NT)
TEST_FLAGS :=
endif
.PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
all: build
init:
git config core.hooksPath .githooks
build:
test '$(REBUILD_CLIENT)' = '1' && $(MAKE) client_with_deps || exit 0
$(GO) mod download
PATH=$(GOPATH)/bin:$(PATH) $(GO) generate ./...
CGO_ENABLED=0 $(GO) build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
PATH=$(GOPATH)/bin:$(PATH) packr clean
client:
npm --prefix client run build-prod
yarn --cwd client2 build
client_with_deps:
npm --prefix client ci
npm --prefix client run build-prod
yarn --cwd client2 build
client-watch:
npm --prefix client run watch
yarn --cwd client2 start
docker:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--load \
-t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
@echo Now you can run the docker image:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
</s> add # GOPROXY = https://goproxy.io|https://goproxy.cn|direct
GOPROXY = https://goproxy.cn,https://goproxy.io,direct
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
ENV = env\
COMMIT='$(COMMIT)'\
CHANNEL='$(CHANNEL)'\
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
DIST_DIR='$(DIST_DIR)'\
GO='$(GO)'\
GOPROXY='$(GOPROXY)'\
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
SIGN='$(SIGN)'\
VERBOSE='$(VERBOSE)'\
VERSION='$(VERSION)'\
# Keep the line above blank.
# Keep this target first, so that a naked make invocation triggers
# a full build.
build: deps quick-build
quick-build: js-build go-build
ci: deps test
deps: js-deps go-deps </s> remove DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--output "$(DOCKER_OUTPUT)" \
-t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
@echo If the image was pushed to the registry, you can now run it:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
release: client_with_deps
$(GO) mod download
@echo Starting release build: version $(VERSION), channel $(CHANNEL)
CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
$(call write_version_file,$(VERSION))
PATH=$(GOPATH)/bin:$(PATH) packr clean
release_and_sign: client_with_deps
$(MAKE) release
$(call repack_dist)
sign:
$(call repack_dist)
define write_version_file
$(eval version := $(1))
@echo Writing version file: $(version)
# Variables for CI
rm -f $(DIST_DIR)/version.txt
echo "version=$(version)" > $(DIST_DIR)/version.txt
# Prepare the version.json file
rm -f $(DIST_DIR)/version.json
echo "{" >> $(DIST_DIR)/version.json
echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
# Windows builds
echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
# MacOS builds
echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
# Linux
echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, all kinds of ARM
echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, MIPS
echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD
echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD, all kinds of ARM
echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
# Finish
echo "}" >> $(DIST_DIR)/version.json
endef
define repack_dist
# Repack archive files
# A temporary solution for our auto-update code to be able to unpack these archive files
# The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
# and we can't create it
rm -rf $(DIST_DIR)/AdGuardHome
# Windows builds
$(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
$(call zip_repack_windows,AdGuardHome_windows_386.zip)
# MacOS builds
$(call zip_repack,AdGuardHome_darwin_amd64.zip)
$(call zip_repack,AdGuardHome_darwin_386.zip)
# Linux
$(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
$(call tar_repack,AdGuardHome_linux_386.tar.gz)
# Linux, all kinds of ARM
$(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
$(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
# Linux, MIPS
$(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
# FreeBSD
$(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
# FreeBSD, all kinds of ARM
$(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
endef
define zip_repack_windows
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define zip_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define tar_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
tar xzf $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
tar czf $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
</s> add @ echo "use make build-docker instead"
@ $(MAKE) build-docker
go-install-tools:
@ echo "use make go-tools instead"
@ $(MAKE) go-tools
release:
@ echo "use make build-release instead"
@ $(MAKE) build-release </s> remove # Available targets
</s> add # See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html.
.POSIX:
CHANNEL = development
CLIENT_BETA_DIR = client2
CLIENT_DIR = client
COMMIT = $$(git rev-parse --short HEAD)
DIST_DIR = dist
GO = go
# TODO(a.garipov): Add more default proxies using pipes after update to
# Go 1.15. </s> add # TODO(a.garipov): Remove the legacy targets once the build
# infrastructure stops using them. </s> remove - 'app'
- 'docker'
</s> add - 'build-release' </s> remove npm --prefix client ci
yarn --cwd client2 install
$(GO) mod download
clean:
rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt
rm -f -r ./build/ ./client/node_modules/ ./data/ ./$(DIST_DIR)/
# Set the GOPATH explicitly in case make clean is called from under sudo
# after a Docker build.
env PATH="$(GOPATH)/bin:$$PATH" packr clean
rm -f -r ./bin/
</s> add @ echo "use make deps instead"
@ $(MAKE) deps | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | .dockerignore |
keep keep keep keep replace keep keep keep keep keep | <mask> 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}"
<mask> 'restore-keys': '${{ runner.os }}-node-'
<mask> - 'name': 'Run make ci'
<mask> 'shell': 'bash'
<mask> 'run': 'make ci'
<mask> - 'name': 'Upload coverage'
<mask> 'uses': 'codecov/codecov-action@v1'
<mask> 'if': "success() && matrix.os == 'ubuntu-latest'"
<mask> 'with':
<mask> 'token': '${{ secrets.CODECOV_TOKEN }}'
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove - 'name': 'Set up GoReleaser'
'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh'
- 'name': 'Run snapshot build'
'run': 'make release'
'docker':
'runs-on': 'ubuntu-latest'
'needs': 'test'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
</s> add </s> remove 'app':
</s> add 'build-release': </s> remove 'run': 'npm --prefix client ci'
</s> add 'run': 'npm --prefix="./client" ci' </s> remove 'fields': 'repo, message, commit, author, job'
</s> add 'fields': 'repo, message, commit, author, workflow' </s> remove 'fields': 'repo, message, commit, author, job'
</s> add 'fields': 'repo, message, commit, author, workflow' </s> remove 'run': 'npm --prefix client run lint'
</s> add 'run': 'npm --prefix="./client" run lint' | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | .github/workflows/build.yml |
keep keep keep keep replace keep keep keep keep keep | <mask> 'if': "success() && matrix.os == 'ubuntu-latest'"
<mask> 'with':
<mask> 'token': '${{ secrets.CODECOV_TOKEN }}'
<mask> 'file': './coverage.txt'
<mask> 'app':
<mask> 'runs-on': 'ubuntu-latest'
<mask> 'needs': 'test'
<mask> 'steps':
<mask> - 'name': 'Checkout'
<mask> 'uses': 'actions/checkout@v2'
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove 'run': 'make ci'
</s> add 'run': 'make VERBOSE=1 ci' </s> remove - 'name': 'Set up GoReleaser'
'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh'
- 'name': 'Run snapshot build'
'run': 'make release'
'docker':
'runs-on': 'ubuntu-latest'
'needs': 'test'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
</s> add </s> remove make go-install-tools go-lint
</s> add make go-deps go-tools go-lint </s> remove 'run': 'npm --prefix client ci'
</s> add 'run': 'npm --prefix="./client" ci' </s> remove 'fields': 'repo, message, commit, author, job'
</s> add 'fields': 'repo, message, commit, author, workflow' </s> remove 'fields': 'repo, message, commit, author, job'
</s> add 'fields': 'repo, message, commit, author, workflow' | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | .github/workflows/build.yml |
keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep replace replace keep keep | <mask> 'run': 'sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft'
<mask> - 'name': 'Set up GoReleaser'
<mask> 'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh'
<mask> - 'name': 'Run snapshot build'
<mask> 'run': 'make release'
<mask>
<mask> 'docker':
<mask> 'runs-on': 'ubuntu-latest'
<mask> 'needs': 'test'
<mask> 'steps':
<mask> - 'name': 'Checkout'
<mask> 'uses': 'actions/checkout@v2'
<mask> 'with':
<mask> 'fetch-depth': 0
<mask> - 'name': 'Set up QEMU'
<mask> 'uses': 'docker/setup-qemu-action@v1'
<mask> - 'name': 'Set up Docker Buildx'
<mask> 'uses': 'docker/setup-buildx-action@v1'
<mask> - 'name': 'Docker Buildx (build)'
<mask> 'run': 'make docker-multi-arch'
<mask>
<mask> 'notify':
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove 'run': 'npm --prefix client ci'
</s> add 'run': 'npm --prefix="./client" ci' </s> remove 'app':
</s> add 'build-release': </s> remove make go-install-tools go-lint
</s> add make go-deps go-tools go-lint </s> remove 'run': 'make ci'
</s> add 'run': 'make VERBOSE=1 ci' </s> remove 'run': 'npm --prefix client run lint'
</s> add 'run': 'npm --prefix="./client" run lint' | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | .github/workflows/build.yml |
keep keep keep keep replace replace keep keep keep keep keep | <mask> 'run': 'make docker-multi-arch'
<mask>
<mask> 'notify':
<mask> 'needs':
<mask> - 'app'
<mask> - 'docker'
<mask> # Secrets are not passed to workflows that are triggered by a pull request
<mask> # from a fork.
<mask> #
<mask> # Use always() to signal to the runner that this job must run even if the
<mask> # previous ones failed.
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove 'run': 'npm --prefix client run lint'
</s> add 'run': 'npm --prefix="./client" run lint' </s> remove # * build -- builds AdGuardHome for the current platform
# * client -- builds client-side code of AdGuard Home
# * client-watch -- builds client-side code of AdGuard Home and watches for changes there
# * docker -- builds a docker image for the current platform
# * clean -- clean everything created by previous builds
# * lint -- run all linters
# * test -- run all unit-tests
# * dependencies -- installs dependencies (go and npm modules)
# * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
#
# Building releases:
#
# * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
# * release_and_sign -- builds AdGuard Home distros and signs the binary files.
# CHANNEL must be specified (edge, release or beta).
# * sign -- Repacks all release archive files and signs the binary files inside them.
# For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
# gpg --import public.txt
# gpg --import private.txt
# GPG_KEY_PASSPHRASE must contain the GPG key passphrase
# * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
# you must specify:
# * DOCKER_IMAGE_NAME - adguard/adguard-home
# * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
GO := go
GOPATH := $(shell $(GO) env GOPATH)
PWD := $(shell pwd)
TARGET=AdGuardHome
BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
GPG_KEY := [email protected]
GPG_KEY_PASSPHRASE :=
GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
VERBOSE := -v
REBUILD_CLIENT = 1
# See release target
DIST_DIR=dist
# Update channel. Can be release, beta or edge. Uses edge by default.
CHANNEL ?= edge
# Validate channel
ifneq ($(CHANNEL),release)
ifneq ($(CHANNEL),beta)
ifneq ($(CHANNEL),edge)
$(error CHANNEL value is not valid. Valid values are release,beta or edge)
endif
endif
endif
# Version history URL (see
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
ifeq ($(CHANNEL),edge)
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
endif
# goreleaser command depends on the $CHANNEL
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
ifneq ($(CHANNEL),edge)
# If this is not an "edge" build, use normal release command
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
endif
# Version properties
COMMIT=$(shell git rev-parse --short HEAD)
TAG_NAME=$(shell git describe --abbrev=0)
PRERELEASE_VERSION=$(shell git describe --abbrev=0)
# TODO(a.garipov): The cut call is a temporary solution to trim
# prerelease versions. See the comment in .goreleaser.yml.
RELEASE_VERSION=$(shell git describe --abbrev=0 | cut -c 1-8)
SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
# Set proper version
VERSION=
ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
ifeq ($(CHANNEL),edge)
VERSION=$(SNAPSHOT_VERSION)
else ifeq ($(CHANNEL),beta)
VERSION=$(PRERELEASE_VERSION)
else
VERSION=$(RELEASE_VERSION)
endif
else
VERSION=$(SNAPSHOT_VERSION)
endif
# Docker target parameters
DOCKER_IMAGE_NAME ?= adguardhome-dev
DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
# Docker tags (can be redefined)
DOCKER_TAGS ?=
ifndef DOCKER_TAGS
ifeq ($(CHANNEL),release)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
endif
ifeq ($(CHANNEL),beta)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
endif
ifeq ($(CHANNEL),edge)
# Don't set the version tag when pushing to "edge"
DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
# DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
endif
endif
# Validate docker build arguments
ifndef DOCKER_IMAGE_NAME
$(error DOCKER_IMAGE_NAME value is not set)
endif
# OS-specific flags
TEST_FLAGS := --race $(VERBOSE)
ifeq ($(OS),Windows_NT)
TEST_FLAGS :=
endif
.PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
all: build
init:
git config core.hooksPath .githooks
build:
test '$(REBUILD_CLIENT)' = '1' && $(MAKE) client_with_deps || exit 0
$(GO) mod download
PATH=$(GOPATH)/bin:$(PATH) $(GO) generate ./...
CGO_ENABLED=0 $(GO) build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
PATH=$(GOPATH)/bin:$(PATH) packr clean
client:
npm --prefix client run build-prod
yarn --cwd client2 build
client_with_deps:
npm --prefix client ci
npm --prefix client run build-prod
yarn --cwd client2 build
client-watch:
npm --prefix client run watch
yarn --cwd client2 start
docker:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--load \
-t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
@echo Now you can run the docker image:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
</s> add # GOPROXY = https://goproxy.io|https://goproxy.cn|direct
GOPROXY = https://goproxy.cn,https://goproxy.io,direct
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
ENV = env\
COMMIT='$(COMMIT)'\
CHANNEL='$(CHANNEL)'\
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
DIST_DIR='$(DIST_DIR)'\
GO='$(GO)'\
GOPROXY='$(GOPROXY)'\
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
SIGN='$(SIGN)'\
VERBOSE='$(VERBOSE)'\
VERSION='$(VERSION)'\
# Keep the line above blank.
# Keep this target first, so that a naked make invocation triggers
# a full build.
build: deps quick-build
quick-build: js-build go-build
ci: deps test
deps: js-deps go-deps </s> remove - 'name': 'Docker Buildx (build)'
'run': 'make docker-multi-arch'
</s> add - 'name': 'Run snapshot build'
'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker' </s> remove # Available targets
</s> add # See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html.
.POSIX:
CHANNEL = development
CLIENT_BETA_DIR = client2
CLIENT_DIR = client
COMMIT = $$(git rev-parse --short HEAD)
DIST_DIR = dist
GO = go
# TODO(a.garipov): Add more default proxies using pipes after update to
# Go 1.15. </s> remove DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--output "$(DOCKER_OUTPUT)" \
-t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
@echo If the image was pushed to the registry, you can now run it:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
release: client_with_deps
$(GO) mod download
@echo Starting release build: version $(VERSION), channel $(CHANNEL)
CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
$(call write_version_file,$(VERSION))
PATH=$(GOPATH)/bin:$(PATH) packr clean
release_and_sign: client_with_deps
$(MAKE) release
$(call repack_dist)
sign:
$(call repack_dist)
define write_version_file
$(eval version := $(1))
@echo Writing version file: $(version)
# Variables for CI
rm -f $(DIST_DIR)/version.txt
echo "version=$(version)" > $(DIST_DIR)/version.txt
# Prepare the version.json file
rm -f $(DIST_DIR)/version.json
echo "{" >> $(DIST_DIR)/version.json
echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
# Windows builds
echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
# MacOS builds
echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
# Linux
echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, all kinds of ARM
echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, MIPS
echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD
echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD, all kinds of ARM
echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
# Finish
echo "}" >> $(DIST_DIR)/version.json
endef
define repack_dist
# Repack archive files
# A temporary solution for our auto-update code to be able to unpack these archive files
# The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
# and we can't create it
rm -rf $(DIST_DIR)/AdGuardHome
# Windows builds
$(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
$(call zip_repack_windows,AdGuardHome_windows_386.zip)
# MacOS builds
$(call zip_repack,AdGuardHome_darwin_amd64.zip)
$(call zip_repack,AdGuardHome_darwin_386.zip)
# Linux
$(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
$(call tar_repack,AdGuardHome_linux_386.tar.gz)
# Linux, all kinds of ARM
$(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
$(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
# Linux, MIPS
$(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
# FreeBSD
$(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
# FreeBSD, all kinds of ARM
$(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
endef
define zip_repack_windows
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define zip_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define tar_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
tar xzf $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
tar czf $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
</s> add @ echo "use make build-docker instead"
@ $(MAKE) build-docker
go-install-tools:
@ echo "use make go-tools instead"
@ $(MAKE) go-tools
release:
@ echo "use make build-release instead"
@ $(MAKE) build-release </s> remove npm --prefix client ci
yarn --cwd client2 install
$(GO) mod download
clean:
rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt
rm -f -r ./build/ ./client/node_modules/ ./data/ ./$(DIST_DIR)/
# Set the GOPATH explicitly in case make clean is called from under sudo
# after a Docker build.
env PATH="$(GOPATH)/bin:$$PATH" packr clean
rm -f -r ./bin/
</s> add @ echo "use make deps instead"
@ $(MAKE) deps | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | .github/workflows/build.yml |
keep keep keep keep replace keep keep keep | <mask> - 'name': 'Send Slack notif'
<mask> 'uses': '8398a7/action-slack@v3'
<mask> 'with':
<mask> 'status': '${{ env.WORKFLOW_CONCLUSION }}'
<mask> 'fields': 'repo, message, commit, author, job'
<mask> 'env':
<mask> 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}'
<mask> 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}'
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove 'fields': 'repo, message, commit, author, job'
</s> add 'fields': 'repo, message, commit, author, workflow' </s> remove 'run': 'make ci'
</s> add 'run': 'make VERBOSE=1 ci' </s> remove 'app':
</s> add 'build-release': </s> remove - 'name': 'Set up GoReleaser'
'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh'
- 'name': 'Run snapshot build'
'run': 'make release'
'docker':
'runs-on': 'ubuntu-latest'
'needs': 'test'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
</s> add </s> remove - 'name': 'Docker Buildx (build)'
'run': 'make docker-multi-arch'
</s> add - 'name': 'Run snapshot build'
'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker' </s> remove make go-install-tools go-lint
</s> add make go-deps go-tools go-lint | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | .github/workflows/build.yml |
keep keep keep keep replace keep keep keep keep keep | <mask> 'steps':
<mask> - 'uses': 'actions/checkout@v2'
<mask> - 'name': 'run-lint'
<mask> 'run': >
<mask> make go-install-tools go-lint
<mask> 'eslint':
<mask> 'runs-on': 'ubuntu-latest'
<mask> 'steps':
<mask> - 'uses': 'actions/checkout@v2'
<mask> - 'name': 'Install modules'
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove 'run': 'npm --prefix client ci'
</s> add 'run': 'npm --prefix="./client" ci' </s> remove - 'name': 'Set up GoReleaser'
'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh'
- 'name': 'Run snapshot build'
'run': 'make release'
'docker':
'runs-on': 'ubuntu-latest'
'needs': 'test'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
</s> add </s> remove 'app':
</s> add 'build-release': </s> remove 'run': 'npm --prefix client run lint'
</s> add 'run': 'npm --prefix="./client" run lint' </s> remove - 'name': 'Docker Buildx (build)'
'run': 'make docker-multi-arch'
</s> add - 'name': 'Run snapshot build'
'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker' </s> remove 'run': 'make ci'
</s> add 'run': 'make VERBOSE=1 ci' | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | .github/workflows/lint.yml |
keep keep replace keep replace keep | <mask> - 'uses': 'actions/checkout@v2'
<mask> - 'name': 'Install modules'
<mask> 'run': 'npm --prefix client ci'
<mask> - 'name': 'Run ESLint'
<mask> 'run': 'npm --prefix client run lint'
<mask> 'notify':
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove make go-install-tools go-lint
</s> add make go-deps go-tools go-lint </s> remove 'run': 'make ci'
</s> add 'run': 'make VERBOSE=1 ci' </s> remove - 'name': 'Docker Buildx (build)'
'run': 'make docker-multi-arch'
</s> add - 'name': 'Run snapshot build'
'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker' </s> remove - 'name': 'Set up GoReleaser'
'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh'
- 'name': 'Run snapshot build'
'run': 'make release'
'docker':
'runs-on': 'ubuntu-latest'
'needs': 'test'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
</s> add </s> remove - 'app'
- 'docker'
</s> add - 'build-release' | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | .github/workflows/lint.yml |
keep keep keep keep replace keep keep keep | <mask> - 'name': 'Send Slack notif'
<mask> 'uses': '8398a7/action-slack@v3'
<mask> 'with':
<mask> 'status': '${{ env.WORKFLOW_CONCLUSION }}'
<mask> 'fields': 'repo, message, commit, author, job'
<mask> 'env':
<mask> 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}'
<mask> 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}'
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | .github/workflows/lint.yml |
keep replace keep keep keep keep keep | <mask> #
<mask> # Available targets
<mask> #
<mask> # * build -- builds AdGuardHome for the current platform
<mask> # * client -- builds client-side code of AdGuard Home
<mask> # * client-watch -- builds client-side code of AdGuard Home and watches for changes there
<mask> # * docker -- builds a docker image for the current platform
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove # * build -- builds AdGuardHome for the current platform
# * client -- builds client-side code of AdGuard Home
# * client-watch -- builds client-side code of AdGuard Home and watches for changes there
# * docker -- builds a docker image for the current platform
# * clean -- clean everything created by previous builds
# * lint -- run all linters
# * test -- run all unit-tests
# * dependencies -- installs dependencies (go and npm modules)
# * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
#
# Building releases:
#
# * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
# * release_and_sign -- builds AdGuard Home distros and signs the binary files.
# CHANNEL must be specified (edge, release or beta).
# * sign -- Repacks all release archive files and signs the binary files inside them.
# For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
# gpg --import public.txt
# gpg --import private.txt
# GPG_KEY_PASSPHRASE must contain the GPG key passphrase
# * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
# you must specify:
# * DOCKER_IMAGE_NAME - adguard/adguard-home
# * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
GO := go
GOPATH := $(shell $(GO) env GOPATH)
PWD := $(shell pwd)
TARGET=AdGuardHome
BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
GPG_KEY := [email protected]
GPG_KEY_PASSPHRASE :=
GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
VERBOSE := -v
REBUILD_CLIENT = 1
# See release target
DIST_DIR=dist
# Update channel. Can be release, beta or edge. Uses edge by default.
CHANNEL ?= edge
# Validate channel
ifneq ($(CHANNEL),release)
ifneq ($(CHANNEL),beta)
ifneq ($(CHANNEL),edge)
$(error CHANNEL value is not valid. Valid values are release,beta or edge)
endif
endif
endif
# Version history URL (see
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
ifeq ($(CHANNEL),edge)
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
endif
# goreleaser command depends on the $CHANNEL
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
ifneq ($(CHANNEL),edge)
# If this is not an "edge" build, use normal release command
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
endif
# Version properties
COMMIT=$(shell git rev-parse --short HEAD)
TAG_NAME=$(shell git describe --abbrev=0)
PRERELEASE_VERSION=$(shell git describe --abbrev=0)
# TODO(a.garipov): The cut call is a temporary solution to trim
# prerelease versions. See the comment in .goreleaser.yml.
RELEASE_VERSION=$(shell git describe --abbrev=0 | cut -c 1-8)
SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
# Set proper version
VERSION=
ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
ifeq ($(CHANNEL),edge)
VERSION=$(SNAPSHOT_VERSION)
else ifeq ($(CHANNEL),beta)
VERSION=$(PRERELEASE_VERSION)
else
VERSION=$(RELEASE_VERSION)
endif
else
VERSION=$(SNAPSHOT_VERSION)
endif
# Docker target parameters
DOCKER_IMAGE_NAME ?= adguardhome-dev
DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
# Docker tags (can be redefined)
DOCKER_TAGS ?=
ifndef DOCKER_TAGS
ifeq ($(CHANNEL),release)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
endif
ifeq ($(CHANNEL),beta)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
endif
ifeq ($(CHANNEL),edge)
# Don't set the version tag when pushing to "edge"
DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
# DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
endif
endif
# Validate docker build arguments
ifndef DOCKER_IMAGE_NAME
$(error DOCKER_IMAGE_NAME value is not set)
endif
# OS-specific flags
TEST_FLAGS := --race $(VERBOSE)
ifeq ($(OS),Windows_NT)
TEST_FLAGS :=
endif
.PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
all: build
init:
git config core.hooksPath .githooks
build:
test '$(REBUILD_CLIENT)' = '1' && $(MAKE) client_with_deps || exit 0
$(GO) mod download
PATH=$(GOPATH)/bin:$(PATH) $(GO) generate ./...
CGO_ENABLED=0 $(GO) build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
PATH=$(GOPATH)/bin:$(PATH) packr clean
client:
npm --prefix client run build-prod
yarn --cwd client2 build
client_with_deps:
npm --prefix client ci
npm --prefix client run build-prod
yarn --cwd client2 build
client-watch:
npm --prefix client run watch
yarn --cwd client2 start
docker:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--load \
-t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
@echo Now you can run the docker image:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
</s> add # GOPROXY = https://goproxy.io|https://goproxy.cn|direct
GOPROXY = https://goproxy.cn,https://goproxy.io,direct
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
ENV = env\
COMMIT='$(COMMIT)'\
CHANNEL='$(CHANNEL)'\
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
DIST_DIR='$(DIST_DIR)'\
GO='$(GO)'\
GOPROXY='$(GOPROXY)'\
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
SIGN='$(SIGN)'\
VERBOSE='$(VERBOSE)'\
VERSION='$(VERSION)'\
# Keep the line above blank.
# Keep this target first, so that a naked make invocation triggers
# a full build.
build: deps quick-build
quick-build: js-build go-build
ci: deps test
deps: js-deps go-deps </s> remove DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--output "$(DOCKER_OUTPUT)" \
-t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
@echo If the image was pushed to the registry, you can now run it:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
release: client_with_deps
$(GO) mod download
@echo Starting release build: version $(VERSION), channel $(CHANNEL)
CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
$(call write_version_file,$(VERSION))
PATH=$(GOPATH)/bin:$(PATH) packr clean
release_and_sign: client_with_deps
$(MAKE) release
$(call repack_dist)
sign:
$(call repack_dist)
define write_version_file
$(eval version := $(1))
@echo Writing version file: $(version)
# Variables for CI
rm -f $(DIST_DIR)/version.txt
echo "version=$(version)" > $(DIST_DIR)/version.txt
# Prepare the version.json file
rm -f $(DIST_DIR)/version.json
echo "{" >> $(DIST_DIR)/version.json
echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
# Windows builds
echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
# MacOS builds
echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
# Linux
echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, all kinds of ARM
echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, MIPS
echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD
echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD, all kinds of ARM
echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
# Finish
echo "}" >> $(DIST_DIR)/version.json
endef
define repack_dist
# Repack archive files
# A temporary solution for our auto-update code to be able to unpack these archive files
# The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
# and we can't create it
rm -rf $(DIST_DIR)/AdGuardHome
# Windows builds
$(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
$(call zip_repack_windows,AdGuardHome_windows_386.zip)
# MacOS builds
$(call zip_repack,AdGuardHome_darwin_amd64.zip)
$(call zip_repack,AdGuardHome_darwin_386.zip)
# Linux
$(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
$(call tar_repack,AdGuardHome_linux_386.tar.gz)
# Linux, all kinds of ARM
$(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
$(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
# Linux, MIPS
$(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
# FreeBSD
$(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
# FreeBSD, all kinds of ARM
$(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
endef
define zip_repack_windows
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define zip_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define tar_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
tar xzf $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
tar czf $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
</s> add @ echo "use make build-docker instead"
@ $(MAKE) build-docker
go-install-tools:
@ echo "use make go-tools instead"
@ $(MAKE) go-tools
release:
@ echo "use make build-release instead"
@ $(MAKE) build-release </s> remove .DS_Store
/.git
/.github
/.vscode
.idea
/AdGuardHome
/AdGuardHome.exe
/AdGuardHome.yaml
/AdGuardHome.log
/data
/build
/build2
/dist
/client/node_modules
/client2/node_modules
/.gitattributes
/.gitignore
/.goreleaser.yml
/changelog.config.js
/coverage.txt
/Dockerfile
/LICENSE.txt
/Makefile
/querylog.json
/querylog.json.1
/*.md
# Test output
dnsfilter/tests/top-1m.csv
dnsfilter/tests/dnsfilter.TestLotsOfRules*.pprof
# Snapcraft build temporary files
*.snap
launchpad_credentials
snapcraft_login
snapcraft.yaml.bak
# IntelliJ IDEA project files
*.iml
# Packr
*-packr.go
</s> add # Ignore everything except for explicitly allowed stuff.
*
!dist/docker </s> remove npm --prefix client ci
yarn --cwd client2 install
$(GO) mod download
clean:
rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt
rm -f -r ./build/ ./client/node_modules/ ./data/ ./$(DIST_DIR)/
# Set the GOPATH explicitly in case make clean is called from under sudo
# after a Docker build.
env PATH="$(GOPATH)/bin:$$PATH" packr clean
rm -f -r ./bin/
</s> add @ echo "use make deps instead"
@ $(MAKE) deps </s> add # TODO(a.garipov): Remove the legacy targets once the build
# infrastructure stops using them. </s> remove - 'app'
- 'docker'
</s> add - 'build-release' | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | Makefile |
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 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 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 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 replace replace replace replace replace replace replace replace replace replace replace | <mask> #
<mask> # * build -- builds AdGuardHome for the current platform
<mask> # * client -- builds client-side code of AdGuard Home
<mask> # * client-watch -- builds client-side code of AdGuard Home and watches for changes there
<mask> # * docker -- builds a docker image for the current platform
<mask> # * clean -- clean everything created by previous builds
<mask> # * lint -- run all linters
<mask> # * test -- run all unit-tests
<mask> # * dependencies -- installs dependencies (go and npm modules)
<mask> # * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
<mask> #
<mask> # Building releases:
<mask> #
<mask> # * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
<mask> # * release_and_sign -- builds AdGuard Home distros and signs the binary files.
<mask> # CHANNEL must be specified (edge, release or beta).
<mask> # * sign -- Repacks all release archive files and signs the binary files inside them.
<mask> # For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
<mask> # gpg --import public.txt
<mask> # gpg --import private.txt
<mask> # GPG_KEY_PASSPHRASE must contain the GPG key passphrase
<mask> # * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
<mask> # you must specify:
<mask> # * DOCKER_IMAGE_NAME - adguard/adguard-home
<mask> # * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
<mask>
<mask> GO := go
<mask> GOPATH := $(shell $(GO) env GOPATH)
<mask> PWD := $(shell pwd)
<mask> TARGET=AdGuardHome
<mask> BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
<mask> GPG_KEY := [email protected]
<mask> GPG_KEY_PASSPHRASE :=
<mask> GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
<mask> VERBOSE := -v
<mask> REBUILD_CLIENT = 1
<mask>
<mask> # See release target
<mask> DIST_DIR=dist
<mask>
<mask> # Update channel. Can be release, beta or edge. Uses edge by default.
<mask> CHANNEL ?= edge
<mask>
<mask> # Validate channel
<mask> ifneq ($(CHANNEL),release)
<mask> ifneq ($(CHANNEL),beta)
<mask> ifneq ($(CHANNEL),edge)
<mask> $(error CHANNEL value is not valid. Valid values are release,beta or edge)
<mask> endif
<mask> endif
<mask> endif
<mask>
<mask> # Version history URL (see
<mask> VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
<mask> ifeq ($(CHANNEL),edge)
<mask> VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
<mask> endif
<mask>
<mask> # goreleaser command depends on the $CHANNEL
<mask> GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
<mask> ifneq ($(CHANNEL),edge)
<mask> # If this is not an "edge" build, use normal release command
<mask> GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
<mask> endif
<mask>
<mask> # Version properties
<mask> COMMIT=$(shell git rev-parse --short HEAD)
<mask> TAG_NAME=$(shell git describe --abbrev=0)
<mask> PRERELEASE_VERSION=$(shell git describe --abbrev=0)
<mask> # TODO(a.garipov): The cut call is a temporary solution to trim
<mask> # prerelease versions. See the comment in .goreleaser.yml.
<mask> RELEASE_VERSION=$(shell git describe --abbrev=0 | cut -c 1-8)
<mask> SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
<mask>
<mask> # Set proper version
<mask> VERSION=
<mask> ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
<mask> ifeq ($(CHANNEL),edge)
<mask> VERSION=$(SNAPSHOT_VERSION)
<mask> else ifeq ($(CHANNEL),beta)
<mask> VERSION=$(PRERELEASE_VERSION)
<mask> else
<mask> VERSION=$(RELEASE_VERSION)
<mask> endif
<mask> else
<mask> VERSION=$(SNAPSHOT_VERSION)
<mask> endif
<mask>
<mask> # Docker target parameters
<mask> DOCKER_IMAGE_NAME ?= adguardhome-dev
<mask> DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
<mask> DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
<mask> DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
<mask> BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
<mask>
<mask> # Docker tags (can be redefined)
<mask> DOCKER_TAGS ?=
<mask> ifndef DOCKER_TAGS
<mask> ifeq ($(CHANNEL),release)
<mask> DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
<mask> endif
<mask> ifeq ($(CHANNEL),beta)
<mask> DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
<mask> endif
<mask> ifeq ($(CHANNEL),edge)
<mask> # Don't set the version tag when pushing to "edge"
<mask> DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
<mask> # DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
<mask> endif
<mask> endif
<mask>
<mask> # Validate docker build arguments
<mask> ifndef DOCKER_IMAGE_NAME
<mask> $(error DOCKER_IMAGE_NAME value is not set)
<mask> endif
<mask>
<mask> # OS-specific flags
<mask> TEST_FLAGS := --race $(VERBOSE)
<mask> ifeq ($(OS),Windows_NT)
<mask> TEST_FLAGS :=
<mask> endif
<mask>
<mask> .PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
<mask> all: build
<mask>
<mask> init:
<mask> git config core.hooksPath .githooks
<mask>
<mask> build:
<mask> test '$(REBUILD_CLIENT)' = '1' && $(MAKE) client_with_deps || exit 0
<mask> $(GO) mod download
<mask> PATH=$(GOPATH)/bin:$(PATH) $(GO) generate ./...
<mask> CGO_ENABLED=0 $(GO) build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
<mask> PATH=$(GOPATH)/bin:$(PATH) packr clean
<mask>
<mask> client:
<mask> npm --prefix client run build-prod
<mask> yarn --cwd client2 build
<mask>
<mask> client_with_deps:
<mask> npm --prefix client ci
<mask> npm --prefix client run build-prod
<mask> yarn --cwd client2 build
<mask>
<mask> client-watch:
<mask> npm --prefix client run watch
<mask> yarn --cwd client2 start
<mask>
<mask> docker:
<mask> DOCKER_CLI_EXPERIMENTAL=enabled \
<mask> docker buildx build \
<mask> --build-arg VERSION=$(VERSION) \
<mask> --build-arg CHANNEL=$(CHANNEL) \
<mask> --build-arg VCS_REF=$(COMMIT) \
<mask> --build-arg BUILD_DATE=$(BUILD_DATE) \
<mask> $(DOCKER_TAGS) \
<mask> --load \
<mask> -t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
<mask>
<mask> @echo Now you can run the docker image:
<mask> @echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
<mask>
<mask> lint: js-lint go-lint
<mask>
<mask> js-lint: dependencies
<mask> npm --prefix client run lint
<mask> yarn --cwd client2 lint
<mask>
<mask> go-install-tools:
<mask> env GO=$(GO) sh ./scripts/go-install-tools.sh
<mask>
<mask> go-lint:
<mask> env GO=$(GO) PATH="$$PWD/bin:$$PATH" sh ./scripts/go-lint.sh
<mask>
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove # Available targets
</s> add # See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html.
.POSIX:
CHANNEL = development
CLIENT_BETA_DIR = client2
CLIENT_DIR = client
COMMIT = $$(git rev-parse --short HEAD)
DIST_DIR = dist
GO = go
# TODO(a.garipov): Add more default proxies using pipes after update to
# Go 1.15. </s> remove DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--output "$(DOCKER_OUTPUT)" \
-t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
@echo If the image was pushed to the registry, you can now run it:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
release: client_with_deps
$(GO) mod download
@echo Starting release build: version $(VERSION), channel $(CHANNEL)
CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
$(call write_version_file,$(VERSION))
PATH=$(GOPATH)/bin:$(PATH) packr clean
release_and_sign: client_with_deps
$(MAKE) release
$(call repack_dist)
sign:
$(call repack_dist)
define write_version_file
$(eval version := $(1))
@echo Writing version file: $(version)
# Variables for CI
rm -f $(DIST_DIR)/version.txt
echo "version=$(version)" > $(DIST_DIR)/version.txt
# Prepare the version.json file
rm -f $(DIST_DIR)/version.json
echo "{" >> $(DIST_DIR)/version.json
echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
# Windows builds
echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
# MacOS builds
echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
# Linux
echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, all kinds of ARM
echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, MIPS
echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD
echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD, all kinds of ARM
echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
# Finish
echo "}" >> $(DIST_DIR)/version.json
endef
define repack_dist
# Repack archive files
# A temporary solution for our auto-update code to be able to unpack these archive files
# The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
# and we can't create it
rm -rf $(DIST_DIR)/AdGuardHome
# Windows builds
$(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
$(call zip_repack_windows,AdGuardHome_windows_386.zip)
# MacOS builds
$(call zip_repack,AdGuardHome_darwin_amd64.zip)
$(call zip_repack,AdGuardHome_darwin_386.zip)
# Linux
$(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
$(call tar_repack,AdGuardHome_linux_386.tar.gz)
# Linux, all kinds of ARM
$(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
$(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
# Linux, MIPS
$(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
# FreeBSD
$(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
# FreeBSD, all kinds of ARM
$(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
endef
define zip_repack_windows
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define zip_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define tar_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
tar xzf $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
tar czf $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
</s> add @ echo "use make build-docker instead"
@ $(MAKE) build-docker
go-install-tools:
@ echo "use make go-tools instead"
@ $(MAKE) go-tools
release:
@ echo "use make build-release instead"
@ $(MAKE) build-release </s> remove npm --prefix client ci
yarn --cwd client2 install
$(GO) mod download
clean:
rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt
rm -f -r ./build/ ./client/node_modules/ ./data/ ./$(DIST_DIR)/
# Set the GOPATH explicitly in case make clean is called from under sudo
# after a Docker build.
env PATH="$(GOPATH)/bin:$$PATH" packr clean
rm -f -r ./bin/
</s> add @ echo "use make deps instead"
@ $(MAKE) deps </s> remove - 'app'
- 'docker'
</s> add - 'build-release' </s> remove .DS_Store
/.git
/.github
/.vscode
.idea
/AdGuardHome
/AdGuardHome.exe
/AdGuardHome.yaml
/AdGuardHome.log
/data
/build
/build2
/dist
/client/node_modules
/client2/node_modules
/.gitattributes
/.gitignore
/.goreleaser.yml
/changelog.config.js
/coverage.txt
/Dockerfile
/LICENSE.txt
/Makefile
/querylog.json
/querylog.json.1
/*.md
# Test output
dnsfilter/tests/top-1m.csv
dnsfilter/tests/dnsfilter.TestLotsOfRules*.pprof
# Snapcraft build temporary files
*.snap
launchpad_credentials
snapcraft_login
snapcraft.yaml.bak
# IntelliJ IDEA project files
*.iml
# Packr
*-packr.go
</s> add # Ignore everything except for explicitly allowed stuff.
*
!dist/docker | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | Makefile |
keep keep keep keep replace replace replace replace keep keep keep keep keep keep keep keep replace replace replace keep keep | <mask>
<mask> test: js-test go-test
<mask>
<mask> js-test:
<mask> npm run test --prefix client
<mask>
<mask> go-test:
<mask> $(GO) test $(TEST_FLAGS) --coverprofile coverage.txt ./...
<mask>
<mask> ci: client_with_deps
<mask> $(GO) mod download
<mask> $(MAKE) test
<mask>
<mask> go-test:
<mask> $(GO) test $(TEST_FLAGS) --coverprofile coverage.txt ./...
<mask>
<mask> ci: client_with_deps
<mask> $(GO) mod download
<mask> $(MAKE) test
<mask>
<mask> dependencies:
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove npm --prefix client ci
yarn --cwd client2 install
$(GO) mod download
clean:
rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt
rm -f -r ./build/ ./client/node_modules/ ./data/ ./$(DIST_DIR)/
# Set the GOPATH explicitly in case make clean is called from under sudo
# after a Docker build.
env PATH="$(GOPATH)/bin:$$PATH" packr clean
rm -f -r ./bin/
</s> add @ echo "use make deps instead"
@ $(MAKE) deps </s> remove
js-lint: dependencies
npm --prefix client run lint
yarn --cwd client2 lint
go-install-tools:
env GO=$(GO) sh ./scripts/go-install-tools.sh
go-lint:
env GO=$(GO) PATH="$$PWD/bin:$$PATH" sh ./scripts/go-lint.sh
</s> add </s> remove # * build -- builds AdGuardHome for the current platform
# * client -- builds client-side code of AdGuard Home
# * client-watch -- builds client-side code of AdGuard Home and watches for changes there
# * docker -- builds a docker image for the current platform
# * clean -- clean everything created by previous builds
# * lint -- run all linters
# * test -- run all unit-tests
# * dependencies -- installs dependencies (go and npm modules)
# * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
#
# Building releases:
#
# * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
# * release_and_sign -- builds AdGuard Home distros and signs the binary files.
# CHANNEL must be specified (edge, release or beta).
# * sign -- Repacks all release archive files and signs the binary files inside them.
# For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
# gpg --import public.txt
# gpg --import private.txt
# GPG_KEY_PASSPHRASE must contain the GPG key passphrase
# * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
# you must specify:
# * DOCKER_IMAGE_NAME - adguard/adguard-home
# * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
GO := go
GOPATH := $(shell $(GO) env GOPATH)
PWD := $(shell pwd)
TARGET=AdGuardHome
BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
GPG_KEY := [email protected]
GPG_KEY_PASSPHRASE :=
GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
VERBOSE := -v
REBUILD_CLIENT = 1
# See release target
DIST_DIR=dist
# Update channel. Can be release, beta or edge. Uses edge by default.
CHANNEL ?= edge
# Validate channel
ifneq ($(CHANNEL),release)
ifneq ($(CHANNEL),beta)
ifneq ($(CHANNEL),edge)
$(error CHANNEL value is not valid. Valid values are release,beta or edge)
endif
endif
endif
# Version history URL (see
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
ifeq ($(CHANNEL),edge)
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
endif
# goreleaser command depends on the $CHANNEL
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
ifneq ($(CHANNEL),edge)
# If this is not an "edge" build, use normal release command
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
endif
# Version properties
COMMIT=$(shell git rev-parse --short HEAD)
TAG_NAME=$(shell git describe --abbrev=0)
PRERELEASE_VERSION=$(shell git describe --abbrev=0)
# TODO(a.garipov): The cut call is a temporary solution to trim
# prerelease versions. See the comment in .goreleaser.yml.
RELEASE_VERSION=$(shell git describe --abbrev=0 | cut -c 1-8)
SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
# Set proper version
VERSION=
ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
ifeq ($(CHANNEL),edge)
VERSION=$(SNAPSHOT_VERSION)
else ifeq ($(CHANNEL),beta)
VERSION=$(PRERELEASE_VERSION)
else
VERSION=$(RELEASE_VERSION)
endif
else
VERSION=$(SNAPSHOT_VERSION)
endif
# Docker target parameters
DOCKER_IMAGE_NAME ?= adguardhome-dev
DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
# Docker tags (can be redefined)
DOCKER_TAGS ?=
ifndef DOCKER_TAGS
ifeq ($(CHANNEL),release)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
endif
ifeq ($(CHANNEL),beta)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
endif
ifeq ($(CHANNEL),edge)
# Don't set the version tag when pushing to "edge"
DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
# DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
endif
endif
# Validate docker build arguments
ifndef DOCKER_IMAGE_NAME
$(error DOCKER_IMAGE_NAME value is not set)
endif
# OS-specific flags
TEST_FLAGS := --race $(VERBOSE)
ifeq ($(OS),Windows_NT)
TEST_FLAGS :=
endif
.PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
all: build
init:
git config core.hooksPath .githooks
build:
test '$(REBUILD_CLIENT)' = '1' && $(MAKE) client_with_deps || exit 0
$(GO) mod download
PATH=$(GOPATH)/bin:$(PATH) $(GO) generate ./...
CGO_ENABLED=0 $(GO) build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
PATH=$(GOPATH)/bin:$(PATH) packr clean
client:
npm --prefix client run build-prod
yarn --cwd client2 build
client_with_deps:
npm --prefix client ci
npm --prefix client run build-prod
yarn --cwd client2 build
client-watch:
npm --prefix client run watch
yarn --cwd client2 start
docker:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--load \
-t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
@echo Now you can run the docker image:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
</s> add # GOPROXY = https://goproxy.io|https://goproxy.cn|direct
GOPROXY = https://goproxy.cn,https://goproxy.io,direct
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
ENV = env\
COMMIT='$(COMMIT)'\
CHANNEL='$(CHANNEL)'\
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
DIST_DIR='$(DIST_DIR)'\
GO='$(GO)'\
GOPROXY='$(GOPROXY)'\
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
SIGN='$(SIGN)'\
VERBOSE='$(VERBOSE)'\
VERSION='$(VERSION)'\
# Keep the line above blank.
# Keep this target first, so that a naked make invocation triggers
# a full build.
build: deps quick-build
quick-build: js-build go-build
ci: deps test
deps: js-deps go-deps </s> remove DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--output "$(DOCKER_OUTPUT)" \
-t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
@echo If the image was pushed to the registry, you can now run it:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
release: client_with_deps
$(GO) mod download
@echo Starting release build: version $(VERSION), channel $(CHANNEL)
CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
$(call write_version_file,$(VERSION))
PATH=$(GOPATH)/bin:$(PATH) packr clean
release_and_sign: client_with_deps
$(MAKE) release
$(call repack_dist)
sign:
$(call repack_dist)
define write_version_file
$(eval version := $(1))
@echo Writing version file: $(version)
# Variables for CI
rm -f $(DIST_DIR)/version.txt
echo "version=$(version)" > $(DIST_DIR)/version.txt
# Prepare the version.json file
rm -f $(DIST_DIR)/version.json
echo "{" >> $(DIST_DIR)/version.json
echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
# Windows builds
echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
# MacOS builds
echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
# Linux
echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, all kinds of ARM
echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, MIPS
echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD
echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD, all kinds of ARM
echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
# Finish
echo "}" >> $(DIST_DIR)/version.json
endef
define repack_dist
# Repack archive files
# A temporary solution for our auto-update code to be able to unpack these archive files
# The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
# and we can't create it
rm -rf $(DIST_DIR)/AdGuardHome
# Windows builds
$(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
$(call zip_repack_windows,AdGuardHome_windows_386.zip)
# MacOS builds
$(call zip_repack,AdGuardHome_darwin_amd64.zip)
$(call zip_repack,AdGuardHome_darwin_386.zip)
# Linux
$(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
$(call tar_repack,AdGuardHome_linux_386.tar.gz)
# Linux, all kinds of ARM
$(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
$(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
# Linux, MIPS
$(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
# FreeBSD
$(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
# FreeBSD, all kinds of ARM
$(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
endef
define zip_repack_windows
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define zip_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define tar_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
tar xzf $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
tar czf $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
</s> add @ echo "use make build-docker instead"
@ $(MAKE) build-docker
go-install-tools:
@ echo "use make go-tools instead"
@ $(MAKE) go-tools
release:
@ echo "use make build-release instead"
@ $(MAKE) build-release </s> add # TODO(a.garipov): Remove the legacy targets once the build
# infrastructure stops using them. | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | Makefile |
keep add keep keep keep keep keep | <mask> go-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-tools.sh
<mask>
<mask> dependencies:
<mask> @ echo "use make deps instead"
<mask> @ $(MAKE) deps
<mask> docker-multi-arch:
<mask> @ echo "use make build-docker instead"
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove npm --prefix client ci
yarn --cwd client2 install
$(GO) mod download
clean:
rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt
rm -f -r ./build/ ./client/node_modules/ ./data/ ./$(DIST_DIR)/
# Set the GOPATH explicitly in case make clean is called from under sudo
# after a Docker build.
env PATH="$(GOPATH)/bin:$$PATH" packr clean
rm -f -r ./bin/
</s> add @ echo "use make deps instead"
@ $(MAKE) deps </s> remove DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--output "$(DOCKER_OUTPUT)" \
-t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
@echo If the image was pushed to the registry, you can now run it:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
release: client_with_deps
$(GO) mod download
@echo Starting release build: version $(VERSION), channel $(CHANNEL)
CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
$(call write_version_file,$(VERSION))
PATH=$(GOPATH)/bin:$(PATH) packr clean
release_and_sign: client_with_deps
$(MAKE) release
$(call repack_dist)
sign:
$(call repack_dist)
define write_version_file
$(eval version := $(1))
@echo Writing version file: $(version)
# Variables for CI
rm -f $(DIST_DIR)/version.txt
echo "version=$(version)" > $(DIST_DIR)/version.txt
# Prepare the version.json file
rm -f $(DIST_DIR)/version.json
echo "{" >> $(DIST_DIR)/version.json
echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
# Windows builds
echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
# MacOS builds
echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
# Linux
echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, all kinds of ARM
echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, MIPS
echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD
echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD, all kinds of ARM
echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
# Finish
echo "}" >> $(DIST_DIR)/version.json
endef
define repack_dist
# Repack archive files
# A temporary solution for our auto-update code to be able to unpack these archive files
# The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
# and we can't create it
rm -rf $(DIST_DIR)/AdGuardHome
# Windows builds
$(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
$(call zip_repack_windows,AdGuardHome_windows_386.zip)
# MacOS builds
$(call zip_repack,AdGuardHome_darwin_amd64.zip)
$(call zip_repack,AdGuardHome_darwin_386.zip)
# Linux
$(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
$(call tar_repack,AdGuardHome_linux_386.tar.gz)
# Linux, all kinds of ARM
$(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
$(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
# Linux, MIPS
$(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
# FreeBSD
$(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
# FreeBSD, all kinds of ARM
$(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
endef
define zip_repack_windows
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define zip_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define tar_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
tar xzf $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
tar czf $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
</s> add @ echo "use make build-docker instead"
@ $(MAKE) build-docker
go-install-tools:
@ echo "use make go-tools instead"
@ $(MAKE) go-tools
release:
@ echo "use make build-release instead"
@ $(MAKE) build-release </s> remove ci: client_with_deps
$(GO) mod download
$(MAKE) test
</s> add go-build: ; $(ENV) "$(SHELL)" ./scripts/make/go-build.sh
go-deps: ; $(ENV) "$(SHELL)" ./scripts/make/go-deps.sh
go-lint: ; $(ENV) "$(SHELL)" ./scripts/make/go-lint.sh
go-test: ; $(ENV) "$(SHELL)" ./scripts/make/go-test.sh
go-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-tools.sh </s> remove make go-install-tools go-lint
</s> add make go-deps go-tools go-lint </s> remove 'run': 'make ci'
</s> add 'run': 'make VERBOSE=1 ci' </s> remove # * build -- builds AdGuardHome for the current platform
# * client -- builds client-side code of AdGuard Home
# * client-watch -- builds client-side code of AdGuard Home and watches for changes there
# * docker -- builds a docker image for the current platform
# * clean -- clean everything created by previous builds
# * lint -- run all linters
# * test -- run all unit-tests
# * dependencies -- installs dependencies (go and npm modules)
# * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
#
# Building releases:
#
# * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
# * release_and_sign -- builds AdGuard Home distros and signs the binary files.
# CHANNEL must be specified (edge, release or beta).
# * sign -- Repacks all release archive files and signs the binary files inside them.
# For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
# gpg --import public.txt
# gpg --import private.txt
# GPG_KEY_PASSPHRASE must contain the GPG key passphrase
# * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
# you must specify:
# * DOCKER_IMAGE_NAME - adguard/adguard-home
# * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
GO := go
GOPATH := $(shell $(GO) env GOPATH)
PWD := $(shell pwd)
TARGET=AdGuardHome
BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
GPG_KEY := [email protected]
GPG_KEY_PASSPHRASE :=
GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
VERBOSE := -v
REBUILD_CLIENT = 1
# See release target
DIST_DIR=dist
# Update channel. Can be release, beta or edge. Uses edge by default.
CHANNEL ?= edge
# Validate channel
ifneq ($(CHANNEL),release)
ifneq ($(CHANNEL),beta)
ifneq ($(CHANNEL),edge)
$(error CHANNEL value is not valid. Valid values are release,beta or edge)
endif
endif
endif
# Version history URL (see
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
ifeq ($(CHANNEL),edge)
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
endif
# goreleaser command depends on the $CHANNEL
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
ifneq ($(CHANNEL),edge)
# If this is not an "edge" build, use normal release command
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
endif
# Version properties
COMMIT=$(shell git rev-parse --short HEAD)
TAG_NAME=$(shell git describe --abbrev=0)
PRERELEASE_VERSION=$(shell git describe --abbrev=0)
# TODO(a.garipov): The cut call is a temporary solution to trim
# prerelease versions. See the comment in .goreleaser.yml.
RELEASE_VERSION=$(shell git describe --abbrev=0 | cut -c 1-8)
SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
# Set proper version
VERSION=
ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
ifeq ($(CHANNEL),edge)
VERSION=$(SNAPSHOT_VERSION)
else ifeq ($(CHANNEL),beta)
VERSION=$(PRERELEASE_VERSION)
else
VERSION=$(RELEASE_VERSION)
endif
else
VERSION=$(SNAPSHOT_VERSION)
endif
# Docker target parameters
DOCKER_IMAGE_NAME ?= adguardhome-dev
DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
# Docker tags (can be redefined)
DOCKER_TAGS ?=
ifndef DOCKER_TAGS
ifeq ($(CHANNEL),release)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
endif
ifeq ($(CHANNEL),beta)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
endif
ifeq ($(CHANNEL),edge)
# Don't set the version tag when pushing to "edge"
DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
# DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
endif
endif
# Validate docker build arguments
ifndef DOCKER_IMAGE_NAME
$(error DOCKER_IMAGE_NAME value is not set)
endif
# OS-specific flags
TEST_FLAGS := --race $(VERBOSE)
ifeq ($(OS),Windows_NT)
TEST_FLAGS :=
endif
.PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
all: build
init:
git config core.hooksPath .githooks
build:
test '$(REBUILD_CLIENT)' = '1' && $(MAKE) client_with_deps || exit 0
$(GO) mod download
PATH=$(GOPATH)/bin:$(PATH) $(GO) generate ./...
CGO_ENABLED=0 $(GO) build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
PATH=$(GOPATH)/bin:$(PATH) packr clean
client:
npm --prefix client run build-prod
yarn --cwd client2 build
client_with_deps:
npm --prefix client ci
npm --prefix client run build-prod
yarn --cwd client2 build
client-watch:
npm --prefix client run watch
yarn --cwd client2 start
docker:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--load \
-t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
@echo Now you can run the docker image:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
</s> add # GOPROXY = https://goproxy.io|https://goproxy.cn|direct
GOPROXY = https://goproxy.cn,https://goproxy.io,direct
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
ENV = env\
COMMIT='$(COMMIT)'\
CHANNEL='$(CHANNEL)'\
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
DIST_DIR='$(DIST_DIR)'\
GO='$(GO)'\
GOPROXY='$(GOPROXY)'\
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
SIGN='$(SIGN)'\
VERBOSE='$(VERBOSE)'\
VERSION='$(VERSION)'\
# Keep the line above blank.
# Keep this target first, so that a naked make invocation triggers
# a full build.
build: deps quick-build
quick-build: js-build go-build
ci: deps test
deps: js-deps go-deps | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | Makefile |
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace 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 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 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 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 | <mask> $(GO) mod download
<mask> $(MAKE) test
<mask>
<mask> dependencies:
<mask> npm --prefix client ci
<mask> yarn --cwd client2 install
<mask> $(GO) mod download
<mask>
<mask> clean:
<mask> rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt
<mask> rm -f -r ./build/ ./client/node_modules/ ./data/ ./$(DIST_DIR)/
<mask> # Set the GOPATH explicitly in case make clean is called from under sudo
<mask> # after a Docker build.
<mask> env PATH="$(GOPATH)/bin:$$PATH" packr clean
<mask> rm -f -r ./bin/
<mask>
<mask> docker-multi-arch:
<mask> DOCKER_CLI_EXPERIMENTAL=enabled \
<mask> docker buildx build \
<mask> --platform $(DOCKER_PLATFORMS) \
<mask> --build-arg VERSION=$(VERSION) \
<mask> --build-arg CHANNEL=$(CHANNEL) \
<mask> --build-arg VCS_REF=$(COMMIT) \
<mask> --build-arg BUILD_DATE=$(BUILD_DATE) \
<mask> $(DOCKER_TAGS) \
<mask> --output "$(DOCKER_OUTPUT)" \
<mask> -t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
<mask>
<mask> @echo If the image was pushed to the registry, you can now run it:
<mask> @echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
<mask>
<mask> release: client_with_deps
<mask> $(GO) mod download
<mask> @echo Starting release build: version $(VERSION), channel $(CHANNEL)
<mask> CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
<mask> $(call write_version_file,$(VERSION))
<mask> PATH=$(GOPATH)/bin:$(PATH) packr clean
<mask>
<mask> release_and_sign: client_with_deps
<mask> $(MAKE) release
<mask> $(call repack_dist)
<mask>
<mask> sign:
<mask> $(call repack_dist)
<mask>
<mask> define write_version_file
<mask> $(eval version := $(1))
<mask>
<mask> @echo Writing version file: $(version)
<mask>
<mask> # Variables for CI
<mask> rm -f $(DIST_DIR)/version.txt
<mask> echo "version=$(version)" > $(DIST_DIR)/version.txt
<mask>
<mask> # Prepare the version.json file
<mask> rm -f $(DIST_DIR)/version.json
<mask> echo "{" >> $(DIST_DIR)/version.json
<mask> echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
<mask> echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
<mask> echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
<mask> echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
<mask>
<mask> # Windows builds
<mask> echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
<mask>
<mask> # MacOS builds
<mask> echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
<mask>
<mask> # Linux
<mask> echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
<mask>
<mask> # Linux, all kinds of ARM
<mask> echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
<mask>
<mask> # Linux, MIPS
<mask> echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
<mask>
<mask> # FreeBSD
<mask> echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
<mask>
<mask> # FreeBSD, all kinds of ARM
<mask> echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
<mask> echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
<mask>
<mask> # Finish
<mask> echo "}" >> $(DIST_DIR)/version.json
<mask> endef
<mask>
<mask> define repack_dist
<mask> # Repack archive files
<mask> # A temporary solution for our auto-update code to be able to unpack these archive files
<mask> # The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
<mask> # and we can't create it
<mask> rm -rf $(DIST_DIR)/AdGuardHome
<mask>
<mask> # Windows builds
<mask> $(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
<mask> $(call zip_repack_windows,AdGuardHome_windows_386.zip)
<mask>
<mask> # MacOS builds
<mask> $(call zip_repack,AdGuardHome_darwin_amd64.zip)
<mask> $(call zip_repack,AdGuardHome_darwin_386.zip)
<mask>
<mask> # Linux
<mask> $(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
<mask> $(call tar_repack,AdGuardHome_linux_386.tar.gz)
<mask>
<mask> # Linux, all kinds of ARM
<mask> $(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
<mask> $(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
<mask> $(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
<mask> $(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
<mask>
<mask> # Linux, MIPS
<mask> $(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
<mask> $(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
<mask> $(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
<mask> $(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
<mask>
<mask> # FreeBSD
<mask> $(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
<mask> $(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
<mask>
<mask> # FreeBSD, all kinds of ARM
<mask> $(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
<mask> $(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
<mask> $(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
<mask> $(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
<mask> endef
<mask>
<mask> define zip_repack_windows
<mask> $(eval ARC := $(1))
<mask> cd $(DIST_DIR) && \
<mask> unzip $(ARC) && \
<mask> $(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
<mask> zip -r $(ARC) AdGuardHome/ && \
<mask> rm -rf AdGuardHome
<mask> endef
<mask>
<mask> define zip_repack
<mask> $(eval ARC := $(1))
<mask> cd $(DIST_DIR) && \
<mask> unzip $(ARC) && \
<mask> $(GPG_CMD) AdGuardHome/AdGuardHome && \
<mask> zip -r $(ARC) AdGuardHome/ && \
<mask> rm -rf AdGuardHome
<mask> endef
<mask>
<mask> define tar_repack
<mask> $(eval ARC := $(1))
<mask> cd $(DIST_DIR) && \
<mask> tar xzf $(ARC) && \
<mask> $(GPG_CMD) AdGuardHome/AdGuardHome && \
<mask> tar czf $(ARC) AdGuardHome/ && \
<mask> rm -rf AdGuardHome
<mask> endef
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove # * build -- builds AdGuardHome for the current platform
# * client -- builds client-side code of AdGuard Home
# * client-watch -- builds client-side code of AdGuard Home and watches for changes there
# * docker -- builds a docker image for the current platform
# * clean -- clean everything created by previous builds
# * lint -- run all linters
# * test -- run all unit-tests
# * dependencies -- installs dependencies (go and npm modules)
# * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
#
# Building releases:
#
# * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
# * release_and_sign -- builds AdGuard Home distros and signs the binary files.
# CHANNEL must be specified (edge, release or beta).
# * sign -- Repacks all release archive files and signs the binary files inside them.
# For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
# gpg --import public.txt
# gpg --import private.txt
# GPG_KEY_PASSPHRASE must contain the GPG key passphrase
# * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
# you must specify:
# * DOCKER_IMAGE_NAME - adguard/adguard-home
# * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
GO := go
GOPATH := $(shell $(GO) env GOPATH)
PWD := $(shell pwd)
TARGET=AdGuardHome
BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
GPG_KEY := [email protected]
GPG_KEY_PASSPHRASE :=
GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
VERBOSE := -v
REBUILD_CLIENT = 1
# See release target
DIST_DIR=dist
# Update channel. Can be release, beta or edge. Uses edge by default.
CHANNEL ?= edge
# Validate channel
ifneq ($(CHANNEL),release)
ifneq ($(CHANNEL),beta)
ifneq ($(CHANNEL),edge)
$(error CHANNEL value is not valid. Valid values are release,beta or edge)
endif
endif
endif
# Version history URL (see
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
ifeq ($(CHANNEL),edge)
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
endif
# goreleaser command depends on the $CHANNEL
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
ifneq ($(CHANNEL),edge)
# If this is not an "edge" build, use normal release command
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
endif
# Version properties
COMMIT=$(shell git rev-parse --short HEAD)
TAG_NAME=$(shell git describe --abbrev=0)
PRERELEASE_VERSION=$(shell git describe --abbrev=0)
# TODO(a.garipov): The cut call is a temporary solution to trim
# prerelease versions. See the comment in .goreleaser.yml.
RELEASE_VERSION=$(shell git describe --abbrev=0 | cut -c 1-8)
SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
# Set proper version
VERSION=
ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
ifeq ($(CHANNEL),edge)
VERSION=$(SNAPSHOT_VERSION)
else ifeq ($(CHANNEL),beta)
VERSION=$(PRERELEASE_VERSION)
else
VERSION=$(RELEASE_VERSION)
endif
else
VERSION=$(SNAPSHOT_VERSION)
endif
# Docker target parameters
DOCKER_IMAGE_NAME ?= adguardhome-dev
DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
# Docker tags (can be redefined)
DOCKER_TAGS ?=
ifndef DOCKER_TAGS
ifeq ($(CHANNEL),release)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
endif
ifeq ($(CHANNEL),beta)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
endif
ifeq ($(CHANNEL),edge)
# Don't set the version tag when pushing to "edge"
DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
# DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
endif
endif
# Validate docker build arguments
ifndef DOCKER_IMAGE_NAME
$(error DOCKER_IMAGE_NAME value is not set)
endif
# OS-specific flags
TEST_FLAGS := --race $(VERBOSE)
ifeq ($(OS),Windows_NT)
TEST_FLAGS :=
endif
.PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
all: build
init:
git config core.hooksPath .githooks
build:
test '$(REBUILD_CLIENT)' = '1' && $(MAKE) client_with_deps || exit 0
$(GO) mod download
PATH=$(GOPATH)/bin:$(PATH) $(GO) generate ./...
CGO_ENABLED=0 $(GO) build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
PATH=$(GOPATH)/bin:$(PATH) packr clean
client:
npm --prefix client run build-prod
yarn --cwd client2 build
client_with_deps:
npm --prefix client ci
npm --prefix client run build-prod
yarn --cwd client2 build
client-watch:
npm --prefix client run watch
yarn --cwd client2 start
docker:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--load \
-t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
@echo Now you can run the docker image:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
</s> add # GOPROXY = https://goproxy.io|https://goproxy.cn|direct
GOPROXY = https://goproxy.cn,https://goproxy.io,direct
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
ENV = env\
COMMIT='$(COMMIT)'\
CHANNEL='$(CHANNEL)'\
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
DIST_DIR='$(DIST_DIR)'\
GO='$(GO)'\
GOPROXY='$(GOPROXY)'\
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
SIGN='$(SIGN)'\
VERBOSE='$(VERBOSE)'\
VERSION='$(VERSION)'\
# Keep the line above blank.
# Keep this target first, so that a naked make invocation triggers
# a full build.
build: deps quick-build
quick-build: js-build go-build
ci: deps test
deps: js-deps go-deps </s> add # TODO(a.garipov): Remove the legacy targets once the build
# infrastructure stops using them. </s> remove # Available targets
</s> add # See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html.
.POSIX:
CHANNEL = development
CLIENT_BETA_DIR = client2
CLIENT_DIR = client
COMMIT = $$(git rev-parse --short HEAD)
DIST_DIR = dist
GO = go
# TODO(a.garipov): Add more default proxies using pipes after update to
# Go 1.15. </s> remove
js-lint: dependencies
npm --prefix client run lint
yarn --cwd client2 lint
go-install-tools:
env GO=$(GO) sh ./scripts/go-install-tools.sh
go-lint:
env GO=$(GO) PATH="$$PWD/bin:$$PATH" sh ./scripts/go-lint.sh
</s> add </s> remove - 'app'
- 'docker'
</s> add - 'build-release' | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | Makefile |
replace keep keep keep keep keep | <mask> //go:generate go install -v github.com/gobuffalo/packr/packr
<mask> //go:generate packr clean
<mask> //go:generate packr -z
<mask> package main
<mask>
<mask> import (
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove npm --prefix client ci
yarn --cwd client2 install
$(GO) mod download
clean:
rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt
rm -f -r ./build/ ./client/node_modules/ ./data/ ./$(DIST_DIR)/
# Set the GOPATH explicitly in case make clean is called from under sudo
# after a Docker build.
env PATH="$(GOPATH)/bin:$$PATH" packr clean
rm -f -r ./bin/
</s> add @ echo "use make deps instead"
@ $(MAKE) deps </s> remove # * build -- builds AdGuardHome for the current platform
# * client -- builds client-side code of AdGuard Home
# * client-watch -- builds client-side code of AdGuard Home and watches for changes there
# * docker -- builds a docker image for the current platform
# * clean -- clean everything created by previous builds
# * lint -- run all linters
# * test -- run all unit-tests
# * dependencies -- installs dependencies (go and npm modules)
# * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
#
# Building releases:
#
# * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
# * release_and_sign -- builds AdGuard Home distros and signs the binary files.
# CHANNEL must be specified (edge, release or beta).
# * sign -- Repacks all release archive files and signs the binary files inside them.
# For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
# gpg --import public.txt
# gpg --import private.txt
# GPG_KEY_PASSPHRASE must contain the GPG key passphrase
# * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
# you must specify:
# * DOCKER_IMAGE_NAME - adguard/adguard-home
# * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
GO := go
GOPATH := $(shell $(GO) env GOPATH)
PWD := $(shell pwd)
TARGET=AdGuardHome
BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
GPG_KEY := [email protected]
GPG_KEY_PASSPHRASE :=
GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
VERBOSE := -v
REBUILD_CLIENT = 1
# See release target
DIST_DIR=dist
# Update channel. Can be release, beta or edge. Uses edge by default.
CHANNEL ?= edge
# Validate channel
ifneq ($(CHANNEL),release)
ifneq ($(CHANNEL),beta)
ifneq ($(CHANNEL),edge)
$(error CHANNEL value is not valid. Valid values are release,beta or edge)
endif
endif
endif
# Version history URL (see
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
ifeq ($(CHANNEL),edge)
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
endif
# goreleaser command depends on the $CHANNEL
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
ifneq ($(CHANNEL),edge)
# If this is not an "edge" build, use normal release command
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
endif
# Version properties
COMMIT=$(shell git rev-parse --short HEAD)
TAG_NAME=$(shell git describe --abbrev=0)
PRERELEASE_VERSION=$(shell git describe --abbrev=0)
# TODO(a.garipov): The cut call is a temporary solution to trim
# prerelease versions. See the comment in .goreleaser.yml.
RELEASE_VERSION=$(shell git describe --abbrev=0 | cut -c 1-8)
SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
# Set proper version
VERSION=
ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
ifeq ($(CHANNEL),edge)
VERSION=$(SNAPSHOT_VERSION)
else ifeq ($(CHANNEL),beta)
VERSION=$(PRERELEASE_VERSION)
else
VERSION=$(RELEASE_VERSION)
endif
else
VERSION=$(SNAPSHOT_VERSION)
endif
# Docker target parameters
DOCKER_IMAGE_NAME ?= adguardhome-dev
DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
# Docker tags (can be redefined)
DOCKER_TAGS ?=
ifndef DOCKER_TAGS
ifeq ($(CHANNEL),release)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
endif
ifeq ($(CHANNEL),beta)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
endif
ifeq ($(CHANNEL),edge)
# Don't set the version tag when pushing to "edge"
DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
# DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
endif
endif
# Validate docker build arguments
ifndef DOCKER_IMAGE_NAME
$(error DOCKER_IMAGE_NAME value is not set)
endif
# OS-specific flags
TEST_FLAGS := --race $(VERBOSE)
ifeq ($(OS),Windows_NT)
TEST_FLAGS :=
endif
.PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
all: build
init:
git config core.hooksPath .githooks
build:
test '$(REBUILD_CLIENT)' = '1' && $(MAKE) client_with_deps || exit 0
$(GO) mod download
PATH=$(GOPATH)/bin:$(PATH) $(GO) generate ./...
CGO_ENABLED=0 $(GO) build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
PATH=$(GOPATH)/bin:$(PATH) packr clean
client:
npm --prefix client run build-prod
yarn --cwd client2 build
client_with_deps:
npm --prefix client ci
npm --prefix client run build-prod
yarn --cwd client2 build
client-watch:
npm --prefix client run watch
yarn --cwd client2 start
docker:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--load \
-t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
@echo Now you can run the docker image:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
</s> add # GOPROXY = https://goproxy.io|https://goproxy.cn|direct
GOPROXY = https://goproxy.cn,https://goproxy.io,direct
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
ENV = env\
COMMIT='$(COMMIT)'\
CHANNEL='$(CHANNEL)'\
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
DIST_DIR='$(DIST_DIR)'\
GO='$(GO)'\
GOPROXY='$(GOPROXY)'\
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
SIGN='$(SIGN)'\
VERBOSE='$(VERBOSE)'\
VERSION='$(VERSION)'\
# Keep the line above blank.
# Keep this target first, so that a naked make invocation triggers
# a full build.
build: deps quick-build
quick-build: js-build go-build
ci: deps test
deps: js-deps go-deps </s> remove DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--output "$(DOCKER_OUTPUT)" \
-t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
@echo If the image was pushed to the registry, you can now run it:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
release: client_with_deps
$(GO) mod download
@echo Starting release build: version $(VERSION), channel $(CHANNEL)
CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
$(call write_version_file,$(VERSION))
PATH=$(GOPATH)/bin:$(PATH) packr clean
release_and_sign: client_with_deps
$(MAKE) release
$(call repack_dist)
sign:
$(call repack_dist)
define write_version_file
$(eval version := $(1))
@echo Writing version file: $(version)
# Variables for CI
rm -f $(DIST_DIR)/version.txt
echo "version=$(version)" > $(DIST_DIR)/version.txt
# Prepare the version.json file
rm -f $(DIST_DIR)/version.json
echo "{" >> $(DIST_DIR)/version.json
echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
# Windows builds
echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
# MacOS builds
echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
# Linux
echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, all kinds of ARM
echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, MIPS
echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD
echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD, all kinds of ARM
echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
# Finish
echo "}" >> $(DIST_DIR)/version.json
endef
define repack_dist
# Repack archive files
# A temporary solution for our auto-update code to be able to unpack these archive files
# The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
# and we can't create it
rm -rf $(DIST_DIR)/AdGuardHome
# Windows builds
$(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
$(call zip_repack_windows,AdGuardHome_windows_386.zip)
# MacOS builds
$(call zip_repack,AdGuardHome_darwin_amd64.zip)
$(call zip_repack,AdGuardHome_darwin_386.zip)
# Linux
$(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
$(call tar_repack,AdGuardHome_linux_386.tar.gz)
# Linux, all kinds of ARM
$(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
$(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
# Linux, MIPS
$(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
# FreeBSD
$(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
# FreeBSD, all kinds of ARM
$(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
endef
define zip_repack_windows
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define zip_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define tar_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
tar xzf $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
tar czf $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
</s> add @ echo "use make build-docker instead"
@ $(MAKE) build-docker
go-install-tools:
@ echo "use make go-tools instead"
@ $(MAKE) go-tools
release:
@ echo "use make build-release instead"
@ $(MAKE) build-release </s> remove # Available targets
</s> add # See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html.
.POSIX:
CHANNEL = development
CLIENT_BETA_DIR = client2
CLIENT_DIR = client
COMMIT = $$(git rev-parse --short HEAD)
DIST_DIR = dist
GO = go
# TODO(a.garipov): Add more default proxies using pipes after update to
# Go 1.15. </s> remove ci: client_with_deps
$(GO) mod download
$(MAKE) test
</s> add go-build: ; $(ENV) "$(SHELL)" ./scripts/make/go-build.sh
go-deps: ; $(ENV) "$(SHELL)" ./scripts/make/go-deps.sh
go-lint: ; $(ENV) "$(SHELL)" ./scripts/make/go-lint.sh
go-test: ; $(ENV) "$(SHELL)" ./scripts/make/go-test.sh
go-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-tools.sh </s> remove - 'name': 'Set up GoReleaser'
'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh'
- 'name': 'Run snapshot build'
'run': 'make release'
'docker':
'runs-on': 'ubuntu-latest'
'needs': 'test'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | main.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> // goarm is the GOARM value. It is set by the linker.
<mask> var goarm = ""
<mask>
<mask> // gomips is the GOMIPS value. It is set by the linker.
<mask> //
<mask> // TODO(a.garipov): Implement.
<mask> var gomips = ""
<mask>
<mask> func main() {
<mask> home.Main(version, channel, goarm, gomips)
<mask> }
</s> Pull request: all: add a new Makefile and scripts, remove goreleaaser
Merge in DNS/adguard-home from 2276-releases to master
Updates #2276.
Squashed commit of the following:
commit 84961947c51477aae53606ec6e2e0cce0bdfc139
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:36:13 2020 +0300
all: fix github build
commit 54af2adbf2f433e80393fb142e66ba6b3a78b13e
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 14:34:02 2020 +0300
all: remove old Dockerfile, improve build scripts
commit 99bb2f2ba1458d32074ac0911b5c02ce6669e43e
Merge: 2292b677a 5e20ac7ed
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:47:19 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 2292b677a20ce8e93d9e6e2bb042cd468606fec3
Author: Ainar Garipov <[email protected]>
Date: Wed Dec 30 13:30:10 2020 +0300
all: improve docker build
commit 0bcc97c41f105ee4a4363f20fa4775c7643bf0cc
Merge: c7d3f12ef aef4659e9
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 17:47:45 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit c7d3f12ef2b63ddfa2acf46e3129fcbc56fb0a90
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 16:28:25 2020 +0300
all: improve build scripts
commit 55de1e5d7ef0fbdbd1a76cfb71362d16ca0a1966
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 15:36:47 2020 +0300
all: fix Makefile
commit d11b1fe28d0fde1efeaf6160a614951b19d0ef94
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 14:16:19 2020 +0300
scripts: fix build-release
commit ecc0577e2451afa86c37da7283a63a9d26fb37ba
Merge: dde64ed8e 483f02c92
Author: Ainar Garipov <[email protected]>
Date: Tue Dec 29 13:59:32 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit dde64ed8e456f73559f21c2ca549dc3b46724add
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 18:04:46 2020 +0300
all: imp docs, other improvements
commit be8574408db79901bb15c1d31916db3ca352a35f
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 14:48:30 2020 +0300
all: imp docker build
commit fc1876f34b93d667bf166226f4bc666d394f10c7
Merge: fa5a304c8 955b735c8
Author: Ainar Garipov <[email protected]>
Date: Fri Dec 25 13:54:29 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit fa5a304c83d86145796a2de4141de6d18f7c56bf
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 19:10:51 2020 +0300
all: improve scripts
commit 3f32e3fd5e658d058d5c5172519384efc6cfef83
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:50:01 2020 +0300
all: improve scripts
commit 2d38b81421acab4b90a7a19da7598c75063e8e93
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:25:21 2020 +0300
all: fix shell for windows, improve go-lint.sh
commit d695285cd6dc476c0d972cfe0c49bbeea5f5a049
Merge: 313b020e9 9fb6bf82c
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:14:38 2020 +0300
Merge branch 'master' into WIP-2276-releases
commit 313b020e9dfcdab736670cee72b2171eac8c32b7
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 18:13:31 2020 +0300
Makefile: use npm ci again
commit 5acee9d6a6c8cd2a7dd04b173a73929650882bad
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:57:54 2020 +0300
all: try fixing windows build
commit c63a2a54641ac8cd032a3306bb35e49b9ae74728
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:39:30 2020 +0300
all: imp scripts, try another goproxy and direct
commit 423229e8b63ee73caeee8e84c23f67d145aff9df
Author: Ainar Garipov <[email protected]>
Date: Thu Dec 24 17:25:29 2020 +0300
all: imp HACKING.md, try a new proxy
... and 1 more commit </s> remove # * build -- builds AdGuardHome for the current platform
# * client -- builds client-side code of AdGuard Home
# * client-watch -- builds client-side code of AdGuard Home and watches for changes there
# * docker -- builds a docker image for the current platform
# * clean -- clean everything created by previous builds
# * lint -- run all linters
# * test -- run all unit-tests
# * dependencies -- installs dependencies (go and npm modules)
# * ci -- installs dependencies, runs linters and tests, intended to be used by CI/CD
#
# Building releases:
#
# * release -- builds AdGuard Home distros. CHANNEL must be specified (edge, release or beta).
# * release_and_sign -- builds AdGuard Home distros and signs the binary files.
# CHANNEL must be specified (edge, release or beta).
# * sign -- Repacks all release archive files and signs the binary files inside them.
# For signing to work, the public+private key pair for $(GPG_KEY) must be imported:
# gpg --import public.txt
# gpg --import private.txt
# GPG_KEY_PASSPHRASE must contain the GPG key passphrase
# * docker-multi-arch -- builds a multi-arch image. If you want it to be pushed to docker hub,
# you must specify:
# * DOCKER_IMAGE_NAME - adguard/adguard-home
# * DOCKER_OUTPUT - type=image,name=adguard/adguard-home,push=true
GO := go
GOPATH := $(shell $(GO) env GOPATH)
PWD := $(shell pwd)
TARGET=AdGuardHome
BASE_URL="https://static.adguard.com/adguardhome/$(CHANNEL)"
GPG_KEY := [email protected]
GPG_KEY_PASSPHRASE :=
GPG_CMD := gpg --detach-sig --default-key $(GPG_KEY) --pinentry-mode loopback --passphrase $(GPG_KEY_PASSPHRASE)
VERBOSE := -v
REBUILD_CLIENT = 1
# See release target
DIST_DIR=dist
# Update channel. Can be release, beta or edge. Uses edge by default.
CHANNEL ?= edge
# Validate channel
ifneq ($(CHANNEL),release)
ifneq ($(CHANNEL),beta)
ifneq ($(CHANNEL),edge)
$(error CHANNEL value is not valid. Valid values are release,beta or edge)
endif
endif
endif
# Version history URL (see
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/releases"
ifeq ($(CHANNEL),edge)
VERSION_HISTORY_URL="https://github.com/AdguardTeam/AdGuardHome/commits/master"
endif
# goreleaser command depends on the $CHANNEL
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --snapshot --parallelism 1
ifneq ($(CHANNEL),edge)
# If this is not an "edge" build, use normal release command
GORELEASER_COMMAND=goreleaser release --rm-dist --skip-publish --parallelism 1
endif
# Version properties
COMMIT=$(shell git rev-parse --short HEAD)
TAG_NAME=$(shell git describe --abbrev=0)
PRERELEASE_VERSION=$(shell git describe --abbrev=0)
# TODO(a.garipov): The cut call is a temporary solution to trim
# prerelease versions. See the comment in .goreleaser.yml.
RELEASE_VERSION=$(shell git describe --abbrev=0 | cut -c 1-8)
SNAPSHOT_VERSION=$(RELEASE_VERSION)-SNAPSHOT-$(COMMIT)
# Set proper version
VERSION=
ifeq ($(TAG_NAME),$(shell git describe --abbrev=4))
ifeq ($(CHANNEL),edge)
VERSION=$(SNAPSHOT_VERSION)
else ifeq ($(CHANNEL),beta)
VERSION=$(PRERELEASE_VERSION)
else
VERSION=$(RELEASE_VERSION)
endif
else
VERSION=$(SNAPSHOT_VERSION)
endif
# Docker target parameters
DOCKER_IMAGE_NAME ?= adguardhome-dev
DOCKER_IMAGE_FULL_NAME = $(DOCKER_IMAGE_NAME):$(VERSION)
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
DOCKER_OUTPUT ?= type=image,name=$(DOCKER_IMAGE_NAME),push=false
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
# Docker tags (can be redefined)
DOCKER_TAGS ?=
ifndef DOCKER_TAGS
ifeq ($(CHANNEL),release)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):latest
endif
ifeq ($(CHANNEL),beta)
DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):beta
endif
ifeq ($(CHANNEL),edge)
# Don't set the version tag when pushing to "edge"
DOCKER_IMAGE_FULL_NAME := $(DOCKER_IMAGE_NAME):edge
# DOCKER_TAGS := --tag $(DOCKER_IMAGE_NAME):edge
endif
endif
# Validate docker build arguments
ifndef DOCKER_IMAGE_NAME
$(error DOCKER_IMAGE_NAME value is not set)
endif
# OS-specific flags
TEST_FLAGS := --race $(VERBOSE)
ifeq ($(OS),Windows_NT)
TEST_FLAGS :=
endif
.PHONY: all build client client-watch docker lint lint-js lint-go test dependencies clean release docker-multi-arch
all: build
init:
git config core.hooksPath .githooks
build:
test '$(REBUILD_CLIENT)' = '1' && $(MAKE) client_with_deps || exit 0
$(GO) mod download
PATH=$(GOPATH)/bin:$(PATH) $(GO) generate ./...
CGO_ENABLED=0 $(GO) build -ldflags="-s -w -X main.version=$(VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)"
PATH=$(GOPATH)/bin:$(PATH) packr clean
client:
npm --prefix client run build-prod
yarn --cwd client2 build
client_with_deps:
npm --prefix client ci
npm --prefix client run build-prod
yarn --cwd client2 build
client-watch:
npm --prefix client run watch
yarn --cwd client2 start
docker:
DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--load \
-t "$(DOCKER_IMAGE_NAME)" -f ./Dockerfile .
@echo Now you can run the docker image:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
</s> add # GOPROXY = https://goproxy.io|https://goproxy.cn|direct
GOPROXY = https://goproxy.cn,https://goproxy.io,direct
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)
ENV = env\
COMMIT='$(COMMIT)'\
CHANNEL='$(CHANNEL)'\
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
DIST_DIR='$(DIST_DIR)'\
GO='$(GO)'\
GOPROXY='$(GOPROXY)'\
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
SIGN='$(SIGN)'\
VERBOSE='$(VERBOSE)'\
VERSION='$(VERSION)'\
# Keep the line above blank.
# Keep this target first, so that a naked make invocation triggers
# a full build.
build: deps quick-build
quick-build: js-build go-build
ci: deps test
deps: js-deps go-deps </s> remove # Available targets
</s> add # See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html.
.POSIX:
CHANNEL = development
CLIENT_BETA_DIR = client2
CLIENT_DIR = client
COMMIT = $$(git rev-parse --short HEAD)
DIST_DIR = dist
GO = go
# TODO(a.garipov): Add more default proxies using pipes after update to
# Go 1.15. </s> remove npm --prefix client ci
yarn --cwd client2 install
$(GO) mod download
clean:
rm -f ./AdGuardHome ./AdGuardHome.exe ./coverage.txt
rm -f -r ./build/ ./client/node_modules/ ./data/ ./$(DIST_DIR)/
# Set the GOPATH explicitly in case make clean is called from under sudo
# after a Docker build.
env PATH="$(GOPATH)/bin:$$PATH" packr clean
rm -f -r ./bin/
</s> add @ echo "use make deps instead"
@ $(MAKE) deps </s> remove - 'app'
- 'docker'
</s> add - 'build-release' </s> add # TODO(a.garipov): Remove the legacy targets once the build
# infrastructure stops using them. </s> remove DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--build-arg VERSION=$(VERSION) \
--build-arg CHANNEL=$(CHANNEL) \
--build-arg VCS_REF=$(COMMIT) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
$(DOCKER_TAGS) \
--output "$(DOCKER_OUTPUT)" \
-t "$(DOCKER_IMAGE_FULL_NAME)" -f ./Dockerfile .
@echo If the image was pushed to the registry, you can now run it:
@echo docker run --name "adguard-home" -p 53:53/tcp -p 53:53/udp -p 80:80/tcp -p 443:443/tcp -p 853:853/tcp -p 3000:3000/tcp $(DOCKER_IMAGE_NAME)
release: client_with_deps
$(GO) mod download
@echo Starting release build: version $(VERSION), channel $(CHANNEL)
CHANNEL=$(CHANNEL) $(GORELEASER_COMMAND)
$(call write_version_file,$(VERSION))
PATH=$(GOPATH)/bin:$(PATH) packr clean
release_and_sign: client_with_deps
$(MAKE) release
$(call repack_dist)
sign:
$(call repack_dist)
define write_version_file
$(eval version := $(1))
@echo Writing version file: $(version)
# Variables for CI
rm -f $(DIST_DIR)/version.txt
echo "version=$(version)" > $(DIST_DIR)/version.txt
# Prepare the version.json file
rm -f $(DIST_DIR)/version.json
echo "{" >> $(DIST_DIR)/version.json
echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json
echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json
echo " \"announcement_url\": \"$(VERSION_HISTORY_URL)\"," >> $(DIST_DIR)/version.json
echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json
# Windows builds
echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_windows_386\": \"$(BASE_URL)/AdGuardHome_windows_386.zip\"," >> $(DIST_DIR)/version.json
# MacOS builds
echo " \"download_darwin_amd64\": \"$(BASE_URL)/AdGuardHome_darwin_amd64.zip\"," >> $(DIST_DIR)/version.json
echo " \"download_darwin_386\": \"$(BASE_URL)/AdGuardHome_darwin_386.zip\"," >> $(DIST_DIR)/version.json
# Linux
echo " \"download_linux_amd64\": \"$(BASE_URL)/AdGuardHome_linux_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_386\": \"$(BASE_URL)/AdGuardHome_linux_386.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, all kinds of ARM
echo " \"download_linux_arm\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv5\": \"$(BASE_URL)/AdGuardHome_linux_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv6\": \"$(BASE_URL)/AdGuardHome_linux_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_armv7\": \"$(BASE_URL)/AdGuardHome_linux_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_arm64\": \"$(BASE_URL)/AdGuardHome_linux_arm64.tar.gz\"," >> $(DIST_DIR)/version.json
# Linux, MIPS
echo " \"download_linux_mips\": \"$(BASE_URL)/AdGuardHome_linux_mips_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mipsle\": \"$(BASE_URL)/AdGuardHome_linux_mipsle_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64\": \"$(BASE_URL)/AdGuardHome_linux_mips64_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_linux_mips64le\": \"$(BASE_URL)/AdGuardHome_linux_mips64le_softfloat.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD
echo " \"download_freebsd_386\": \"$(BASE_URL)/AdGuardHome_freebsd_386.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_amd64\": \"$(BASE_URL)/AdGuardHome_freebsd_amd64.tar.gz\"," >> $(DIST_DIR)/version.json
# FreeBSD, all kinds of ARM
echo " \"download_freebsd_arm\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv5\": \"$(BASE_URL)/AdGuardHome_freebsd_armv5.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv6\": \"$(BASE_URL)/AdGuardHome_freebsd_armv6.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_armv7\": \"$(BASE_URL)/AdGuardHome_freebsd_armv7.tar.gz\"," >> $(DIST_DIR)/version.json
echo " \"download_freebsd_arm64\": \"$(BASE_URL)/AdGuardHome_freebsd_arm64.tar.gz\"" >> $(DIST_DIR)/version.json
# Finish
echo "}" >> $(DIST_DIR)/version.json
endef
define repack_dist
# Repack archive files
# A temporary solution for our auto-update code to be able to unpack these archive files
# The problem is that goreleaser doesn't add directory AdGuardHome/ to the archive file
# and we can't create it
rm -rf $(DIST_DIR)/AdGuardHome
# Windows builds
$(call zip_repack_windows,AdGuardHome_windows_amd64.zip)
$(call zip_repack_windows,AdGuardHome_windows_386.zip)
# MacOS builds
$(call zip_repack,AdGuardHome_darwin_amd64.zip)
$(call zip_repack,AdGuardHome_darwin_386.zip)
# Linux
$(call tar_repack,AdGuardHome_linux_amd64.tar.gz)
$(call tar_repack,AdGuardHome_linux_386.tar.gz)
# Linux, all kinds of ARM
$(call tar_repack,AdGuardHome_linux_armv5.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv6.tar.gz)
$(call tar_repack,AdGuardHome_linux_armv7.tar.gz)
$(call tar_repack,AdGuardHome_linux_arm64.tar.gz)
# Linux, MIPS
$(call tar_repack,AdGuardHome_linux_mips_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mipsle_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64_softfloat.tar.gz)
$(call tar_repack,AdGuardHome_linux_mips64le_softfloat.tar.gz)
# FreeBSD
$(call tar_repack,AdGuardHome_freebsd_386.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_amd64.tar.gz)
# FreeBSD, all kinds of ARM
$(call tar_repack,AdGuardHome_freebsd_armv5.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv6.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_armv7.tar.gz)
$(call tar_repack,AdGuardHome_freebsd_arm64.tar.gz)
endef
define zip_repack_windows
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome.exe && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define zip_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
unzip $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
zip -r $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
define tar_repack
$(eval ARC := $(1))
cd $(DIST_DIR) && \
tar xzf $(ARC) && \
$(GPG_CMD) AdGuardHome/AdGuardHome && \
tar czf $(ARC) AdGuardHome/ && \
rm -rf AdGuardHome
endef
</s> add @ echo "use make build-docker instead"
@ $(MAKE) build-docker
go-install-tools:
@ echo "use make go-tools instead"
@ $(MAKE) go-tools
release:
@ echo "use make build-release instead"
@ $(MAKE) build-release | https://github.com/AdguardTeam/AdGuardHome/commit/0e84962fde7bbb430d4c23e1d7582bfcf173dcb5 | main.go |
keep keep keep keep replace keep | <mask> "access_disallowed_title": "Disallowed clients",
<mask> "access_disallowed_desc": "A list of CIDR or IP addresses. If configured, AdGuard Home will drop requests from these IP addresses.",
<mask> "access_blocked_title": "Blocked domains",
<mask> "access_blocked_desc": "Don't confuse this with filters. AdGuard Home will drop DNS queries with these domains in query's question.",
<mask> "access_settings_saved": "Access settings successfully saved"
<mask> } </s> + client: add button for check updates </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> add .nav-version__text {
display: flex;
justify-content: flex-end;
}
</s> remove { ...this.props.dashboard }
</s> add { ...dashboard }
getVersion={getVersion} </s> remove .card-refresh {
height: 26px;
width: 26px;
background-size: 14px;
background-position: center;
background-repeat: no-repeat;
background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiM0NjdmY2YiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
}
.card-refresh:hover,
.card-refresh:not(:disabled):not(.disabled):active,
.card-refresh:focus:active {
background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
}
</s> add </s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> add if (recheck) {
dispatch(addSuccessToast('updates_checked'));
} | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/__locales/en.json |
keep keep replace keep keep replace keep | <mask> export const getVersionSuccess = createAction('GET_VERSION_SUCCESS');
<mask>
<mask> export const getVersion = () => async (dispatch) => {
<mask> dispatch(getVersionRequest());
<mask> try {
<mask> const newVersion = await apiClient.getGlobalVersion();
<mask> dispatch(getVersionSuccess(newVersion));
</s> + client: add button for check updates </s> add if (recheck) {
dispatch(addSuccessToast('updates_checked'));
} </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove const refreshFullButton = <button type="button" className="btn btn-outline-primary btn-sm" onClick={() => this.getAllStats()}><Trans>refresh_statics</Trans></button>;
const refreshButton = <button type="button" className="btn btn-outline-primary btn-sm card-refresh" onClick={() => this.getAllStats()} />;
</s> add const refreshFullButton = (
<button
type="button"
className="btn btn-outline-primary btn-sm"
onClick={() => this.getAllStats()}
>
<Trans>refresh_statics</Trans>
</button>
);
const refreshButton = (
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm"
onClick={() => this.getAllStats()}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button>
); </s> remove const { dashboard } = this.props;
</s> add const { dashboard, getVersion, location } = this.props; </s> remove dashboard: PropTypes.object,
location: PropTypes.object,
</s> add dashboard: PropTypes.object.isRequired,
location: PropTypes.object.isRequired,
getVersion: PropTypes.func.isRequired, | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/actions/index.js |
keep keep add keep keep keep keep keep | <mask> try {
<mask> const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck });
<mask> dispatch(getVersionSuccess(newVersion));
<mask> } catch (error) {
<mask> dispatch(addErrorToast({ error }));
<mask> dispatch(getVersionFailure());
<mask> }
<mask> };
</s> + client: add button for check updates </s> remove const newVersion = await apiClient.getGlobalVersion();
</s> add const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck }); </s> remove export const getVersion = () => async (dispatch) => {
</s> add export const getVersion = (recheck = false) => async (dispatch) => { </s> remove const { dashboard } = this.props;
</s> add const { dashboard, getVersion, location } = this.props; </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
| https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/actions/index.js |
keep keep keep keep replace keep keep keep keep keep | <mask> GLOBAL_QUERY_LOG_ENABLE = { path: 'querylog_enable', method: 'POST' };
<mask> GLOBAL_QUERY_LOG_DISABLE = { path: 'querylog_disable', method: 'POST' };
<mask> GLOBAL_SET_UPSTREAM_DNS = { path: 'set_upstreams_config', method: 'POST' };
<mask> GLOBAL_TEST_UPSTREAM_DNS = { path: 'test_upstream_dns', method: 'POST' };
<mask> GLOBAL_VERSION = { path: 'version.json', method: 'GET' };
<mask> GLOBAL_ENABLE_PROTECTION = { path: 'enable_protection', method: 'POST' };
<mask> GLOBAL_DISABLE_PROTECTION = { path: 'disable_protection', method: 'POST' };
<mask> GLOBAL_UPDATE = { path: 'update', method: 'POST' };
<mask>
<mask> restartGlobalFiltering() {
</s> + client: add button for check updates </s> remove const { dashboard } = this.props;
</s> add const { dashboard, getVersion, location } = this.props; </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> remove const updateAvailable =
!dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
</s> add const updateAvailable = dashboard.isCoreRunning && dashboard.isUpdateAvailable; </s> remove export const getVersion = () => async (dispatch) => {
</s> add export const getVersion = (recheck = false) => async (dispatch) => { </s> add if (recheck) {
dispatch(addSuccessToast('updates_checked'));
} | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/api/Api.js |
keep keep keep keep replace keep keep keep keep keep | <mask> };
<mask> return this.makeRequest(path, method, config);
<mask> }
<mask>
<mask> getGlobalVersion() {
<mask> const { path, method } = this.GLOBAL_VERSION;
<mask> return this.makeRequest(path, method);
<mask> }
<mask>
<mask> enableGlobalProtection() {
</s> + client: add button for check updates </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove const updateAvailable =
!dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
</s> add const updateAvailable = dashboard.isCoreRunning && dashboard.isUpdateAvailable; </s> remove const { dashboard } = this.props;
</s> add const { dashboard, getVersion, location } = this.props; </s> add if (recheck) {
dispatch(addSuccessToast('updates_checked'));
} </s> remove const newVersion = await apiClient.getGlobalVersion();
</s> add const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck }); | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/api/Api.js |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> getGlobalVersion() {
<mask> const { path, method } = this.GLOBAL_VERSION;
<mask> return this.makeRequest(path, method);
<mask> }
<mask>
<mask> enableGlobalProtection() {
<mask> const { path, method } = this.GLOBAL_ENABLE_PROTECTION;
<mask> return this.makeRequest(path, method);
</s> + client: add button for check updates </s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove const { dashboard } = this.props;
</s> add const { dashboard, getVersion, location } = this.props; </s> remove const updateAvailable =
!dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
</s> add const updateAvailable = dashboard.isCoreRunning && dashboard.isUpdateAvailable; </s> add if (recheck) {
dispatch(addSuccessToast('updates_checked'));
} </s> remove const newVersion = await apiClient.getGlobalVersion();
</s> add const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck }); | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/api/Api.js |
keep keep keep keep replace replace keep keep keep keep keep | <mask> };
<mask>
<mask> render() {
<mask> const { dashboard, encryption } = this.props;
<mask> const updateAvailable =
<mask> !dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
<mask>
<mask> return (
<mask> <HashRouter hashType="noslash">
<mask> <Fragment>
<mask> {updateAvailable && (
</s> + client: add button for check updates </s> remove const { dashboard } = this.props;
</s> add const { dashboard, getVersion, location } = this.props; </s> remove { ...this.props.dashboard }
</s> add { ...dashboard }
getVersion={getVersion} </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove location={this.props.location}
</s> add location={location} </s> remove const refreshFullButton = <button type="button" className="btn btn-outline-primary btn-sm" onClick={() => this.getAllStats()}><Trans>refresh_statics</Trans></button>;
const refreshButton = <button type="button" className="btn btn-outline-primary btn-sm card-refresh" onClick={() => this.getAllStats()} />;
</s> add const refreshFullButton = (
<button
type="button"
className="btn btn-outline-primary btn-sm"
onClick={() => this.getAllStats()}
>
<Trans>refresh_statics</Trans>
</button>
);
const refreshButton = (
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm"
onClick={() => this.getAllStats()}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button>
); </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/App/index.js |
keep keep keep keep replace replace keep keep keep keep keep | <mask> dashboard.processingStatsHistory ||
<mask> dashboard.processingClients ||
<mask> dashboard.processingTopStats;
<mask>
<mask> const refreshFullButton = <button type="button" className="btn btn-outline-primary btn-sm" onClick={() => this.getAllStats()}><Trans>refresh_statics</Trans></button>;
<mask> const refreshButton = <button type="button" className="btn btn-outline-primary btn-sm card-refresh" onClick={() => this.getAllStats()} />;
<mask>
<mask> return (
<mask> <Fragment>
<mask> <PageTitle title={ t('dashboard') }>
<mask> <div className="page-title__actions">
</s> + client: add button for check updates </s> remove <Trans>version</Trans>: <span className="nav-version__value">{dnsVersion}</span>
</s> add <Trans>version</Trans>: <span className="nav-version__value" title={dnsVersion}>{dnsVersion}</span>
<button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button> </s> remove const updateAvailable =
!dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
</s> add const updateAvailable = dashboard.isCoreRunning && dashboard.isUpdateAvailable; </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove export const getVersion = () => async (dispatch) => {
</s> add export const getVersion = (recheck = false) => async (dispatch) => { </s> remove {dnsAddresses
.map(ip => <li key={ip}>{getDnsAddress(ip, dnsPort)}</li>)
}
</s> add {dnsAddresses.map(ip => (
<li key={ip}>{getDnsAddress(ip, dnsPort)}</li>
))} </s> remove const newVersion = await apiClient.getGlobalVersion();
</s> add const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck }); | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Dashboard/index.js |
keep add keep keep keep keep | <mask>
<mask> .nav-version__value {
<mask> font-weight: 600;
<mask> text-overflow: ellipsis;
<mask> white-space: nowrap;
<mask> overflow: hidden;
</s> + client: add button for check updates </s> add text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden; </s> remove GLOBAL_VERSION = { path: 'version.json', method: 'GET' };
</s> add GLOBAL_VERSION = { path: 'version.json', method: 'POST' }; </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> add .nav-version__text {
display: flex;
justify-content: flex-end;
}
| https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/Header.css |
keep add keep keep keep keep keep | <mask> max-width: 110px;
<mask> font-weight: 600;
<mask> }
<mask>
<mask> .nav-version__link {
<mask> position: relative;
<mask> display: inline-block;
</s> + client: add button for check updates </s> add max-width: 110px; </s> add .nav-version__text {
display: flex;
justify-content: flex-end;
}
</s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> add if (recheck) {
dispatch(addSuccessToast('updates_checked'));
} | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/Header.css |
keep add keep keep keep keep keep keep | <mask> }
<mask>
<mask> .header-brand-img {
<mask> height: 32px;
<mask> }
<mask>
<mask> .nav-tabs .nav-item.show .nav-link {
<mask> color: #66b574;
</s> + client: add button for check updates </s> remove .card-refresh {
height: 26px;
width: 26px;
background-size: 14px;
background-position: center;
background-repeat: no-repeat;
background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiM0NjdmY2YiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
}
.card-refresh:hover,
.card-refresh:not(:disabled):not(.disabled):active,
.card-refresh:focus:active {
background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
}
</s> add </s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> add if (recheck) {
dispatch(addSuccessToast('updates_checked'));
} </s> remove { ...this.props.dashboard }
</s> add { ...dashboard }
getVersion={getVersion} | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/Header.css |
keep keep keep replace replace keep keep keep replace keep keep keep | <mask>
<mask> import { getDnsAddress } from '../../helpers/helpers';
<mask>
<mask> function Version(props) {
<mask> const { dnsVersion, dnsAddresses, dnsPort } = props;
<mask> return (
<mask> <div className="nav-version">
<mask> <div className="nav-version__text">
<mask> <Trans>version</Trans>: <span className="nav-version__value">{dnsVersion}</span>
<mask> </div>
<mask> <div className="nav-version__link">
<mask> <div className="popover__trigger popover__trigger--address">
</s> + client: add button for check updates </s> remove { ...this.props.dashboard }
</s> add { ...dashboard }
getVersion={getVersion} </s> remove {dnsAddresses
.map(ip => <li key={ip}>{getDnsAddress(ip, dnsPort)}</li>)
}
</s> add {dnsAddresses.map(ip => (
<li key={ip}>{getDnsAddress(ip, dnsPort)}</li>
))} </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove const updateAvailable =
!dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
</s> add const updateAvailable = dashboard.isCoreRunning && dashboard.isUpdateAvailable; </s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/Version.js |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask> <Trans>dns_addresses</Trans>
<mask> </div>
<mask> <div className="popover__body popover__body--address">
<mask> <div className="popover__list">
<mask> {dnsAddresses
<mask> .map(ip => <li key={ip}>{getDnsAddress(ip, dnsPort)}</li>)
<mask> }
<mask> </div>
<mask> </div>
<mask> </div>
<mask> </div>
<mask> );
</s> + client: add button for check updates </s> remove <Trans>version</Trans>: <span className="nav-version__value">{dnsVersion}</span>
</s> add <Trans>version</Trans>: <span className="nav-version__value" title={dnsVersion}>{dnsVersion}</span>
<button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button> </s> remove { ...this.props.dashboard }
</s> add { ...dashboard }
getVersion={getVersion} </s> remove }
</s> add }; </s> remove location={this.props.location}
</s> add location={location} </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove const refreshFullButton = <button type="button" className="btn btn-outline-primary btn-sm" onClick={() => this.getAllStats()}><Trans>refresh_statics</Trans></button>;
const refreshButton = <button type="button" className="btn btn-outline-primary btn-sm card-refresh" onClick={() => this.getAllStats()} />;
</s> add const refreshFullButton = (
<button
type="button"
className="btn btn-outline-primary btn-sm"
onClick={() => this.getAllStats()}
>
<Trans>refresh_statics</Trans>
</button>
);
const refreshButton = (
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm"
onClick={() => this.getAllStats()}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button>
); | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/Version.js |
keep keep keep keep replace keep keep keep keep keep | <mask> </div>
<mask> </div>
<mask> </div>
<mask> );
<mask> }
<mask>
<mask> Version.propTypes = {
<mask> dnsVersion: PropTypes.string.isRequired,
<mask> dnsAddresses: PropTypes.array.isRequired,
<mask> dnsPort: PropTypes.number.isRequired,
</s> + client: add button for check updates </s> add getVersion: PropTypes.func.isRequired,
processingVersion: PropTypes.bool.isRequired,
t: PropTypes.func.isRequired, </s> remove {dnsAddresses
.map(ip => <li key={ip}>{getDnsAddress(ip, dnsPort)}</li>)
}
</s> add {dnsAddresses.map(ip => (
<li key={ip}>{getDnsAddress(ip, dnsPort)}</li>
))} </s> remove { ...this.props.dashboard }
</s> add { ...dashboard }
getVersion={getVersion} </s> remove location={this.props.location}
</s> add location={location} </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove <Trans>version</Trans>: <span className="nav-version__value">{dnsVersion}</span>
</s> add <Trans>version</Trans>: <span className="nav-version__value" title={dnsVersion}>{dnsVersion}</span>
<button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button> | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/Version.js |
keep keep add keep keep keep | <mask> dnsVersion: PropTypes.string.isRequired,
<mask> dnsAddresses: PropTypes.array.isRequired,
<mask> dnsPort: PropTypes.number.isRequired,
<mask> };
<mask>
<mask> export default withNamespaces()(Version);
</s> + client: add button for check updates </s> remove }
</s> add }; </s> remove dashboard: PropTypes.object,
location: PropTypes.object,
</s> add dashboard: PropTypes.object.isRequired,
location: PropTypes.object.isRequired,
getVersion: PropTypes.func.isRequired, </s> remove export const getVersion = () => async (dispatch) => {
</s> add export const getVersion = (recheck = false) => async (dispatch) => { </s> remove const newVersion = await apiClient.getGlobalVersion();
</s> add const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck }); </s> add <symbol id="refresh" viewBox="0 0 24 24" stroke="currentColor" fill="none" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2">
<path d="M23 4v6h-6M1 20v-6h6"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>
</symbol> </s> remove GLOBAL_VERSION = { path: 'version.json', method: 'GET' };
</s> add GLOBAL_VERSION = { path: 'version.json', method: 'POST' }; | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/Version.js |
keep keep keep keep replace keep keep keep keep keep | <mask> this.setState({ isMenuOpen: false });
<mask> };
<mask>
<mask> render() {
<mask> const { dashboard } = this.props;
<mask> const { isMenuOpen } = this.state;
<mask> const badgeClass = classnames({
<mask> 'badge dns-status': true,
<mask> 'badge-success': dashboard.protectionEnabled,
<mask> 'badge-danger': !dashboard.protectionEnabled,
</s> + client: add button for check updates </s> remove const updateAvailable =
!dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
</s> add const updateAvailable = dashboard.isCoreRunning && dashboard.isUpdateAvailable; </s> remove const newVersion = await apiClient.getGlobalVersion();
</s> add const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck }); </s> add if (recheck) {
dispatch(addSuccessToast('updates_checked'));
} </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/index.js |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask> </div>
<mask> </div>
<mask> <Menu
<mask> location={this.props.location}
<mask> isMenuOpen={isMenuOpen}
<mask> toggleMenuOpen={this.toggleMenuOpen}
<mask> closeMenu={this.closeMenu}
<mask> />
<mask> {!dashboard.processing &&
</s> + client: add button for check updates </s> remove { ...this.props.dashboard }
</s> add { ...dashboard }
getVersion={getVersion} </s> remove {dnsAddresses
.map(ip => <li key={ip}>{getDnsAddress(ip, dnsPort)}</li>)
}
</s> add {dnsAddresses.map(ip => (
<li key={ip}>{getDnsAddress(ip, dnsPort)}</li>
))} </s> remove }
</s> add }; </s> remove <Trans>version</Trans>: <span className="nav-version__value">{dnsVersion}</span>
</s> add <Trans>version</Trans>: <span className="nav-version__value" title={dnsVersion}>{dnsVersion}</span>
<button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button> </s> remove const updateAvailable =
!dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
</s> add const updateAvailable = dashboard.isCoreRunning && dashboard.isUpdateAvailable; </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
| https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/index.js |
keep keep keep keep replace keep keep keep keep keep | <mask> />
<mask> {!dashboard.processing &&
<mask> <div className="col col-sm-6 col-lg-3">
<mask> <Version
<mask> { ...this.props.dashboard }
<mask> />
<mask> </div>
<mask> }
<mask> </div>
<mask> </div>
</s> + client: add button for check updates </s> remove location={this.props.location}
</s> add location={location} </s> remove <Trans>version</Trans>: <span className="nav-version__value">{dnsVersion}</span>
</s> add <Trans>version</Trans>: <span className="nav-version__value" title={dnsVersion}>{dnsVersion}</span>
<button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button> </s> remove {dnsAddresses
.map(ip => <li key={ip}>{getDnsAddress(ip, dnsPort)}</li>)
}
</s> add {dnsAddresses.map(ip => (
<li key={ip}>{getDnsAddress(ip, dnsPort)}</li>
))} </s> remove }
</s> add }; </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove const updateAvailable =
!dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
</s> add const updateAvailable = dashboard.isCoreRunning && dashboard.isUpdateAvailable; | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/index.js |
keep keep keep keep replace replace keep keep keep | <mask> }
<mask> }
<mask>
<mask> Header.propTypes = {
<mask> dashboard: PropTypes.object,
<mask> location: PropTypes.object,
<mask> };
<mask>
<mask> export default withNamespaces()(Header);
</s> + client: add button for check updates </s> remove export const getVersion = () => async (dispatch) => {
</s> add export const getVersion = (recheck = false) => async (dispatch) => { </s> remove const newVersion = await apiClient.getGlobalVersion();
</s> add const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck }); </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> remove const { dashboard } = this.props;
</s> add const { dashboard, getVersion, location } = this.props; </s> add getVersion: PropTypes.func.isRequired,
processingVersion: PropTypes.bool.isRequired,
t: PropTypes.func.isRequired, | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/Header/index.js |
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep | <mask> padding: 2.5rem 1.5rem;
<mask> text-align: center;
<mask> }
<mask>
<mask> .card-refresh {
<mask> height: 26px;
<mask> width: 26px;
<mask> background-size: 14px;
<mask> background-position: center;
<mask> background-repeat: no-repeat;
<mask> background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiM0NjdmY2YiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
<mask> }
<mask>
<mask> .card-refresh:hover,
<mask> .card-refresh:not(:disabled):not(.disabled):active,
<mask> .card-refresh:focus:active {
<mask> background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
<mask> }
<mask>
<mask> .card-title-stats {
<mask> font-size: 13px;
<mask> color: #9aa0ac;
<mask> }
<mask>
</s> + client: add button for check updates </s> add .nav-version__text {
display: flex;
justify-content: flex-end;
}
</s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> add if (recheck) {
dispatch(addSuccessToast('updates_checked'));
} </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove { ...this.props.dashboard }
</s> add { ...dashboard }
getVersion={getVersion} | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/ui/Card.css |
keep keep add keep keep keep keep | <mask> <symbol id="settings" viewBox="0 0 24 24" stroke="currentColor" fill="none" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2">
<mask> <circle cx="12" cy="12" r="3"/><path d="m19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1 -2.83 0l-.06-.06a1.65 1.65 0 0 0 -1.82-.33 1.65 1.65 0 0 0 -1 1.51v.17a2 2 0 0 1 -2 2 2 2 0 0 1 -2-2v-.09a1.65 1.65 0 0 0 -1.08-1.51 1.65 1.65 0 0 0 -1.82.33l-.06.06a2 2 0 0 1 -2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0 -1.51-1h-.17a2 2 0 0 1 -2-2 2 2 0 0 1 2-2h.09a1.65 1.65 0 0 0 1.51-1.08 1.65 1.65 0 0 0 -.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33h.08a1.65 1.65 0 0 0 1-1.51v-.17a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0 -.33 1.82v.08a1.65 1.65 0 0 0 1.51 1h.17a2 2 0 0 1 2 2 2 2 0 0 1 -2 2h-.09a1.65 1.65 0 0 0 -1.51 1z"/>
<mask> </symbol>
<mask> </svg>
<mask> );
<mask>
<mask> export default Icons;
</s> + client: add button for check updates </s> add getVersion: PropTypes.func.isRequired,
processingVersion: PropTypes.bool.isRequired,
t: PropTypes.func.isRequired, </s> remove dashboard: PropTypes.object,
location: PropTypes.object,
</s> add dashboard: PropTypes.object.isRequired,
location: PropTypes.object.isRequired,
getVersion: PropTypes.func.isRequired, </s> remove const refreshFullButton = <button type="button" className="btn btn-outline-primary btn-sm" onClick={() => this.getAllStats()}><Trans>refresh_statics</Trans></button>;
const refreshButton = <button type="button" className="btn btn-outline-primary btn-sm card-refresh" onClick={() => this.getAllStats()} />;
</s> add const refreshFullButton = (
<button
type="button"
className="btn btn-outline-primary btn-sm"
onClick={() => this.getAllStats()}
>
<Trans>refresh_statics</Trans>
</button>
);
const refreshButton = (
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm"
onClick={() => this.getAllStats()}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button>
); </s> remove export const getVersion = () => async (dispatch) => {
</s> add export const getVersion = (recheck = false) => async (dispatch) => { </s> remove }
</s> add }; </s> remove {dnsAddresses
.map(ip => <li key={ip}>{getDnsAddress(ip, dnsPort)}</li>)
}
</s> add {dnsAddresses.map(ip => (
<li key={ip}>{getDnsAddress(ip, dnsPort)}</li>
))} | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/components/ui/Icons.js |
keep keep keep add keep keep keep keep keep | <mask> announcementUrl,
<mask> newVersion,
<mask> canAutoUpdate,
<mask> isUpdateAvailable: true,
<mask> };
<mask> return newState;
<mask> }
<mask>
<mask> return state;
</s> + client: add button for check updates </s> remove getGlobalVersion() {
</s> add getGlobalVersion(data) { </s> remove return this.makeRequest(path, method);
</s> add const config = {
data,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, config); </s> remove const { dashboard } = this.props;
</s> add const { dashboard, getVersion, location } = this.props; </s> remove const updateAvailable =
!dashboard.processingVersions && dashboard.isCoreRunning && dashboard.isUpdateAvailable;
</s> add const updateAvailable = dashboard.isCoreRunning && dashboard.isUpdateAvailable; </s> remove function Version(props) {
const { dnsVersion, dnsAddresses, dnsPort } = props;
</s> add const Version = (props) => {
const {
dnsVersion, dnsAddresses, dnsPort, processingVersion, t,
} = props;
</s> remove <Trans>version</Trans>: <span className="nav-version__value">{dnsVersion}</span>
</s> add <Trans>version</Trans>: <span className="nav-version__value" title={dnsVersion}>{dnsVersion}</span>
<button
type="button"
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
onClick={() => props.getVersion(true)}
disabled={processingVersion}
title={t('check_updates_now')}
>
<svg className="icons">
<use xlinkHref="#refresh" />
</svg>
</button> | https://github.com/AdguardTeam/AdGuardHome/commit/0e9df33a409dbffeb2d5d45b7f31f30587a2e4f7 | client/src/reducers/index.js |
keep keep keep add keep keep keep keep | <mask> package main
<mask>
<mask> import (
<mask> "encoding/json"
<mask> "fmt"
<mask> "io/ioutil"
<mask> "net"
<mask> "net/http"
</s> + /control/dhcp/find_active_dhcp: detect static IP on Linux </s> add "os/exec"
"runtime" </s> remove result["other-server"] = othSrv
</s> add result["other_server"] = othSrv
result["static_ip"] = staticIP </s> add staticIP := map[string]interface{}{}
isStaticIP, err := hasStaticIP(interfaceName)
staticIPStatus := "yes"
if err != nil {
staticIPStatus = "error"
staticIP["error"] = err.Error()
} else if !isStaticIP {
staticIPStatus = "no"
staticIP["ip"] = getFullIP(interfaceName)
}
staticIP["static"] = staticIPStatus
</s> add // Perform the following tasks:
// . Search for another DHCP server running
// . Check if a static IP is configured for the network interface
// Respond with results | https://github.com/AdguardTeam/AdGuardHome/commit/0ed619c9c86402ae8188ab2e00a0bd717aa0cbee | dhcp.go |
keep add keep keep keep keep keep | <mask> "net"
<mask> "net/http"
<mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dhcpd"
<mask> "github.com/AdguardTeam/golibs/log"
</s> + /control/dhcp/find_active_dhcp: detect static IP on Linux </s> add "errors" </s> remove result["other-server"] = othSrv
</s> add result["other_server"] = othSrv
result["static_ip"] = staticIP </s> add staticIP := map[string]interface{}{}
isStaticIP, err := hasStaticIP(interfaceName)
staticIPStatus := "yes"
if err != nil {
staticIPStatus = "error"
staticIP["error"] = err.Error()
} else if !isStaticIP {
staticIPStatus = "no"
staticIP["ip"] = getFullIP(interfaceName)
}
staticIP["static"] = staticIPStatus
</s> add // Perform the following tasks:
// . Search for another DHCP server running
// . Check if a static IP is configured for the network interface
// Respond with results | https://github.com/AdguardTeam/AdGuardHome/commit/0ed619c9c86402ae8188ab2e00a0bd717aa0cbee | dhcp.go |
keep keep keep add keep keep keep keep keep keep | <mask> return
<mask> }
<mask> }
<mask>
<mask> func handleDHCPFindActiveServer(w http.ResponseWriter, r *http.Request) {
<mask> log.Tracef("%s %v", r.Method, r.URL)
<mask> body, err := ioutil.ReadAll(r.Body)
<mask> if err != nil {
<mask> errorText := fmt.Sprintf("failed to read request body: %s", err)
<mask> log.Error(errorText)
</s> + /control/dhcp/find_active_dhcp: detect static IP on Linux </s> remove result["other-server"] = othSrv
</s> add result["other_server"] = othSrv
result["static_ip"] = staticIP </s> add staticIP := map[string]interface{}{}
isStaticIP, err := hasStaticIP(interfaceName)
staticIPStatus := "yes"
if err != nil {
staticIPStatus = "error"
staticIP["error"] = err.Error()
} else if !isStaticIP {
staticIPStatus = "no"
staticIP["ip"] = getFullIP(interfaceName)
}
staticIP["static"] = staticIPStatus
</s> add "os/exec"
"runtime" </s> add "errors" | https://github.com/AdguardTeam/AdGuardHome/commit/0ed619c9c86402ae8188ab2e00a0bd717aa0cbee | dhcp.go |
keep keep add keep keep keep keep keep | <mask> }
<mask> othSrv["found"] = foundVal
<mask>
<mask> result := map[string]interface{}{}
<mask> result["other_server"] = othSrv
<mask> result["static_ip"] = staticIP
<mask>
<mask> w.Header().Set("Content-Type", "application/json")
</s> + /control/dhcp/find_active_dhcp: detect static IP on Linux </s> remove result["other-server"] = othSrv
</s> add result["other_server"] = othSrv
result["static_ip"] = staticIP </s> add // Perform the following tasks:
// . Search for another DHCP server running
// . Check if a static IP is configured for the network interface
// Respond with results </s> add "os/exec"
"runtime" </s> add "errors" | https://github.com/AdguardTeam/AdGuardHome/commit/0ed619c9c86402ae8188ab2e00a0bd717aa0cbee | dhcp.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask> othSrv["found"] = foundVal
<mask>
<mask> result := map[string]interface{}{}
<mask> result["other-server"] = othSrv
<mask>
<mask> w.Header().Set("Content-Type", "application/json")
<mask> err = json.NewEncoder(w).Encode(result)
<mask> if err != nil {
<mask> httpError(w, http.StatusInternalServerError, "Failed to marshal DHCP found json: %s", err)
</s> + /control/dhcp/find_active_dhcp: detect static IP on Linux </s> add staticIP := map[string]interface{}{}
isStaticIP, err := hasStaticIP(interfaceName)
staticIPStatus := "yes"
if err != nil {
staticIPStatus = "error"
staticIP["error"] = err.Error()
} else if !isStaticIP {
staticIPStatus = "no"
staticIP["ip"] = getFullIP(interfaceName)
}
staticIP["static"] = staticIPStatus
</s> add // Perform the following tasks:
// . Search for another DHCP server running
// . Check if a static IP is configured for the network interface
// Respond with results </s> add "os/exec"
"runtime" </s> add "errors" | https://github.com/AdguardTeam/AdGuardHome/commit/0ed619c9c86402ae8188ab2e00a0bd717aa0cbee | dhcp.go |
keep keep keep keep replace keep keep keep keep keep | <mask> width: 100,
<mask> sortable: false,
<mask> resizable: false,
<mask> Cell: (row) => {
<mask> const { value } = row;
<mask> const { t, toggleFilteringModal, handleDelete } = this.props;
<mask>
<mask> return (
<mask> <div className="logs__row logs__row--center">
<mask> <button
</s> Pull request: 4659 fix url value in filter table actions
Updates #4659
Squashed commit of the following:
commit e1bcda9566bd9f1cca965f4308c337a9adf2ce04
Author: Ildar Kamalov <[email protected]>
Date: Tue Jun 14 17:40:09 2022 +0300
client: fix url value in filter table actions </s> remove url: value,
</s> add url, </s> remove onClick={() => handleDelete(value)}
</s> add onClick={() => handleDelete(url)} | https://github.com/AdguardTeam/AdGuardHome/commit/0edf71a4af0602106f09cb3270904e2abdbce28c | client/src/components/Filters/Table.js |
keep keep keep keep replace keep keep keep keep keep | <mask> className="btn btn-icon btn-outline-primary btn-sm mr-2"
<mask> title={t('edit_table_action')}
<mask> onClick={() => toggleFilteringModal({
<mask> type: MODAL_TYPE.EDIT_FILTERS,
<mask> url: value,
<mask> })
<mask> }
<mask> >
<mask> <svg className="icons">
<mask> <use xlinkHref="#edit" />
</s> Pull request: 4659 fix url value in filter table actions
Updates #4659
Squashed commit of the following:
commit e1bcda9566bd9f1cca965f4308c337a9adf2ce04
Author: Ildar Kamalov <[email protected]>
Date: Tue Jun 14 17:40:09 2022 +0300
client: fix url value in filter table actions </s> remove onClick={() => handleDelete(value)}
</s> add onClick={() => handleDelete(url)} </s> remove const { value } = row;
</s> add const { original } = row;
const { url } = original; | https://github.com/AdguardTeam/AdGuardHome/commit/0edf71a4af0602106f09cb3270904e2abdbce28c | client/src/components/Filters/Table.js |
keep keep keep keep replace keep keep keep keep keep | <mask> </button>
<mask> <button
<mask> type="button"
<mask> className="btn btn-icon btn-outline-secondary btn-sm"
<mask> onClick={() => handleDelete(value)}
<mask> title={t('delete_table_action')}
<mask> >
<mask> <svg className="icons">
<mask> <use xlinkHref="#delete" />
<mask> </svg>
</s> Pull request: 4659 fix url value in filter table actions
Updates #4659
Squashed commit of the following:
commit e1bcda9566bd9f1cca965f4308c337a9adf2ce04
Author: Ildar Kamalov <[email protected]>
Date: Tue Jun 14 17:40:09 2022 +0300
client: fix url value in filter table actions </s> remove url: value,
</s> add url, </s> remove const { value } = row;
</s> add const { original } = row;
const { url } = original; | https://github.com/AdguardTeam/AdGuardHome/commit/0edf71a4af0602106f09cb3270904e2abdbce28c | client/src/components/Filters/Table.js |
keep keep add keep keep keep keep | <mask>
<mask> // SAFE BROWSING
<mask>
<mask> func TestSafeBrowsing(t *testing.T) {
<mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil)
<mask> defer d.Close()
<mask> gctx.stats.Safebrowsing.Requests = 0
</s> * SB/PC: limit the number of hashes in request to 4 </s> add nDots := 0
for i := len(curhost) - 1; i >= 0; i-- {
if curhost[i] == '.' {
nDots++
if nDots == 4 {
curhost = curhost[i+1:] // "xxx.a.b.c.d" -> "a.b.c.d"
break
}
}
}
</s> add // The maximum is 4 components: "a.b.c.d" | https://github.com/AdguardTeam/AdGuardHome/commit/0ee3505e1f0cc3df78651f2f9cb393c5ff3df26e | dnsfilter/dnsfilter_test.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.