docstring_tokens
stringlengths 0
76.5k
| code_tokens
stringlengths 75
1.81M
| label_window
sequencelengths 4
2.12k
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|---|
if !privateNets.Contains(subnet.Addr().AsSlice()) { | <mask>
<mask> continue
<mask> }
<mask>
<mask> if !privateNets.Contains(subnet.IP) {
<mask> errs = append(
<mask> errs,
<mask> fmt.Errorf("arpa domain %q should point to a locally-served network", domain),
<mask> )
<mask> }
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove var subnet *net.IPNet
subnet, err = netutil.SubnetFromReversedAddr(domain)
</s> add var subnet netip.Prefix
subnet, err = extractARPASubnet(domain) </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, </s> remove log.Debug("dnsforward: addr %s is from locally served network", ip)
</s> add log.Debug("dnsforward: addr %s is from locally served network", subnetAddr) </s> remove `bad arpa domain name "hello.world": not a reversed ip network`,
</s> add `bad arpa domain name "hello.world.": not a reversed ip network`, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http.go |
`bad arpa domain name "non.arpa.": not a reversed ip network`, | <mask> wantSet: "",
<mask> }, {
<mask> name: "local_ptr_upstreams_bad",
<mask> wantSet: `validating private upstream servers: checking domain-specific upstreams: ` +
<mask> `bad arpa domain name "non.arpa": not a reversed ip network`,
<mask> }, {
<mask> name: "local_ptr_upstreams_null",
<mask> wantSet: "",
<mask> }}
<mask>
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove `bad arpa domain name "hello.world": not a reversed ip network`,
</s> add `bad arpa domain name "hello.world.": not a reversed ip network`, </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove log.Debug("dnsforward: parsing reversed addr: %s", err)
</s> add if errors.Is(err, netutil.ErrNotAReversedSubnet) {
log.Debug("dnsforward: request is not for arpa domain") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http_test.go |
`bad arpa domain name "hello.world.": not a reversed ip network`, | <mask> u: "[/127.in-addr.arpa/]#",
<mask> }, {
<mask> name: "not_arpa_subnet",
<mask> wantErr: `checking domain-specific upstreams: ` +
<mask> `bad arpa domain name "hello.world": not a reversed ip network`,
<mask> u: "[/hello.world/]#",
<mask> }, {
<mask> name: "non-private_arpa_address",
<mask> wantErr: `checking domain-specific upstreams: ` +
<mask> `arpa domain "1.2.3.4.in-addr.arpa." should point to a locally-served network`,
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, </s> remove `bad arpa domain name "non.arpa": not a reversed ip network`,
</s> add `bad arpa domain name "non.arpa.": not a reversed ip network`, </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove log.Debug("dnsforward: parsing reversed addr: %s", err)
</s> add if errors.Is(err, netutil.ErrNotAReversedSubnet) {
log.Debug("dnsforward: request is not for arpa domain") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http_test.go |
`"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, | <mask> }, {
<mask> name: "several_bad",
<mask> wantErr: `checking domain-specific upstreams: 2 errors: ` +
<mask> `"arpa domain \"1.2.3.4.in-addr.arpa.\" should point to a locally-served network", ` +
<mask> `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
<mask> u: "[/non.arpa/1.2.3.4.in-addr.arpa/127.in-addr.arpa/]#",
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> set := []string{"192.168.0.1", tc.u}
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove `bad arpa domain name "hello.world": not a reversed ip network`,
</s> add `bad arpa domain name "hello.world.": not a reversed ip network`, </s> remove `bad arpa domain name "non.arpa": not a reversed ip network`,
</s> add `bad arpa domain name "non.arpa.": not a reversed ip network`, </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove var subnet *net.IPNet
subnet, err = netutil.SubnetFromReversedAddr(domain)
</s> add var subnet netip.Prefix
subnet, err = extractARPASubnet(domain) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http_test.go |
}, {
name: "partial_good",
wantErr: "",
u: "[/a.1.2.3.10.in-addr.arpa/a.10.in-addr.arpa/]#", | <mask> wantErr: `checking domain-specific upstreams: 2 errors: ` +
<mask> `"arpa domain \"1.2.3.4.in-addr.arpa.\" should point to a locally-served network", ` +
<mask> `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`,
<mask> u: "[/non.arpa/1.2.3.4.in-addr.arpa/127.in-addr.arpa/]#",
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> set := []string{"192.168.0.1", tc.u}
</s> Pull request #1770: 5567-extract-subnet-arpa
Merge in DNS/adguard-home from 5567-extract-subnet-arpa to master
Updates #5567.
Squashed commit of the following:
commit 288fb405b82eff2a95d75f8c557100908a998a08
Merge: e16b3ce5 9f7a582d
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 14:01:39 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit e16b3ce57ba41a9f4a7743dbdb93c2320e650140
Author: Eugene Burkov <[email protected]>
Date: Fri Mar 17 13:58:58 2023 +0300
dnsforward: use netip
commit 265b08c5f82f8df555ab1a5f01c2e9ef8caef64a
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:11:49 2023 +0300
dnsforward: imp tests more
commit 53a839cb6dd924cabf0552386f76aa8775c88983
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 19:09:15 2023 +0300
dnsforward: imp naming in tests
commit 74dcccbdda217422260579e331289003a024695e
Author: Eugene Burkov <[email protected]>
Date: Thu Mar 16 18:59:12 2023 +0300
dnsforward: imp code & tests more
commit da8badfaa75a0a67c10ce6f347e551dcfd4c0589
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:52:48 2023 +0300
all: log changes
commit c491cbfb3fd8d716303224c1f73329a47087753a
Merge: 74a93179 2b5e4850
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:44:31 2023 +0300
Merge branch 'master' into 5567-extract-subnet-arpa
commit 74a93179d7fb7f005455ce02f7f0c16b796c3914
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 15 14:42:55 2023 +0300
dnsforward: imp code, docs
commit 17df1a0ce461335649c6dab65c984eb0cce0bdf0
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 14 19:49:10 2023 +0300
dnsforward: extract subnet from arpa </s> remove `"bad arpa domain name \"non.arpa\": not a reversed ip network"`,
</s> add `"bad arpa domain name \"non.arpa.\": not a reversed ip network"`, </s> remove `bad arpa domain name "hello.world": not a reversed ip network`,
</s> add `bad arpa domain name "hello.world.": not a reversed ip network`, </s> remove `bad arpa domain name "non.arpa": not a reversed ip network`,
</s> add `bad arpa domain name "non.arpa.": not a reversed ip network`, </s> remove if !privateNets.Contains(subnet.IP) {
</s> add if !privateNets.Contains(subnet.Addr().AsSlice()) { </s> remove var subnet *net.IPNet
subnet, err = netutil.SubnetFromReversedAddr(domain)
</s> add var subnet netip.Prefix
subnet, err = extractARPASubnet(domain) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48431f8b86a1e4dde8aebb7539682eb8d043c556 | internal/dnsforward/http_test.go |
sharp := strings.IndexByte(host, '#')
if sharp == 0 {
break // skip the rest of the line after #
} else if sharp > 0 {
host = host[:sharp]
}
| <mask> host := fields[i]
<mask> if len(host) == 0 {
<mask> break
<mask> }
<mask> a.updateTable(table, host, ipAddr)
<mask> a.updateTableRev(tableRev, host, ipAddr)
<mask> if sharp >= 0 {
<mask> break // skip the rest of the line after #
<mask> }
<mask> }
</s> * auto-hosts: support '#' comments after ip and hosts
Close #1807
Squashed commit of the following:
commit 9d3e2809df056354bb6195abf8106616c1e214b1
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 19:23:15 2020 +0300
improve
commit 9b8c7104560c9c80f848f15818d49a065a38e498
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 11:07:56 2020 +0300
* auto-hosts: support '#' comments after ip and hosts </s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
_, _ = f.WriteString(" ::1 localhost \n")
</s> add _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n") | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4870da7f94e040fea63f2ff99bf1b79ee5da457e | util/auto_hosts.go |
if sharp >= 0 {
break // skip the rest of the line after #
} | <mask> a.updateTable(table, host, ipAddr)
<mask> a.updateTableRev(tableRev, host, ipAddr)
<mask> }
<mask> }
<mask> }
<mask>
<mask> // Receive notifications from fsnotify package
</s> * auto-hosts: support '#' comments after ip and hosts
Close #1807
Squashed commit of the following:
commit 9d3e2809df056354bb6195abf8106616c1e214b1
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 19:23:15 2020 +0300
improve
commit 9b8c7104560c9c80f848f15818d49a065a38e498
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 11:07:56 2020 +0300
* auto-hosts: support '#' comments after ip and hosts </s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
_, _ = f.WriteString(" ::1 localhost \n")
</s> add _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n") | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4870da7f94e040fea63f2ff99bf1b79ee5da457e | util/auto_hosts.go |
_, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n") | <mask> f, _ := ioutil.TempFile(dir, "")
<mask> defer func() { _ = os.Remove(f.Name()) }()
<mask> defer f.Close()
<mask>
<mask> _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
<mask> _, _ = f.WriteString(" ::1 localhost \n")
<mask>
<mask> ah.Init(f.Name())
<mask>
<mask> // Update from the hosts file
<mask> ah.updateHosts()
</s> * auto-hosts: support '#' comments after ip and hosts
Close #1807
Squashed commit of the following:
commit 9d3e2809df056354bb6195abf8106616c1e214b1
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 19:23:15 2020 +0300
improve
commit 9b8c7104560c9c80f848f15818d49a065a38e498
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 11:07:56 2020 +0300
* auto-hosts: support '#' comments after ip and hosts | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4870da7f94e040fea63f2ff99bf1b79ee5da457e | util/auto_hosts_test.go |
// Unknown host (comment)
ips = ah.Process("comment", dns.TypeA)
assert.Nil(t, ips)
| <mask> ips = ah.Process("newhost", dns.TypeA)
<mask> assert.Nil(t, ips)
<mask>
<mask> // Test hosts file
<mask> table := ah.List()
<mask> name, ok := table["127.0.0.1"]
<mask> assert.True(t, ok)
</s> * auto-hosts: support '#' comments after ip and hosts
Close #1807
Squashed commit of the following:
commit 9d3e2809df056354bb6195abf8106616c1e214b1
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 19:23:15 2020 +0300
improve
commit 9b8c7104560c9c80f848f15818d49a065a38e498
Author: Simon Zolin <[email protected]>
Date: Wed Jun 17 11:07:56 2020 +0300
* auto-hosts: support '#' comments after ip and hosts </s> remove _, _ = f.WriteString(" 127.0.0.1 host localhost \n")
_, _ = f.WriteString(" ::1 localhost \n")
</s> add _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n")
_, _ = f.WriteString(" ::1 localhost#comment \n") | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4870da7f94e040fea63f2ff99bf1b79ee5da457e | util/auto_hosts_test.go |
log.Debug("%s: handling the request for %s", hostsContainerPrefix, req.Hostname) | <mask> req *urlfilter.DNSRequest,
<mask> ) (res *urlfilter.DNSResult, ok bool) {
<mask> switch req.DNSType {
<mask> case dns.TypeA, dns.TypeAAAA, dns.TypePTR:
<mask> log.Debug("%s: handling the request for %s", hostsContainerPref, req.Hostname)
<mask> default:
<mask> return nil, false
<mask> }
<mask>
<mask> rm.stateLock.RLock()
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove ok, eventsCh := true, hc.w.Events()
</s> add ok, eventsCh := true, hc.watcher.Events() </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
// hostsContainerPrefix is a prefix for logging and wrapping errors in | <mask>
<mask> rm.translator = tr
<mask> }
<mask>
<mask> // hostsContainerPref is a prefix for logging and wrapping errors in
<mask> // HostsContainer's methods.
<mask> const hostsContainerPref = "hosts container"
<mask>
<mask> // HostsContainer stores the relevant hosts database provided by the OS and
<mask> // processes both A/AAAA and PTR DNS requests for those.
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove // w tracks the changes in specified files and directories.
w aghos.FSWatcher
</s> add // watcher tracks the changes in specified files and directories.
watcher aghos.FSWatcher </s> remove // Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil.
</s> add // Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove // etcHosts is an IP-hostname pairs set taken from system configuration
// (e.g. /etc/hosts) files.
</s> add // etcHosts contains IP-hostname mappings taken from the OS-specific hosts
// configuration files, for example /etc/hosts. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
const hostsContainerPrefix = "hosts container" | <mask> }
<mask>
<mask> // hostsContainerPref is a prefix for logging and wrapping errors in
<mask> // HostsContainer's methods.
<mask> const hostsContainerPref = "hosts container"
<mask>
<mask> // HostsContainer stores the relevant hosts database provided by the OS and
<mask> // processes both A/AAAA and PTR DNS requests for those.
<mask> type HostsContainer struct {
<mask> // requestMatcher matches the requests and translates the rules. It's
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in </s> remove // w tracks the changes in specified files and directories.
w aghos.FSWatcher
</s> add // watcher tracks the changes in specified files and directories.
watcher aghos.FSWatcher </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) </s> remove // Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil.
</s> add // Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
// watcher tracks the changes in specified files and directories.
watcher aghos.FSWatcher | <mask>
<mask> // fsys is the working file system to read hosts files from.
<mask> fsys fs.FS
<mask>
<mask> // w tracks the changes in specified files and directories.
<mask> w aghos.FSWatcher
<mask>
<mask> // patterns stores specified paths in the fs.Glob-compatible form.
<mask> patterns []string
<mask>
<mask> // listID is the identifier for the list of generated rules.
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // hostsWatcher is the watcher to detect changes in the hosts files.
hostsWatcher aghos.FSWatcher
</s> add </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove // etcHosts is an IP-hostname pairs set taken from system configuration
// (e.g. /etc/hosts) files.
</s> add // etcHosts contains IP-hostname mappings taken from the OS-specific hosts
// configuration files, for example /etc/hosts. </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in </s> remove transport *http.Transport
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() | <mask> fsys fs.FS,
<mask> w aghos.FSWatcher,
<mask> paths ...string,
<mask> ) (hc *HostsContainer, err error) {
<mask> defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
<mask>
<mask> if len(paths) == 0 {
<mask> return nil, ErrNoHostsPaths
<mask> }
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { </s> remove Context.hostsWatcher,
</s> add hostsWatcher, </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
watcher: w, | <mask> listID: listID,
<mask> done: make(chan struct{}, 1),
<mask> updates: make(chan HostsRecords, 1),
<mask> fsys: fsys,
<mask> w: w,
<mask> patterns: patterns,
<mask> }
<mask>
<mask> log.Debug("%s: starting", hostsContainerPref)
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove log.Debug("%s: no changes detected", hostsContainerPref)
</s> add log.Debug("%s: no changes detected", hostsContainerPrefix) </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Debug("%s: starting", hostsContainerPrefix) | <mask> w: w,
<mask> patterns: patterns,
<mask> }
<mask>
<mask> log.Debug("%s: starting", hostsContainerPref)
<mask>
<mask> // Load initially.
<mask> if err = hc.refresh(); err != nil {
<mask> return nil, err
<mask> }
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove w: w,
</s> add watcher: w, </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Debug("%s: %s is expected to exist but doesn't", hostsContainerPrefix, p) | <mask> if !errors.Is(err, fs.ErrNotExist) {
<mask> return nil, fmt.Errorf("adding path: %w", err)
<mask> }
<mask>
<mask> log.Debug("%s: %s is expected to exist but doesn't", hostsContainerPref, p)
<mask> }
<mask> }
<mask>
<mask> go hc.handleEvents()
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() </s> remove log.Debug("%s: handling the request for %s", hostsContainerPref, req.Hostname)
</s> add log.Debug("%s: handling the request for %s", hostsContainerPrefix, req.Hostname) </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
// Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. | <mask>
<mask> return hc, nil
<mask> }
<mask>
<mask> // Close implements the io.Closer interface for *HostsContainer. Close must
<mask> // only be called once. The returned err is always nil.
<mask> func (hc *HostsContainer) Close() (err error) {
<mask> log.Debug("%s: closing", hostsContainerPref)
<mask>
<mask> close(hc.done)
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove return nil
</s> add return err </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} | <mask>
<mask> // Close implements the io.Closer interface for *HostsContainer. Close must
<mask> // only be called once. The returned err is always nil.
<mask> func (hc *HostsContainer) Close() (err error) {
<mask> log.Debug("%s: closing", hostsContainerPref)
<mask>
<mask> close(hc.done)
<mask>
<mask> return nil
<mask> }
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil.
</s> add // Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. </s> remove return nil
</s> add return err </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
return err | <mask> log.Debug("%s: closing", hostsContainerPref)
<mask>
<mask> close(hc.done)
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // Upd returns the channel into which the updates are sent.
<mask> func (hc *HostsContainer) Upd() (updates <-chan HostsRecords) {
<mask> return hc.updates
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove // Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil.
</s> add // Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) </s> remove log.Debug("%s: sending upd", hostsContainerPref)
</s> add log.Debug("%s: sending upd", hostsContainerPrefix) </s> remove log.Debug("%s: replaced the last update", hostsContainerPref)
</s> add log.Debug("%s: replaced the last update", hostsContainerPrefix) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) | <mask> // handleEvents concurrently handles the file system events. It closes the
<mask> // update channel of HostsContainer when finishes. It's used to be called
<mask> // within a separate goroutine.
<mask> func (hc *HostsContainer) handleEvents() {
<mask> defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
<mask>
<mask> defer close(hc.updates)
<mask>
<mask> ok, eventsCh := true, hc.w.Events()
<mask> for ok {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove ok, eventsCh := true, hc.w.Events()
</s> add ok, eventsCh := true, hc.watcher.Events() </s> remove // Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil.
</s> add // Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove transport *http.Transport
</s> add </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
ok, eventsCh := true, hc.watcher.Events() | <mask> defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
<mask>
<mask> defer close(hc.updates)
<mask>
<mask> ok, eventsCh := true, hc.w.Events()
<mask> for ok {
<mask> select {
<mask> case _, ok = <-eventsCh:
<mask> if !ok {
<mask> log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) </s> remove log.Debug("%s: handling the request for %s", hostsContainerPref, req.Hostname)
</s> add log.Debug("%s: handling the request for %s", hostsContainerPrefix, req.Hostname) </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) | <mask> for ok {
<mask> select {
<mask> case _, ok = <-eventsCh:
<mask> if !ok {
<mask> log.Debug("%s: watcher closed the events channel", hostsContainerPref)
<mask>
<mask> continue
<mask> }
<mask>
<mask> if err := hc.refresh(); err != nil {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove ok, eventsCh := true, hc.w.Events()
</s> add ok, eventsCh := true, hc.watcher.Events() </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) </s> remove log.Debug("%s: handling the request for %s", hostsContainerPref, req.Hostname)
</s> add log.Debug("%s: handling the request for %s", hostsContainerPrefix, req.Hostname) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Error("%s: %s", hostsContainerPrefix, err) | <mask> continue
<mask> }
<mask>
<mask> if err := hc.refresh(); err != nil {
<mask> log.Error("%s: %s", hostsContainerPref, err)
<mask> }
<mask> case _, ok = <-hc.done:
<mask> // Go on.
<mask> }
<mask> }
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f)
</s> add log.Error("%s: host %q is invalid, ignoring", hostsContainerPrefix, f) </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Error("%s: host %q is invalid, ignoring", hostsContainerPrefix, f) | <mask> //
<mask> // TODO(e.burkov): Investigate if hosts may contain DNS-SD domains.
<mask> err = netutil.ValidateHostname(f)
<mask> if err != nil {
<mask> log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f)
<mask>
<mask> continue
<mask> }
<mask>
<mask> hosts = append(hosts, f)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Debug("%s: added ip-host pair %q-%q", hostsContainerPrefix, ip, host) | <mask> func (hp *hostsParser) addRules(ip netip.Addr, host, line string) {
<mask> rule, rulePtr := hp.writeRules(host, ip)
<mask> hp.translations[rule], hp.translations[rulePtr] = line, line
<mask>
<mask> log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, host)
<mask> }
<mask>
<mask> // writeRules writes the actual rule for the qtype and the PTR for the host-ip
<mask> // pair into internal builders.
<mask> func (hp *hostsParser) writeRules(host string, ip netip.Addr) (rule, rulePtr string) {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: sending upd", hostsContainerPref)
</s> add log.Debug("%s: sending upd", hostsContainerPrefix) </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove return nil
</s> add return err </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Debug("%s: sending upd", hostsContainerPrefix) | <mask> }
<mask>
<mask> // sendUpd tries to send the parsed data to the ch.
<mask> func (hp *hostsParser) sendUpd(ch chan HostsRecords) {
<mask> log.Debug("%s: sending upd", hostsContainerPref)
<mask>
<mask> upd := hp.table
<mask> select {
<mask> case ch <- upd:
<mask> // Updates are delivered. Go on.
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: replaced the last update", hostsContainerPref)
</s> add log.Debug("%s: replaced the last update", hostsContainerPrefix) </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) </s> remove return nil
</s> add return err </s> remove log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, host)
</s> add log.Debug("%s: added ip-host pair %q-%q", hostsContainerPrefix, ip, host) </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Debug("%s: replaced the last update", hostsContainerPrefix) | <mask> case ch <- upd:
<mask> // Updates are delivered. Go on.
<mask> case <-ch:
<mask> ch <- upd
<mask> log.Debug("%s: replaced the last update", hostsContainerPref)
<mask> case ch <- upd:
<mask> // The previous update was just read and the next one pushed. Go on.
<mask> default:
<mask> log.Error("%s: the updates channel is broken", hostsContainerPref)
<mask> }
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: the updates channel is broken", hostsContainerPref)
</s> add log.Error("%s: the updates channel is broken", hostsContainerPrefix) </s> remove log.Debug("%s: sending upd", hostsContainerPref)
</s> add log.Debug("%s: sending upd", hostsContainerPrefix) </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove return nil
</s> add return err </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Error("%s: the updates channel is broken", hostsContainerPrefix) | <mask> log.Debug("%s: replaced the last update", hostsContainerPref)
<mask> case ch <- upd:
<mask> // The previous update was just read and the next one pushed. Go on.
<mask> default:
<mask> log.Error("%s: the updates channel is broken", hostsContainerPref)
<mask> }
<mask> }
<mask>
<mask> // newStrg creates a new rules storage from parsed data.
<mask> func (hp *hostsParser) newStrg(id int) (s *filterlist.RuleStorage, err error) {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: replaced the last update", hostsContainerPref)
</s> add log.Debug("%s: replaced the last update", hostsContainerPrefix) </s> remove log.Debug("%s: sending upd", hostsContainerPref)
</s> add log.Debug("%s: sending upd", hostsContainerPrefix) </s> remove return nil
</s> add return err </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Debug("%s: refreshing", hostsContainerPrefix) | <mask> // needed.
<mask> //
<mask> // TODO(e.burkov): Accept a parameter to specify the files to refresh.
<mask> func (hc *HostsContainer) refresh() (err error) {
<mask> log.Debug("%s: refreshing", hostsContainerPref)
<mask>
<mask> hp := hc.newHostsParser()
<mask> if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil {
<mask> return fmt.Errorf("refreshing : %w", err)
<mask> }
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove return nil
</s> add return err </s> remove // Close implements the io.Closer interface for *HostsContainer. Close must
// only be called once. The returned err is always nil.
</s> add // Close implements the [io.Closer] interface for *HostsContainer. It closes
// both itself and its [aghos.FSWatcher]. Close must only be called once. </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
log.Debug("%s: no changes detected", hostsContainerPrefix) | <mask> }
<mask>
<mask> // hc.last is nil on the first refresh, so let that one through.
<mask> if hc.last != nil && maps.EqualFunc(hp.table, hc.last, (*HostsRecord).equal) {
<mask> log.Debug("%s: no changes detected", hostsContainerPref)
<mask>
<mask> return nil
<mask> }
<mask> defer hp.sendUpd(hc.updates)
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Debug("%s: starting", hostsContainerPref)
</s> add log.Debug("%s: starting", hostsContainerPrefix) </s> remove Context.hostsWatcher,
</s> add hostsWatcher, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer.go |
OnClose: func() (err error) { return nil }, | <mask>
<mask> hc, err := NewHostsContainer(0, testFS, &aghtest.FSWatcher{
<mask> OnEvents: onEvents,
<mask> OnAdd: onAdd,
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }, tc.paths...)
<mask> if tc.wantErr != nil {
<mask> require.ErrorIs(t, err, tc.wantErr)
<mask>
<mask> assert.Nil(t, hc)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove Timeout: time.Minute * 5,
Transport: Context.transport,
</s> add Timeout: time.Minute * 5,
Transport: &http.Transport{
DialContext: customDialContext,
Proxy: getHTTPProxy,
TLSClientConfig: &tls.Config{
RootCAs: Context.tlsRoots,
CipherSuites: Context.tlsCipherIDs,
MinVersion: tls.VersionTLS12,
},
}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
OnClose: func() (err error) { return nil }, | <mask>
<mask> errWatcher := &aghtest.FSWatcher{
<mask> OnEvents: func() (e <-chan struct{}) { panic("not implemented") },
<mask> OnAdd: func(name string) (err error) { return errOnAdd },
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }
<mask>
<mask> hc, err := NewHostsContainer(0, testFS, errWatcher, p)
<mask> require.ErrorIs(t, err, errOnAdd)
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
OnClose: func() (err error) { return nil }, | <mask> assert.Equal(t, "dir", name)
<mask>
<mask> return nil
<mask> },
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }
<mask>
<mask> hc, err := NewHostsContainer(0, testFS, w, "dir")
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, hc.Close)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove Timeout: time.Minute * 5,
Transport: Context.transport,
</s> add Timeout: time.Minute * 5,
Transport: &http.Transport{
DialContext: customDialContext,
Proxy: getHTTPProxy,
TLSClientConfig: &tls.Config{
RootCAs: Context.tlsRoots,
CipherSuites: Context.tlsCipherIDs,
MinVersion: tls.VersionTLS12,
},
}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
OnClose: func() (err error) { return nil }, | <mask> func TestHostsContainer_Translate(t *testing.T) {
<mask> stubWatcher := aghtest.FSWatcher{
<mask> OnEvents: func() (e <-chan struct{}) { return nil },
<mask> OnAdd: func(name string) (err error) { return nil },
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }
<mask>
<mask> require.NoError(t, fstest.TestFS(testdata, "etc_hosts"))
<mask>
<mask> hc, err := NewHostsContainer(0, testdata, &stubWatcher, "etc_hosts")
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
OnClose: func() (err error) { return nil }, | <mask>
<mask> stubWatcher := aghtest.FSWatcher{
<mask> OnEvents: func() (e <-chan struct{}) { return nil },
<mask> OnAdd: func(name string) (err error) { return nil },
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }
<mask>
<mask> hc, err := NewHostsContainer(listID, testdata, &stubWatcher, "etc_hosts")
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, hc.Close)
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/aghnet/hostscontainer_test.go |
// etcHosts contains IP-hostname mappings taken from the OS-specific hosts
// configuration files, for example /etc/hosts. | <mask> auth *Auth // HTTP authentication module
<mask> filters *filtering.DNSFilter // DNS filtering module
<mask> web *Web // Web (HTTP, HTTPS) module
<mask> tls *tlsManager // TLS module
<mask> // etcHosts is an IP-hostname pairs set taken from system configuration
<mask> // (e.g. /etc/hosts) files.
<mask> etcHosts *aghnet.HostsContainer
<mask> // hostsWatcher is the watcher to detect changes in the hosts files.
<mask> hostsWatcher aghos.FSWatcher
<mask>
<mask> updater *updater.Updater
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // hostsWatcher is the watcher to detect changes in the hosts files.
hostsWatcher aghos.FSWatcher
</s> add </s> remove // w tracks the changes in specified files and directories.
w aghos.FSWatcher
</s> add // watcher tracks the changes in specified files and directories.
watcher aghos.FSWatcher </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
<mask> tls *tlsManager // TLS module
<mask> // etcHosts is an IP-hostname pairs set taken from system configuration
<mask> // (e.g. /etc/hosts) files.
<mask> etcHosts *aghnet.HostsContainer
<mask> // hostsWatcher is the watcher to detect changes in the hosts files.
<mask> hostsWatcher aghos.FSWatcher
<mask>
<mask> updater *updater.Updater
<mask>
<mask> // mux is our custom http.ServeMux.
<mask> mux *http.ServeMux
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // etcHosts is an IP-hostname pairs set taken from system configuration
// (e.g. /etc/hosts) files.
</s> add // etcHosts contains IP-hostname mappings taken from the OS-specific hosts
// configuration files, for example /etc/hosts. </s> remove // w tracks the changes in specified files and directories.
w aghos.FSWatcher
</s> add // watcher tracks the changes in specified files and directories.
watcher aghos.FSWatcher </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
|
<mask> workDir string // Location of our directory, used to protect against CWD being somewhere else
<mask> pidFileName string // PID file name. Empty if no PID file was created.
<mask> controlLock sync.Mutex
<mask> tlsRoots *x509.CertPool // list of root CAs for TLSv1.2
<mask> transport *http.Transport
<mask> client *http.Client
<mask> appSignalChannel chan os.Signal // Channel for receiving OS signals by the console app
<mask>
<mask> // tlsCipherIDs are the ID of the cipher suites that AdGuard Home must use.
<mask> tlsCipherIDs []uint16
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // w tracks the changes in specified files and directories.
w aghos.FSWatcher
</s> add // watcher tracks the changes in specified files and directories.
watcher aghos.FSWatcher </s> remove defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPref))
</s> add defer log.OnPanic(fmt.Sprintf("%s: handling events", hostsContainerPrefix)) </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" </s> remove // hostsContainerPref is a prefix for logging and wrapping errors in
</s> add // hostsContainerPrefix is a prefix for logging and wrapping errors in | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
|
<mask> func setupContext(opts options) {
<mask> setupContextFlags(opts)
<mask>
<mask> Context.tlsRoots = aghtls.SystemRootCAs()
<mask> Context.transport = &http.Transport{
<mask> DialContext: customDialContext,
<mask> Proxy: getHTTPProxy,
<mask> TLSClientConfig: &tls.Config{
<mask> RootCAs: Context.tlsRoots,
<mask> CipherSuites: Context.tlsCipherIDs,
<mask> MinVersion: tls.VersionTLS12,
<mask> },
<mask> }
<mask> Context.client = &http.Client{
<mask> Timeout: time.Minute * 5,
<mask> Transport: Context.transport,
<mask> }
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove Timeout: time.Minute * 5,
Transport: Context.transport,
</s> add Timeout: time.Minute * 5,
Transport: &http.Transport{
DialContext: customDialContext,
Proxy: getHTTPProxy,
TLSClientConfig: &tls.Config{
RootCAs: Context.tlsRoots,
CipherSuites: Context.tlsCipherIDs,
MinVersion: tls.VersionTLS12,
},
}, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, </s> remove OnClose: func() (err error) { panic("not implemented") },
</s> add OnClose: func() (err error) { return nil }, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
|
Timeout: time.Minute * 5,
Transport: &http.Transport{
DialContext: customDialContext,
Proxy: getHTTPProxy,
TLSClientConfig: &tls.Config{
RootCAs: Context.tlsRoots,
CipherSuites: Context.tlsCipherIDs,
MinVersion: tls.VersionTLS12,
},
}, | <mask> MinVersion: tls.VersionTLS12,
<mask> },
<mask> }
<mask> Context.client = &http.Client{
<mask> Timeout: time.Minute * 5,
<mask> Transport: Context.transport,
<mask> }
<mask>
<mask> if !Context.firstRun {
<mask> // Do the upgrade if necessary.
<mask> err := upgradeConfig()
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove Context.transport = &http.Transport{
DialContext: customDialContext,
Proxy: getHTTPProxy,
TLSClientConfig: &tls.Config{
RootCAs: Context.tlsRoots,
CipherSuites: Context.tlsCipherIDs,
MinVersion: tls.VersionTLS12,
},
}
</s> add </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
hostsWatcher, err := aghos.NewOSWritesWatcher() | <mask>
<mask> // setupHostsContainer initializes the structures to keep up-to-date the hosts
<mask> // provided by the OS.
<mask> func setupHostsContainer() (err error) {
<mask> Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
<mask> if err != nil {
<mask> return fmt.Errorf("initing hosts watcher: %w", err)
<mask> }
<mask>
<mask> Context.etcHosts, err = aghnet.NewHostsContainer(
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove log.Debug("%s: refreshing", hostsContainerPref)
</s> add log.Debug("%s: refreshing", hostsContainerPrefix) </s> remove Context.hostsWatcher,
</s> add hostsWatcher, </s> remove const hostsContainerPref = "hosts container"
</s> add const hostsContainerPrefix = "hosts container" | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
hostsWatcher, | <mask>
<mask> Context.etcHosts, err = aghnet.NewHostsContainer(
<mask> filtering.SysHostsListID,
<mask> aghos.RootDirFS(),
<mask> Context.hostsWatcher,
<mask> aghnet.DefaultHostsPaths()...,
<mask> )
<mask> if err != nil {
<mask> cerr := Context.hostsWatcher.Close()
<mask> if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPref) }()
</s> add defer func() { err = errors.Annotate(err, "%s: %w", hostsContainerPrefix) }() </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Debug("%s: watcher closed the events channel", hostsContainerPref)
</s> add log.Debug("%s: watcher closed the events channel", hostsContainerPrefix) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { | <mask> Context.hostsWatcher,
<mask> aghnet.DefaultHostsPaths()...,
<mask> )
<mask> if err != nil {
<mask> cerr := Context.hostsWatcher.Close()
<mask> if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
<mask> log.Info("warning: initing hosts container: %s", err)
<mask>
<mask> return nil
<mask> }
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove Context.hostsWatcher,
</s> add hostsWatcher, </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove return errors.WithDeferred(fmt.Errorf("initing hosts container: %w", err), cerr)
</s> add return errors.WithDeferred(fmt.Errorf("initing hosts container: %w", err), closeErr) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
return errors.WithDeferred(fmt.Errorf("initing hosts container: %w", err), closeErr) | <mask>
<mask> return nil
<mask> }
<mask>
<mask> return errors.WithDeferred(fmt.Errorf("initing hosts container: %w", err), cerr)
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove // Currently Context.hostsWatcher is only used in Context.etcHosts and
// needs closing only in case of the successful initialization of
// Context.etcHosts.
if err = Context.hostsWatcher.Close(); err != nil {
log.Error("closing hosts watcher: %s", err)
}
</s> add </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove log.Debug("%s: no changes detected", hostsContainerPref)
</s> add log.Debug("%s: no changes detected", hostsContainerPrefix) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
<mask> }
<mask> }
<mask>
<mask> if Context.etcHosts != nil {
<mask> // Currently Context.hostsWatcher is only used in Context.etcHosts and
<mask> // needs closing only in case of the successful initialization of
<mask> // Context.etcHosts.
<mask> if err = Context.hostsWatcher.Close(); err != nil {
<mask> log.Error("closing hosts watcher: %s", err)
<mask> }
<mask>
<mask> if err = Context.etcHosts.Close(); err != nil {
<mask> log.Error("closing hosts container: %s", err)
<mask> }
<mask> }
<mask>
</s> Pull request 1786: rm-context-fields
Merge in DNS/adguard-home from rm-context-fields to master
Squashed commit of the following:
commit 402bbba6a68f163cd6a3751a50ecd544eebc875f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:07:11 2023 +0300
aghnet: names
commit 209a2bb7878ee9110595f1fcf09df7f83777b80f
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:03:33 2023 +0300
home: typo
commit 61684815c260d5d7a34be612e06714456399a833
Merge: 7adfcf15 132ec556
Author: Ainar Garipov <[email protected]>
Date: Tue Mar 28 13:02:18 2023 +0300
Merge branch 'master' into rm-context-fields
commit 7adfcf1576b52f80137aa9044355bfbec6243e28
Merge: 0d5b85f5 0df32601
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 14:25:27 2023 +0300
Merge branch 'master' into rm-context-fields
commit 0d5b85f51b3eb72c3e905d5ad82c17cd932b246b
Author: Ainar Garipov <[email protected]>
Date: Sun Mar 26 13:21:26 2023 +0300
all: rm unnecessary home context fields </s> remove log.Error("%s: %s", hostsContainerPref, err)
</s> add log.Error("%s: %s", hostsContainerPrefix, err) </s> remove log.Debug("%s: closing", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPrefix)
err = hc.watcher.Close()
if err != nil {
err = fmt.Errorf("closing fs watcher: %w", err)
// Go on and close the container either way.
} </s> remove cerr := Context.hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && cerr == nil {
</s> add closeErr := hostsWatcher.Close()
if errors.Is(err, aghnet.ErrNoHostsPaths) && closeErr == nil { </s> remove Context.hostsWatcher, err = aghos.NewOSWritesWatcher()
</s> add hostsWatcher, err := aghos.NewOSWritesWatcher() </s> remove log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f)
</s> add log.Error("%s: host %q is invalid, ignoring", hostsContainerPrefix, f) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/487675b9adc1be7f725f763060e90720da32b852 | internal/home/home.go |
|
// MaxDomainNameLen is the maximum allowed length of a full domain name | <mask> // maxDomainLabelLen is the maximum allowed length of a domain name label
<mask> // according to RFC 1035.
<mask> const maxDomainLabelLen = 63
<mask>
<mask> // maxDomainNameLen is the maximum allowed length of a full domain name
<mask> // according to RFC 1035.
<mask> //
<mask> // See https://stackoverflow.com/a/32294443/1892060.
<mask> const maxDomainNameLen = 253
<mask>
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove const maxDomainNameLen = 253
</s> add const MaxDomainNameLen = 253 </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/aghnet/addr.go |
const MaxDomainNameLen = 253 | <mask> // maxDomainNameLen is the maximum allowed length of a full domain name
<mask> // according to RFC 1035.
<mask> //
<mask> // See https://stackoverflow.com/a/32294443/1892060.
<mask> const maxDomainNameLen = 253
<mask>
<mask> // ValidateDomainNameLabel returns an error if label is not a valid label of
<mask> // a domain name.
<mask> func ValidateDomainNameLabel(label string) (err error) {
<mask> defer func() { err = errors.Annotate(err, "validating label %q: %w", label) }()
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove // maxDomainNameLen is the maximum allowed length of a full domain name
</s> add // MaxDomainNameLen is the maximum allowed length of a full domain name </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/aghnet/addr.go |
} else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) | <mask>
<mask> l := len(name)
<mask> if l == 0 {
<mask> return errors.Error("domain name is empty")
<mask> } else if l > maxDomainNameLen {
<mask> return fmt.Errorf("too long, max: %d", maxDomainNameLen)
<mask> }
<mask>
<mask> labels := strings.Split(name, ".")
<mask> for i, l := range labels {
<mask> err = ValidateDomainNameLabel(l)
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/aghnet/addr.go |
s.processRecursion, | <mask> // out of range checking in any of the following functions, because the
<mask> // (*proxy.Proxy).handleDNSRequest method performs it before calling the
<mask> // appropriate handler.
<mask> mods := []modProcessFunc{
<mask> processInitial,
<mask> s.processDetermineLocal,
<mask> s.processInternalHosts,
<mask> s.processRestrictLocal,
<mask> s.processInternalIPAddrs,
<mask> processClientID,
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove // maxDomainNameLen is the maximum allowed length of a full domain name
</s> add // MaxDomainNameLen is the maximum allowed length of a full domain name </s> remove processUpstream,
</s> add s.processUpstream, </s> remove const maxDomainNameLen = 253
</s> add const MaxDomainNameLen = 253 | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
s.processUpstream, | <mask> s.processInternalIPAddrs,
<mask> processClientID,
<mask> processFilteringBeforeRequest,
<mask> s.processLocalPTR,
<mask> processUpstream,
<mask> processDNSSECAfterResponse,
<mask> processFilteringAfterResponse,
<mask> s.ipset.process,
<mask> processQueryLogsAndStats,
<mask> }
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
// processRecursion checks the incoming request and halts it's handling if s
// have tried to resolve it recently.
func (s *Server) processRecursion(dctx *dnsContext) (rc resultCode) {
pctx := dctx.proxyCtx
if msg := pctx.Req; msg != nil && s.recDetector.check(*msg) {
log.Debug("recursion detected resolving %q", msg.Question[0].Name)
pctx.Res = s.genNXDomain(pctx.Req)
return resultCodeFinish
}
return resultCodeSuccess
}
| <mask> return nil
<mask> }
<mask>
<mask> // Perform initial checks; process WHOIS & rDNS
<mask> func processInitial(ctx *dnsContext) (rc resultCode) {
<mask> s := ctx.srv
<mask> d := ctx.proxyCtx
<mask> if s.conf.AAAADisabled && d.Req.Question[0].Qtype == dns.TypeAAAA {
<mask> _ = proxy.CheckDisabledAAAARequest(d, true)
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
s.recDetector.add(*d.Req) | <mask> }
<mask>
<mask> if s.conf.UsePrivateRDNS {
<mask> if err := s.localResolvers.Resolve(d); err != nil {
<mask> ctx.err = err
<mask>
<mask> return resultCodeError
<mask> }
<mask> }
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { </s> remove var resp *dns.Msg
err = resolver.Resolve(ctx)
if err != nil {
</s> add s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { | <mask> return resultCodeSuccess
<mask> }
<mask>
<mask> // processUpstream passes request to upstream servers and handles the response.
<mask> func processUpstream(ctx *dnsContext) (rc resultCode) {
<mask> s := ctx.srv
<mask> d := ctx.proxyCtx
<mask> if d.Res != nil {
<mask> return resultCodeSuccess // response is already set - nothing to do
<mask> }
<mask>
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf | <mask> }
<mask>
<mask> if d.Addr != nil && s.conf.GetCustomUpstreamByClient != nil {
<mask> clientIP := IPStringFromAddr(d.Addr)
<mask> upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
<mask> if upstreamsConf != nil {
<mask> log.Debug("Using custom upstreams for %s", clientIP)
<mask> d.CustomUpstreamConfig = upstreamsConf
<mask> }
<mask> }
<mask>
<mask> if s.conf.EnableDNSSEC {
<mask> opt := d.Req.IsEdns0()
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) </s> remove resp = ctx.Res
</s> add resp := ctx.Res | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
req := d.Req | <mask> }
<mask> }
<mask>
<mask> if s.conf.EnableDNSSEC {
<mask> opt := req.IsEdns0()
<mask> if opt == nil {
<mask> log.Debug("dns: adding OPT record with DNSSEC flag")
<mask> req.SetEdns0(4096, true)
<mask> } else if !opt.Do() {
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
opt := req.IsEdns0() | <mask> }
<mask> }
<mask>
<mask> if s.conf.EnableDNSSEC {
<mask> opt := d.Req.IsEdns0()
<mask> if opt == nil {
<mask> log.Debug("dns: Adding OPT record with DNSSEC flag")
<mask> d.Req.SetEdns0(4096, true)
<mask> } else if !opt.Do() {
<mask> opt.SetDo(true)
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) | <mask>
<mask> if s.conf.EnableDNSSEC {
<mask> opt := d.Req.IsEdns0()
<mask> if opt == nil {
<mask> log.Debug("dns: Adding OPT record with DNSSEC flag")
<mask> d.Req.SetEdns0(4096, true)
<mask> } else if !opt.Do() {
<mask> opt.SetDo(true)
<mask> } else {
<mask> ctx.origReqDNSSEC = true
<mask> }
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove opt := d.Req.IsEdns0()
</s> add opt := req.IsEdns0() </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { | <mask> }
<mask> }
<mask>
<mask> // request was not filtered so let it be processed further
<mask> err := s.dnsProxy.Resolve(d)
<mask> if err != nil {
<mask> ctx.err = err
<mask> return resultCodeError
<mask> }
<mask>
<mask> ctx.responseFromUpstream = true
<mask> return resultCodeSuccess
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove var resp *dns.Msg
err = resolver.Resolve(ctx)
if err != nil {
</s> add s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dns.go |
recDetector *recursionDetector | <mask> ipset ipsetCtx
<mask> subnetDetector *aghnet.SubnetDetector
<mask> localResolvers *proxy.Proxy
<mask>
<mask> tableHostToIP hostToIPTable
<mask> tableHostToIPLock sync.Mutex
<mask>
<mask> tableIPToHost ipToHostTable
<mask> tableIPToHostLock sync.Mutex
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove const maxDomainNameLen = 253
</s> add const MaxDomainNameLen = 253 </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
const (
// recursionTTL is the time recursive request is cached for.
recursionTTL = 5 * time.Second
// cachedRecurrentReqNum is the maximum number of cached recurrent
// requests.
cachedRecurrentReqNum = 1000
)
| <mask>
<mask> return string(b)
<mask> }
<mask>
<mask> // NewServer creates a new instance of the dnsforward.Server
<mask> // Note: this function must be called only once
<mask> func NewServer(p DNSCreateParams) (s *Server, err error) {
<mask> var localDomainSuffix string
<mask> if p.LocalDomain == "" {
<mask> localDomainSuffix = defaultLocalDomainSuffix
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} </s> remove const maxDomainNameLen = 253
</s> add const MaxDomainNameLen = 253 </s> remove var resp *dns.Msg
err = resolver.Resolve(ctx)
if err != nil {
</s> add s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
recDetector: newRecursionDetector(recursionTTL, cachedRecurrentReqNum), | <mask> queryLog: p.QueryLog,
<mask> subnetDetector: p.SubnetDetector,
<mask> localDomainSuffix: localDomainSuffix,
<mask> }
<mask>
<mask> if p.DHCPServer != nil {
<mask> s.dhcpServer = p.DHCPServer
<mask> s.dhcpServer.SetOnLeaseChanged(s.onDHCPLeaseChanged)
<mask> s.onDHCPLeaseChanged(dhcpd.LeaseChangedAdded)
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove var resp *dns.Msg
err = resolver.Resolve(ctx)
if err != nil {
</s> add s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { </s> remove resp = ctx.Res
</s> add resp := ctx.Res | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
s := &Server{
recDetector: newRecursionDetector(0, 1),
} | <mask> }
<mask>
<mask> // NewCustomServer creates a new instance of *Server with custom internal proxy.
<mask> func NewCustomServer(internalProxy *proxy.Proxy) *Server {
<mask> s := &Server{}
<mask> if internalProxy != nil {
<mask> s.internalProxy = internalProxy
<mask> }
<mask>
<mask> return s
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { </s> remove log.Debug("dns: Adding OPT record with DNSSEC flag")
d.Req.SetEdns0(4096, true)
</s> add log.Debug("dns: adding OPT record with DNSSEC flag")
req.SetEdns0(4096, true) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { | <mask> Proto: "udp",
<mask> Req: req,
<mask> StartTime: time.Now(),
<mask> }
<mask> var resp *dns.Msg
<mask> err = resolver.Resolve(ctx)
<mask> if err != nil {
<mask> return "", err
<mask> }
<mask>
<mask> resp = ctx.Res
<mask>
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
resp := ctx.Res | <mask> if err != nil {
<mask> return "", err
<mask> }
<mask>
<mask> resp = ctx.Res
<mask>
<mask> if len(resp.Answer) == 0 {
<mask> return "", fmt.Errorf("lookup for %q: %w", arpa, rDNSEmptyAnswerErr)
<mask> }
<mask>
<mask> ptr, ok := resp.Answer[0].(*dns.PTR)
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove var resp *dns.Msg
err = resolver.Resolve(ctx)
if err != nil {
</s> add s.recDetector.add(*req)
if err = resolver.Resolve(ctx); err != nil { </s> remove } else if l > maxDomainNameLen {
return fmt.Errorf("too long, max: %d", maxDomainNameLen)
</s> add } else if l > MaxDomainNameLen {
return fmt.Errorf("too long, max: %d", MaxDomainNameLen) </s> remove upstreamsConf := s.conf.GetCustomUpstreamByClient(clientIP)
if upstreamsConf != nil {
log.Debug("Using custom upstreams for %s", clientIP)
d.CustomUpstreamConfig = upstreamsConf
</s> add if upsConf := s.conf.GetCustomUpstreamByClient(clientIP); upsConf != nil {
log.Debug("dns: using custom upstreams for client %s", clientIP)
d.CustomUpstreamConfig = upsConf </s> remove err := s.dnsProxy.Resolve(d)
if err != nil {
ctx.err = err
</s> add s.recDetector.add(*req)
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
s.recDetector.clear()
| <mask> return fmt.Errorf("setting up resolvers: %w", err)
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // Stop stops the DNS server.
<mask> func (s *Server) Stop() error {
<mask> s.serverLock.Lock()
</s> Pull request: 3185 detecting recursion
Merge in DNS/adguard-home from 3185-recursion to master
Closes #3185.
Squashed commit of the following:
commit 2fa44223f533c471f2b8c0e17d8550bf4ff73c7b
Merge: 7975957c 7a48e92e
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 19:04:44 2021 +0300
Merge branch 'master' into 3185-recursion
commit 7975957cceb840f76eef0e2e434f4163a122ac34
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:36:22 2021 +0300
dnsforward: imp docs
commit 1af7131a5b7c1fefed2d1eb8ee24ebfd3602dc77
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 17:15:00 2021 +0300
dnsforward: imp code, tests, docs
commit f3f9145fb5e1174fab87ca6890da9df722cfebf0
Author: Eugene Burkov <[email protected]>
Date: Thu May 27 15:45:44 2021 +0300
dnsforward: add recursion detector </s> remove func processUpstream(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
</s> add func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) { </s> remove const maxDomainNameLen = 253
</s> add const MaxDomainNameLen = 253 </s> remove resp = ctx.Res
</s> add resp := ctx.Res </s> remove s := &Server{}
</s> add s := &Server{
recDetector: newRecursionDetector(0, 1),
} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48b8579703344236296437410697bc99ff18adc4 | internal/dnsforward/dnsforward.go |
"runtime" | <mask> "fmt"
<mask> "os/exec"
<mask> "syscall"
<mask> )
<mask>
<mask> // UnsupportedError is returned by functions and methods when a particular
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove "fmt"
</s> add </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
RlimitNoFile uint64 `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
</s> add ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os.go |
<mask> import (
<mask> "fmt"
<mask> "os/exec"
<mask> "syscall"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> )
<mask>
<mask> // ErrUnsupported is returned when the functionality is unsupported on the
<mask> // current operating system.
<mask> //
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove "fmt"
</s> add </s> remove const currentSchemaVersion = 10
</s> add const currentSchemaVersion = 11 </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os.go |
|
// UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} | <mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> )
<mask>
<mask> // ErrUnsupported is returned when the functionality is unsupported on the
<mask> // current operating system.
<mask> //
<mask> // TODO(a.garipov): Make a structured error and use it everywhere instead of
<mask> // a bunch of fmt.Errorf and all that.
<mask> const ErrUnsupported errors.Error = "unsupported"
<mask>
<mask> // CanBindPrivilegedPorts checks if current process can bind to privileged
<mask> // ports.
<mask> func CanBindPrivilegedPorts() (can bool, err error) {
<mask> return canBindPrivilegedPorts()
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove const currentSchemaVersion = 10
</s> add const currentSchemaVersion = 11 </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os.go |
<mask>
<mask> package aghos
<mask>
<mask> import (
<mask> "fmt"
<mask> "syscall"
<mask>
<mask> "golang.org/x/sys/windows"
<mask> )
<mask>
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os_windows.go |
|
return Unsupported("setrlimit") | <mask> return HaveAdminRights()
<mask> }
<mask>
<mask> func setRlimit(val uint64) (err error) {
<mask> return ErrUnsupported
<mask> }
<mask>
<mask> func haveAdminRights() (bool, error) {
<mask> var token windows.Token
<mask> h := windows.CurrentProcess()
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV6") </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os_windows.go |
return Unsupported("kill") | <mask> return true, nil
<mask> }
<mask>
<mask> func sendProcessSignal(pid int, sig syscall.Signal) error {
<mask> return fmt.Errorf("not supported on Windows")
<mask> }
<mask>
<mask> func isOpenWrt() (ok bool) {
<mask> return false
<mask> }
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV6") </s> remove if config.RlimitNoFile != 0 {
err = aghos.SetRlimit(config.RlimitNoFile)
if err != nil && !errors.Is(err, aghos.ErrUnsupported) {
return fmt.Errorf("setting rlimit: %w", err)
}
}
</s> add </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/aghos/os_windows.go |
"github.com/AdguardTeam/AdGuardHome/internal/aghos" | <mask> "runtime"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/insomniacslk/dhcp/dhcpv4"
<mask> "github.com/insomniacslk/dhcp/dhcpv4/nclient4"
<mask> "github.com/insomniacslk/dhcp/dhcpv6"
<mask> "github.com/insomniacslk/dhcp/dhcpv6/nclient6"
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/checkother.go |
return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") | <mask>
<mask> // TODO(a.garipov): Find out what this is about. Perhaps this
<mask> // information is outdated or at least incomplete.
<mask> if runtime.GOOS == "darwin" {
<mask> return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
<mask> }
<mask>
<mask> srcIP := ifaceIPNet[0]
<mask> src := aghnet.JoinHostPort(srcIP.String(), 68)
<mask> dst := "255.255.255.255:67"
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove return ErrUnsupported
</s> add return Unsupported("setrlimit") </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/checkother.go |
import "github.com/AdguardTeam/AdGuardHome/internal/aghos" | <mask> package dhcpd
<mask>
<mask> import "fmt"
<mask>
<mask> func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
<mask> return false, fmt.Errorf("not supported")
<mask> }
<mask>
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV6") </s> remove "fmt"
</s> add </s> remove return ErrUnsupported
</s> add return Unsupported("setrlimit") </s> remove return fmt.Errorf("not supported on Windows")
</s> add return Unsupported("kill") | [
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/checkother_windows.go |
return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") | <mask>
<mask> import "fmt"
<mask>
<mask> func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
<mask> return false, fmt.Errorf("not supported")
<mask> }
<mask>
<mask> func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) {
<mask> return false, fmt.Errorf("not supported")
<mask> }
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV6") </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove return ErrUnsupported
</s> add return Unsupported("setrlimit") </s> remove return fmt.Errorf("not supported on Windows")
</s> add return Unsupported("kill") </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/checkother_windows.go |
return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV6") | <mask> return false, fmt.Errorf("not supported")
<mask> }
<mask>
<mask> func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) {
<mask> return false, fmt.Errorf("not supported")
<mask> }
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove return fmt.Errorf("not supported on Windows")
</s> add return Unsupported("kill") </s> remove return ErrUnsupported
</s> add return Unsupported("setrlimit") </s> remove return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/checkother_windows.go |
"github.com/AdguardTeam/AdGuardHome/internal/aghos" | <mask>
<mask> import (
<mask> "net"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "golang.org/x/net/ipv4"
<mask> )
<mask>
<mask> // Create a socket for receiving broadcast packets
<mask> func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove import "fmt"
</s> add import "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove return false, fmt.Errorf("not supported")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/os_windows.go |
func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") | <mask> "golang.org/x/net/ipv4"
<mask> )
<mask>
<mask> // Create a socket for receiving broadcast packets
<mask> func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
<mask> return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
<mask> }
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" </s> remove return fmt.Errorf("not supported on Windows")
</s> add return Unsupported("kill") </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/dhcpd/os_windows.go |
// osConfig contains OS-related configuration.
type osConfig struct {
// Group is the name of the group which AdGuard Home must switch to on
// startup. Empty string means no switching.
Group string `yaml:"group"`
// User is the name of the user which AdGuard Home must switch to on
// startup. Empty string means no switching.
User string `yaml:"user"`
// RlimitNoFile is the maximum number of opened fd's per process. Zero
// means use the default value.
RlimitNoFile uint64 `yaml:"rlimit_nofile"`
}
| <mask> LogFile string `yaml:"log_file"` // Path to the log file. If empty, write to stdout. If "syslog", writes to syslog
<mask> Verbose bool `yaml:"verbose"` // If true, verbose logging is enabled
<mask> }
<mask>
<mask> // configuration is loaded from YAML
<mask> // field ordering is important -- yaml fields will mirror ordering from here
<mask> type configuration struct {
<mask> // Raw file data to avoid re-reading of configuration file
<mask> // It's reset after config is parsed
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
RlimitNoFile uint64 `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
</s> add ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/config.go |
ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
Language string `yaml:"language"` // two-letter ISO 639-1 language code
DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 | <mask> AuthAttempts uint `yaml:"auth_attempts"`
<mask> // AuthBlockMin is the duration, in minutes, of the block of new login
<mask> // attempts after AuthAttempts unsuccessful login attempts.
<mask> AuthBlockMin uint `yaml:"block_auth_min"`
<mask> ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client
<mask> Language string `yaml:"language"` // two-letter ISO 639-1 language code
<mask> RlimitNoFile uint64 `yaml:"rlimit_nofile"` // Maximum number of opened fd's per process (0: default)
<mask> DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060
<mask>
<mask> // TTL for a web session (in hours)
<mask> // An active session is automatically refreshed once a day.
<mask> WebSessionTTLHours uint32 `yaml:"web_session_ttl"`
<mask>
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove "github.com/AdguardTeam/golibs/errors"
</s> add "github.com/AdguardTeam/AdGuardHome/internal/aghos" | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/config.go |
OSConfig *osConfig `yaml:"os"`
| <mask>
<mask> logSettings `yaml:",inline"`
<mask>
<mask> sync.RWMutex `yaml:"-"`
<mask>
<mask> SchemaVersion int `yaml:"schema_version"` // keeping last so that users will be less tempted to change it -- used when upgrading between versions
<mask> }
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/config.go |
OSConfig: &osConfig{}, | <mask> LogMaxBackups: 0,
<mask> LogMaxSize: 100,
<mask> LogMaxAge: 3,
<mask> },
<mask> SchemaVersion: currentSchemaVersion,
<mask> }
<mask>
<mask> // initConfig initializes default configuration for the current OS&ARCH
<mask> func initConfig() {
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove const currentSchemaVersion = 10
</s> add const currentSchemaVersion = 11 </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/config.go |
log.Fatal("service actions are not supported on openbsd, see issue 3226") | <mask> // TODO(a.garipov): github.com/kardianos/service doesn't seem to
<mask> // support OpenBSD currently. Either patch it to do so or make
<mask> // our own implementation of the service.System interface.
<mask> if runtime.GOOS == "openbsd" {
<mask> log.Fatal("service actions are not supported on openbsd")
<mask> }
<mask>
<mask> handleServiceControlAction(args, clientBuildFS)
<mask>
<mask> return
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/home.go |
<mask> }
<mask> Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
<mask> config.Clients = nil
<mask>
<mask> if config.RlimitNoFile != 0 {
<mask> err = aghos.SetRlimit(config.RlimitNoFile)
<mask> if err != nil && !errors.Is(err, aghos.ErrUnsupported) {
<mask> return fmt.Errorf("setting rlimit: %w", err)
<mask> }
<mask> }
<mask>
<mask> // override bind host/port from the console
<mask> if args.bindHost != nil {
<mask> config.BindHost = args.bindHost
<mask> }
<mask> if args.bindPort != 0 {
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return fmt.Errorf("not supported on Windows")
</s> add return Unsupported("kill") </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/home.go |
|
err = configureOS(&config)
fatalOnError(err)
| <mask>
<mask> setupContext(args)
<mask>
<mask> // clients package uses filtering package's static data (filtering.BlockedSvcKnown()),
<mask> // so we have to initialize filtering's static data first,
<mask> // but also avoid relying on automatic Go init() function
<mask> filtering.InitModule()
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove log.Fatal("service actions are not supported on openbsd")
</s> add log.Fatal("service actions are not supported on openbsd, see issue 3226") </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/home.go |
const currentSchemaVersion = 11 | <mask> yaml "gopkg.in/yaml.v2"
<mask> )
<mask>
<mask> // currentSchemaVersion is the current schema version.
<mask> const currentSchemaVersion = 10
<mask>
<mask> // These aliases are provided for convenience.
<mask> type (
<mask> any = interface{}
<mask> yarr = []any
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove // ErrUnsupported is returned when the functionality is unsupported on the
// current operating system.
//
// TODO(a.garipov): Make a structured error and use it everywhere instead of
// a bunch of fmt.Errorf and all that.
const ErrUnsupported errors.Error = "unsupported"
</s> add // UnsupportedError is returned by functions and methods when a particular
// operation Op cannot be performed on the current OS.
type UnsupportedError struct {
Op string
OS string
}
// Error implements the error interface for *UnsupportedError.
func (err *UnsupportedError) Error() (msg string) {
return fmt.Sprintf("%s is unsupported on %s", err.Op, err.OS)
}
// Unsupported is a helper that returns an *UnsupportedError with the Op field
// set to op and the OS field set to the current OS.
func Unsupported(op string) (err error) {
return &UnsupportedError{
Op: op,
OS: runtime.GOOS,
}
} </s> remove
"github.com/AdguardTeam/golibs/errors"
</s> add </s> remove if config.RlimitNoFile != 0 {
err = aghos.SetRlimit(config.RlimitNoFile)
if err != nil && !errors.Is(err, aghos.ErrUnsupported) {
return fmt.Errorf("setting rlimit: %w", err)
}
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/upgrade.go |
upgradeSchema10to11, | <mask> upgradeSchema7to8,
<mask> upgradeSchema8to9,
<mask> upgradeSchema9to10,
<mask> }
<mask>
<mask> n := 0
<mask> for i, u := range upgrades {
</s> Pull request: all: support setgid, setuid on unix
Updates #2763.
Squashed commit of the following:
commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 16:25:17 2021 +0300
all: move rlimit_nofile, imp docs
commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <[email protected]>
Date: Fri Jun 4 15:12:23 2021 +0300
all: support setgid, setuid on unix </s> remove return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
</s> add return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4") </s> remove return ErrUnsupported
</s> add return Unsupported("setrlimit") </s> remove if config.RlimitNoFile != 0 {
err = aghos.SetRlimit(config.RlimitNoFile)
if err != nil && !errors.Is(err, aghos.ErrUnsupported) {
return fmt.Errorf("setting rlimit: %w", err)
}
}
</s> add </s> remove func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
</s> add func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn") | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48c44c29aba472839b25fe1132c6ee8b91a27bba | internal/home/upgrade.go |
// FilterOut returns a copy of strs with all strings for which f returned true
// removed.
func FilterOut(strs []string, f func(s string) (ok bool)) (filtered []string) {
for _, s := range strs {
if !f(s) {
filtered = append(filtered, s)
}
}
return filtered
}
| <mask> }
<mask>
<mask> // InSlice checks if string is in the slice of strings.
<mask> func InSlice(strs []string, str string) (ok bool) {
<mask> for _, s := range strs {
<mask> if s == str {
<mask> return true
<mask> }
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove cSet := make(map[string]unit)
for _, k := range a {
cSet[k] = unit{}
</s> add // sliceToSet converts a slice of strings into a string set.
func sliceToSet(strs []string) (set map[string]unit) {
set = make(map[string]unit, len(strs))
for _, s := range strs {
set[s] = unit{} </s> remove
// Is not comment
func isUpstream(line string) bool {
return !strings.HasPrefix(line, "#")
}
func filterOutComments(lines []string) []string {
var filtered []string
for _, l := range lines {
if isUpstream(l) {
filtered = append(filtered, l)
}
}
return filtered
}
</s> add </s> remove if len(c.Upstreams) == 0 {
</s> add upstreams := aghstrings.FilterOut(c.Upstreams, aghstrings.IsCommentOrEmpty)
if len(upstreams) == 0 { </s> remove for _, k := range b {
delete(cSet, k)
}
c = make([]string, len(cSet))
i := 0
for k := range cSet {
c[i] = k
i++
}
return c
</s> add return set | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/aghstrings/strings.go |
// IsCommentOrEmpty returns true of the string starts with a "#" character or is
// an empty string.
func IsCommentOrEmpty(s string) (ok bool) {
return len(s) == 0 || s[0] == '#'
}
| <mask>
<mask> return false
<mask> }
<mask>
<mask> // SplitNext splits string by a byte and returns the first chunk skipping empty
<mask> // ones. Whitespaces are trimmed.
<mask> func SplitNext(s *string, sep rune) (chunk string) {
<mask> if s == nil {
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove if len(c.Upstreams) == 0 {
</s> add upstreams := aghstrings.FilterOut(c.Upstreams, aghstrings.IsCommentOrEmpty)
if len(upstreams) == 0 { </s> remove
// Is not comment
func isUpstream(line string) bool {
return !strings.HasPrefix(line, "#")
}
func filterOutComments(lines []string) []string {
var filtered []string
for _, l := range lines {
if isUpstream(l) {
filtered = append(filtered, l)
}
}
return filtered
}
</s> add </s> remove if !isUpstream(input) {
</s> add if aghstrings.IsCommentOrEmpty(input) { </s> remove upstreams = filterOutComments(upstreams)
</s> add upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/aghstrings/strings.go |
func TestFilterOut(t *testing.T) {
strs := []string{
"1.2.3.4",
"",
"# 5.6.7.8",
}
want := []string{
"1.2.3.4",
}
got := FilterOut(strs, IsCommentOrEmpty)
assert.Equal(t, want, got)
}
| <mask> assert.Equal(t, CloneSlice(a), CloneSliceOrEmpty(a))
<mask> })
<mask> }
<mask>
<mask> func TestInSlice(t *testing.T) {
<mask> simpleStrs := []string{"1", "2", "3"}
<mask>
<mask> testCases := []struct {
<mask> name string
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove cSet := make(map[string]unit)
for _, k := range a {
cSet[k] = unit{}
</s> add // sliceToSet converts a slice of strings into a string set.
func sliceToSet(strs []string) (set map[string]unit) {
set = make(map[string]unit, len(strs))
for _, s := range strs {
set[s] = unit{} </s> remove
// Is not comment
func isUpstream(line string) bool {
return !strings.HasPrefix(line, "#")
}
func filterOutComments(lines []string) []string {
var filtered []string
for _, l := range lines {
if isUpstream(l) {
filtered = append(filtered, l)
}
}
return filtered
}
</s> add </s> remove for _, k := range b {
delete(cSet, k)
}
c = make([]string, len(cSet))
i := 0
for k := range cSet {
c[i] = k
i++
}
return c
</s> add return set | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/aghstrings/strings_test.go |
upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty) | <mask> } else {
<mask> upstreams = s.conf.UpstreamDNS
<mask> }
<mask>
<mask> upstreams = filterOutComments(upstreams)
<mask> upstreamConfig, err := proxy.ParseUpstreamsConfig(
<mask> upstreams,
<mask> upstream.Options{
<mask> Bootstrap: s.conf.BootstrapDNS,
<mask> Timeout: DefaultTimeout,
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove c.Upstreams,
</s> add upstreams, </s> remove if len(c.Upstreams) == 0 {
</s> add upstreams := aghstrings.FilterOut(c.Upstreams, aghstrings.IsCommentOrEmpty)
if len(upstreams) == 0 { </s> remove upstreams = filterOutComments(upstreams)
</s> add upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty) </s> remove localAddrs = stringSetSubtract(localAddrs, ourAddrs)
</s> add localAddrs = aghstrings.FilterOut(localAddrs, func(s string) (ok bool) {
_, ok = ourAddrsSet[s]
return ok
}) </s> remove name: "upstream_dns_bad",
wantSet: "wrong upstreams specification: missing port in address\n",
</s> add name: "upstream_dns_bad",
wantSet: `wrong upstreams specification: address !!!: ` +
`missing port in address`, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/dnsforward/config.go |
// collectDNSIPAddrs returns IP addresses the server is listening on without
// port numbers as a map. For internal use only. | <mask> // locally-served networks. It is assumed that local resolvers should work much
<mask> // faster than ordinary upstreams.
<mask> const defaultLocalTimeout = 1 * time.Second
<mask>
<mask> // collectDNSIPAddrs returns the slice of IP addresses without port number which
<mask> // we are listening on. For internal use only.
<mask> func (s *Server) collectDNSIPAddrs() (addrs []string, err error) {
<mask> addrs = make([]string, len(s.conf.TCPListenAddrs)+len(s.conf.UDPListenAddrs))
<mask> var i int
<mask> var ip net.IP
<mask> for _, addr := range s.conf.TCPListenAddrs {
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove for _, k := range b {
delete(cSet, k)
}
c = make([]string, len(cSet))
i := 0
for k := range cSet {
c[i] = k
i++
}
return c
</s> add return set </s> remove localAddrs = stringSetSubtract(localAddrs, ourAddrs)
</s> add localAddrs = aghstrings.FilterOut(localAddrs, func(s string) (ok bool) {
_, ok = ourAddrsSet[s]
return ok
}) </s> remove if !isUpstream(input) {
</s> add if aghstrings.IsCommentOrEmpty(input) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/dnsforward/dnsforward.go |
// unit is used to show the presence of a value in a set.
type unit = struct{} | <mask>
<mask> return addrs[:i], nil
<mask> }
<mask>
<mask> // stringSetSubtract subtracts b from a interpreted as sets.
<mask> func stringSetSubtract(a, b []string) (c []string) {
<mask> // unit is an object to be used as value in set.
<mask> type unit = struct{}
<mask>
<mask> cSet := make(map[string]unit)
<mask> for _, k := range a {
<mask> cSet[k] = unit{}
<mask> }
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove cSet := make(map[string]unit)
for _, k := range a {
cSet[k] = unit{}
</s> add // sliceToSet converts a slice of strings into a string set.
func sliceToSet(strs []string) (set map[string]unit) {
set = make(map[string]unit, len(strs))
for _, s := range strs {
set[s] = unit{} </s> remove for _, k := range b {
delete(cSet, k)
}
c = make([]string, len(cSet))
i := 0
for k := range cSet {
c[i] = k
i++
}
return c
</s> add return set </s> remove
// Is not comment
func isUpstream(line string) bool {
return !strings.HasPrefix(line, "#")
}
func filterOutComments(lines []string) []string {
var filtered []string
for _, l := range lines {
if isUpstream(l) {
filtered = append(filtered, l)
}
}
return filtered
}
</s> add </s> remove upstreams = filterOutComments(upstreams)
</s> add upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/dnsforward/dnsforward.go |
// sliceToSet converts a slice of strings into a string set.
func sliceToSet(strs []string) (set map[string]unit) {
set = make(map[string]unit, len(strs))
for _, s := range strs {
set[s] = unit{} | <mask> func stringSetSubtract(a, b []string) (c []string) {
<mask> // unit is an object to be used as value in set.
<mask> type unit = struct{}
<mask>
<mask> cSet := make(map[string]unit)
<mask> for _, k := range a {
<mask> cSet[k] = unit{}
<mask> }
<mask>
<mask> for _, k := range b {
<mask> delete(cSet, k)
<mask> }
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove // stringSetSubtract subtracts b from a interpreted as sets.
func stringSetSubtract(a, b []string) (c []string) {
// unit is an object to be used as value in set.
type unit = struct{}
</s> add // unit is used to show the presence of a value in a set.
type unit = struct{} </s> remove for _, k := range b {
delete(cSet, k)
}
c = make([]string, len(cSet))
i := 0
for k := range cSet {
c[i] = k
i++
}
return c
</s> add return set </s> remove
// Is not comment
func isUpstream(line string) bool {
return !strings.HasPrefix(line, "#")
}
func filterOutComments(lines []string) []string {
var filtered []string
for _, l := range lines {
if isUpstream(l) {
filtered = append(filtered, l)
}
}
return filtered
}
</s> add </s> remove upstreams = filterOutComments(upstreams)
</s> add upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/dnsforward/dnsforward.go |
return set | <mask> for _, k := range a {
<mask> cSet[k] = unit{}
<mask> }
<mask>
<mask> for _, k := range b {
<mask> delete(cSet, k)
<mask> }
<mask>
<mask> c = make([]string, len(cSet))
<mask> i := 0
<mask> for k := range cSet {
<mask> c[i] = k
<mask> i++
<mask> }
<mask>
<mask> return c
<mask> }
<mask>
<mask> // setupResolvers initializes the resolvers for local addresses. For internal
<mask> // use only.
<mask> func (s *Server) setupResolvers(localAddrs []string) (err error) {
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove cSet := make(map[string]unit)
for _, k := range a {
cSet[k] = unit{}
</s> add // sliceToSet converts a slice of strings into a string set.
func sliceToSet(strs []string) (set map[string]unit) {
set = make(map[string]unit, len(strs))
for _, s := range strs {
set[s] = unit{} </s> remove // stringSetSubtract subtracts b from a interpreted as sets.
func stringSetSubtract(a, b []string) (c []string) {
// unit is an object to be used as value in set.
type unit = struct{}
</s> add // unit is used to show the presence of a value in a set.
type unit = struct{} </s> remove // collectDNSIPAddrs returns the slice of IP addresses without port number which
// we are listening on. For internal use only.
</s> add // collectDNSIPAddrs returns IP addresses the server is listening on without
// port numbers as a map. For internal use only. </s> remove
// Is not comment
func isUpstream(line string) bool {
return !strings.HasPrefix(line, "#")
}
func filterOutComments(lines []string) []string {
var filtered []string
for _, l := range lines {
if isUpstream(l) {
filtered = append(filtered, l)
}
}
return filtered
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/dnsforward/dnsforward.go |
ourAddrsSet := sliceToSet(ourAddrs)
| <mask> }
<mask>
<mask> // TODO(e.burkov): The approach of subtracting sets of strings is not
<mask> // really applicable here since in case of listening on all network
<mask> // interfaces we should check the whole interface's network to cut off
<mask> // all the loopback addresses as well.
<mask> localAddrs = aghstrings.FilterOut(localAddrs, func(s string) (ok bool) {
<mask> _, ok = ourAddrsSet[s]
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove localAddrs = stringSetSubtract(localAddrs, ourAddrs)
</s> add localAddrs = aghstrings.FilterOut(localAddrs, func(s string) (ok bool) {
_, ok = ourAddrsSet[s]
return ok
}) </s> remove // collectDNSIPAddrs returns the slice of IP addresses without port number which
// we are listening on. For internal use only.
</s> add // collectDNSIPAddrs returns IP addresses the server is listening on without
// port numbers as a map. For internal use only. </s> remove // stringSetSubtract subtracts b from a interpreted as sets.
func stringSetSubtract(a, b []string) (c []string) {
// unit is an object to be used as value in set.
type unit = struct{}
</s> add // unit is used to show the presence of a value in a set.
type unit = struct{} | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/dnsforward/dnsforward.go |
localAddrs = aghstrings.FilterOut(localAddrs, func(s string) (ok bool) {
_, ok = ourAddrsSet[s]
return ok
}) | <mask> // TODO(e.burkov): The approach of subtracting sets of strings is not
<mask> // really applicable here since in case of listening on all network
<mask> // interfaces we should check the whole interface's network to cut off
<mask> // all the loopback addresses as well.
<mask> localAddrs = stringSetSubtract(localAddrs, ourAddrs)
<mask>
<mask> var upsConfig proxy.UpstreamConfig
<mask> upsConfig, err = proxy.ParseUpstreamsConfig(localAddrs, upstream.Options{
<mask> Bootstrap: bootstraps,
<mask> Timeout: defaultLocalTimeout,
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove // collectDNSIPAddrs returns the slice of IP addresses without port number which
// we are listening on. For internal use only.
</s> add // collectDNSIPAddrs returns IP addresses the server is listening on without
// port numbers as a map. For internal use only. </s> remove upstreams = filterOutComments(upstreams)
</s> add upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty) </s> remove // stringSetSubtract subtracts b from a interpreted as sets.
func stringSetSubtract(a, b []string) (c []string) {
// unit is an object to be used as value in set.
type unit = struct{}
</s> add // unit is used to show the presence of a value in a set.
type unit = struct{} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/dnsforward/dnsforward.go |
upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty) | <mask> //
<mask> // TODO(e.burkov): Move into aghnet or even into dnsproxy.
<mask> func ValidateUpstreams(upstreams []string) (err error) {
<mask> // No need to validate comments
<mask> upstreams = filterOutComments(upstreams)
<mask>
<mask> // Consider this case valid because defaultDNS will be used
<mask> if len(upstreams) == 0 {
<mask> return nil
<mask> }
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove if len(c.Upstreams) == 0 {
</s> add upstreams := aghstrings.FilterOut(c.Upstreams, aghstrings.IsCommentOrEmpty)
if len(upstreams) == 0 { </s> remove if !isUpstream(input) {
</s> add if aghstrings.IsCommentOrEmpty(input) { </s> remove cSet := make(map[string]unit)
for _, k := range a {
cSet[k] = unit{}
</s> add // sliceToSet converts a slice of strings into a string set.
func sliceToSet(strs []string) (set map[string]unit) {
set = make(map[string]unit, len(strs))
for _, s := range strs {
set[s] = unit{} </s> remove for _, k := range b {
delete(cSet, k)
}
c = make([]string, len(cSet))
i := 0
for k := range cSet {
c[i] = k
i++
}
return c
</s> add return set | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/dnsforward/http.go |
if aghstrings.IsCommentOrEmpty(input) { | <mask> return nil
<mask> }
<mask>
<mask> func checkDNS(input string, bootstrap []string, ef excFunc) (err error) {
<mask> if !isUpstream(input) {
<mask> return nil
<mask> }
<mask>
<mask> // Separate upstream from domains list.
<mask> var useDefault bool
</s> Pull request: all: fix client custom upstream comments
Updates #2947.
Squashed commit of the following:
commit 498a05459b1aa00bcffee490acfeecb567025971
Merge: 6a7a2f87 21e2c419
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:40:29 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 6a7a2f87cfd2bdd829b82889890511fef8d84b9b
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:34:28 2021 +0300
all: imp code, tests
commit abc0be239f69cfc3e7d0cde2fc952d9157b2cd5d
Merge: 82fb3fcb 6410feeb
Author: Ainar Garipov <[email protected]>
Date: Tue Apr 13 13:17:09 2021 +0300
Merge branch 'master' into 2947-cli-ups-comment
commit 82fb3fcb49cbc8d439cb5959c1cb84ae49b2257e
Author: Ainar Garipov <[email protected]>
Date: Mon Apr 12 22:13:41 2021 +0300
all: fix client custom upstream comments </s> remove
// Is not comment
func isUpstream(line string) bool {
return !strings.HasPrefix(line, "#")
}
func filterOutComments(lines []string) []string {
var filtered []string
for _, l := range lines {
if isUpstream(l) {
filtered = append(filtered, l)
}
}
return filtered
}
</s> add </s> remove if len(c.Upstreams) == 0 {
</s> add upstreams := aghstrings.FilterOut(c.Upstreams, aghstrings.IsCommentOrEmpty)
if len(upstreams) == 0 { </s> remove upstreams = filterOutComments(upstreams)
</s> add upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty) </s> remove for _, k := range b {
delete(cSet, k)
}
c = make([]string, len(cSet))
i := 0
for k := range cSet {
c[i] = k
i++
}
return c
</s> add return set | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/48d702f76ac2e651ce788abf006799efcd482152 | internal/dnsforward/http.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.