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
tableRev := make(map[string][]string)
<mask> <mask> // updateHosts - loads system hosts <mask> func (a *AutoHosts) updateHosts() { <mask> table := make(map[string][]net.IP) <mask> tableRev := make(map[string]string) <mask> <mask> a.load(table, tableRev, a.hostsFn) <mask> <mask> for _, dir := range a.hostsDirs { <mask> fis, err := ioutil.ReadDir(dir) </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove table[k] = v </s> add ipToHosts[k] = v </s> remove // List - get "IP -> hostname" table. Thread-safe. func (a *AutoHosts) List() map[string]string { table := make(map[string]string) </s> add // List returns an IP-to-hostnames table. It is safe for concurrent use. func (a *AutoHosts) List() (ipToHosts map[string][]string) { </s> remove func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string, fn string) { </s> add func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string][]string, fn string) { </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
_ = os.MkdirAll(dir, 0o755)
<mask> <mask> func prepareTestDir() string { <mask> const dir = "./agh-test" <mask> _ = os.RemoveAll(dir) <mask> _ = os.MkdirAll(dir, 0755) <mask> return dir <mask> } <mask> <mask> func TestAutoHostsResolution(t *testing.T) { <mask> ah := AutoHosts{} </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") </s> add hosts = ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 1) { assert.Equal(t, hosts[0], "localhost") } </s> remove tableRev := make(map[string]string) </s> add tableRev := make(map[string][]string) </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") </s> add hosts := ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 2) { assert.Equal(t, hosts[0], "host") } </s> remove table[k] = v </s> add ipToHosts[k] = v </s> remove a.lock.Unlock() return table </s> add return ipToHosts
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts_test.go
names, ok := table["127.0.0.1"]
<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) <mask> assert.Equal(t, "host", name) <mask> <mask> // Test PTR <mask> a, _ := dns.ReverseAddr("127.0.0.1") </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove assert.Equal(t, "host", name) </s> add assert.Equal(t, []string{"host", "localhost"}, names) </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") </s> add hosts := ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 2) { assert.Equal(t, hosts[0], "host") } </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") </s> add hosts = ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 1) { assert.Equal(t, hosts[0], "localhost") } </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove _, ok := tableRev[ipStr] </s> add hosts, ok := tableRev[ipStr]
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts_test.go
assert.Equal(t, []string{"host", "localhost"}, names)
<mask> // Test hosts file <mask> table := ah.List() <mask> name, ok := table["127.0.0.1"] <mask> assert.True(t, ok) <mask> assert.Equal(t, "host", name) <mask> <mask> // Test PTR <mask> a, _ := dns.ReverseAddr("127.0.0.1") <mask> a = strings.TrimSuffix(a, ".") <mask> assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove name, ok := table["127.0.0.1"] </s> add names, ok := table["127.0.0.1"] </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") </s> add hosts := ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 2) { assert.Equal(t, hosts[0], "host") } </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") </s> add hosts = ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 1) { assert.Equal(t, hosts[0], "localhost") } </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove _, ok := tableRev[ipStr] </s> add hosts, ok := tableRev[ipStr]
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts_test.go
hosts := ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 2) { assert.Equal(t, hosts[0], "host") }
<mask> <mask> // Test PTR <mask> a, _ := dns.ReverseAddr("127.0.0.1") <mask> a = strings.TrimSuffix(a, ".") <mask> assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") <mask> a, _ = dns.ReverseAddr("::1") <mask> a = strings.TrimSuffix(a, ".") <mask> assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") <mask> } <mask> </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") </s> add hosts = ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 1) { assert.Equal(t, hosts[0], "localhost") } </s> remove assert.Equal(t, "host", name) </s> add assert.Equal(t, []string{"host", "localhost"}, names) </s> remove name, ok := table["127.0.0.1"] </s> add names, ok := table["127.0.0.1"] </s> remove _ = os.MkdirAll(dir, 0755) </s> add _ = os.MkdirAll(dir, 0o755) </s> remove // ProcessReverse - process PTR request // Return "" if not found or an error occurred func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) string { </s> add // ProcessReverse processes a PTR request. It returns nil if nothing is found. func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) (hosts []string) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts_test.go
hosts = ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 1) { assert.Equal(t, hosts[0], "localhost") }
<mask> a = strings.TrimSuffix(a, ".") <mask> assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") <mask> a, _ = dns.ReverseAddr("::1") <mask> a = strings.TrimSuffix(a, ".") <mask> assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") <mask> } <mask> <mask> func TestAutoHostsFSNotify(t *testing.T) { <mask> ah := AutoHosts{} <mask> </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") </s> add hosts := ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 2) { assert.Equal(t, hosts[0], "host") } </s> remove assert.Equal(t, "host", name) </s> add assert.Equal(t, []string{"host", "localhost"}, names) </s> remove _ = os.MkdirAll(dir, 0755) </s> add _ = os.MkdirAll(dir, 0o755) </s> remove name, ok := table["127.0.0.1"] </s> add names, ok := table["127.0.0.1"] </s> remove table[k] = v </s> add ipToHosts[k] = v
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts_test.go
<mask> return nil <mask> }, <mask> } <mask> <mask> var resultHandlers = map[string]logEntryHandler{ <mask> "IsFiltered": func(t json.Token, ent *logEntry) error { <mask> v, ok := t.(bool) <mask> if !ok { <mask> return nil <mask> } <mask> ent.Result.IsFiltered = v <mask> return nil <mask> }, <mask> "Rule": func(t json.Token, ent *logEntry) error { <mask> s, ok := t.(string) <mask> if !ok { <mask> return nil <mask> } <mask> <mask> l := len(ent.Result.Rules) <mask> if l == 0 { <mask> ent.Result.Rules = []*filtering.ResultRule{{}} <mask> l++ <mask> } <mask> <mask> ent.Result.Rules[l-1].Text = s <mask> <mask> return nil <mask> }, <mask> "FilterID": func(t json.Token, ent *logEntry) error { <mask> n, ok := t.(json.Number) <mask> if !ok { <mask> return nil <mask> } <mask> <mask> i, err := n.Int64() <mask> if err != nil { <mask> return err <mask> } <mask> <mask> l := len(ent.Result.Rules) <mask> if l == 0 { <mask> ent.Result.Rules = []*filtering.ResultRule{{}} <mask> l++ <mask> } <mask> <mask> ent.Result.Rules[l-1].FilterListID = i <mask> <mask> return nil <mask> }, <mask> "Reason": func(t json.Token, ent *logEntry) error { <mask> v, ok := t.(json.Number) <mask> if !ok { <mask> return nil <mask> } <mask> i, err := v.Int64() <mask> if err != nil { <mask> return err <mask> } <mask> ent.Result.Reason = filtering.Reason(i) <mask> return nil <mask> }, <mask> "ServiceName": func(t json.Token, ent *logEntry) error { <mask> s, ok := t.(string) <mask> if !ok { <mask> return nil <mask> } <mask> <mask> ent.Result.ServiceName = s <mask> <mask> return nil <mask> }, <mask> "CanonName": func(t json.Token, ent *logEntry) error { <mask> s, ok := t.(string) <mask> if !ok { <mask> return nil <mask> } <mask> <mask> ent.Result.CanonName = s <mask> <mask> return nil <mask> }, <mask> } <mask> <mask> func decodeResultRuleKey(key string, i int, dec *json.Decoder, ent *logEntry) { <mask> var vToken json.Token <mask> switch key { <mask> case "FilterListID": <mask> ent.Result.Rules, vToken = decodeVTokenAndAddRule(key, i, dec, ent.Result.Rules) </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove if !needFlush { return nil } </s> add </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> remove switch key { case "ReverseHosts": decodeResultReverseHosts(dec, ent) </s> add decHandler, ok := resultDecHandlers[key] if ok { decHandler(dec, ent)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/decode.go
decHandler, ok := resultDecHandlers[key] if ok { decHandler(dec, ent)
<mask> <mask> return <mask> } <mask> <mask> switch key { <mask> case "ReverseHosts": <mask> decodeResultReverseHosts(dec, ent) <mask> <mask> continue <mask> case "IPList": <mask> decodeResultIPList(dec, ent) <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove case "IPList": decodeResultIPList(dec, ent) continue case "Rules": decodeResultRules(dec, ent) continue case "DNSRewriteResult": decodeResultDNSRewriteResult(dec, ent) continue default: // Go on. </s> add </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove if err != nil { log.Error("querylog: writing to file: %s", err) </s> add </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/decode.go
<mask> case "ReverseHosts": <mask> decodeResultReverseHosts(dec, ent) <mask> <mask> continue <mask> case "IPList": <mask> decodeResultIPList(dec, ent) <mask> <mask> continue <mask> case "Rules": <mask> decodeResultRules(dec, ent) <mask> <mask> continue <mask> case "DNSRewriteResult": <mask> decodeResultDNSRewriteResult(dec, ent) <mask> <mask> continue <mask> default: <mask> // Go on. <mask> } <mask> <mask> handler, ok := resultHandlers[key] <mask> if !ok { <mask> continue </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove switch key { case "ReverseHosts": decodeResultReverseHosts(dec, ent) </s> add decHandler, ok := resultDecHandlers[key] if ok { decHandler(dec, ent) </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/decode.go
<mask> package querylog <mask> <mask> import ( <mask> "fmt" <mask> "net" <mask> "os" <mask> "strings" <mask> "sync" <mask> "time" <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove rot.Format(time.RFC3339), </s> add rotTime.Format(time.RFC3339), </s> remove if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { </s> add if rotTime, now := oldest.Add(rotationIvl), time.Now(); rotTime.After(now) { </s> remove switch key { case "ReverseHosts": decodeResultReverseHosts(dec, ent) </s> add decHandler, ok := resultDecHandlers[key] if ok { decHandler(dec, ent)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
"github.com/AdguardTeam/golibs/stringutil"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/timeutil" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> const ( </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove "net" </s> add </s> remove rot.Format(time.RFC3339), </s> add rotTime.Format(time.RFC3339), </s> remove if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { </s> add if rotTime, now := oldest.Add(rotationIvl), time.Now(); rotTime.After(now) { </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
<mask> return "", fmt.Errorf("invalid client proto: %q", s) <mask> } <mask> } <mask> <mask> // logEntry - represents a single log entry <mask> type logEntry struct { <mask> // client is the found client information, if any. <mask> client *Client <mask> <mask> Time time.Time `json:"T"` <mask> <mask> QHost string `json:"QH"` <mask> QType string `json:"QT"` <mask> QClass string `json:"QC"` <mask> <mask> ReqECS string `json:"ECS,omitempty"` <mask> <mask> ClientID string `json:"CID,omitempty"` <mask> ClientProto ClientProto `json:"CP"` <mask> <mask> Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net <mask> OrigAnswer []byte `json:",omitempty"` <mask> <mask> Result filtering.Result <mask> Upstream string `json:",omitempty"` <mask> <mask> IP net.IP `json:"IP"` <mask> <mask> Elapsed time.Duration <mask> <mask> Cached bool `json:",omitempty"` <mask> AuthenticatedData bool `json:"AD,omitempty"` <mask> } <mask> <mask> // shallowClone returns a shallow clone of e. <mask> func (e *logEntry) shallowClone() (clone *logEntry) { <mask> cloneVal := *e <mask> <mask> return &cloneVal <mask> } <mask> <mask> func (l *queryLog) Start() { <mask> if l.conf.HTTPRegister != nil { <mask> l.initWeb() <mask> } <mask> go l.periodicRotate() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove // isIgnored returns true if the host is in the Ignored list. </s> add // isIgnored returns true if the host is in the ignored domains list. It // assumes that l.confMu is locked for reading. </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w")
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } }
<mask> go l.periodicRotate() <mask> } <mask> <mask> func (l *queryLog) Close() { <mask> _ = l.flushLogBuffer(true) <mask> } <mask> <mask> func checkInterval(ivl time.Duration) (ok bool) { <mask> // The constants for possible values of query log's rotation interval. <mask> const ( </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove l.confMu.RLock() defer l.confMu.RUnlock() </s> add var rotationIvl time.Duration func() { l.confMu.RLock() defer l.confMu.RUnlock() rotationIvl = l.conf.RotationIvl }() </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove // logEntry - represents a single log entry type logEntry struct { // client is the found client information, if any. client *Client Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` ReqECS string `json:"ECS,omitempty"` ClientID string `json:"CID,omitempty"` ClientProto ClientProto `json:"CP"` Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net OrigAnswer []byte `json:",omitempty"` Result filtering.Result Upstream string `json:",omitempty"` IP net.IP `json:"IP"` Elapsed time.Duration Cached bool `json:",omitempty"` AuthenticatedData bool `json:"AD,omitempty"` } // shallowClone returns a shallow clone of e. func (e *logEntry) shallowClone() (clone *logEntry) { cloneVal := *e return &cloneVal } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
l.confMu.RLock() defer l.confMu.RUnlock()
<mask> return nil <mask> } <mask> <mask> func (l *queryLog) WriteDiskConfig(c *Config) { <mask> *c = *l.conf <mask> <mask> // TODO(a.garipov): Add stringutil.Set.Clone. <mask> c.Ignored = stringutil.NewSet(l.conf.Ignored.Values()...) <mask> } <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
// TODO(a.garipov): Add stringutil.Set.Clone. c.Ignored = stringutil.NewSet(l.conf.Ignored.Values()...)
<mask> defer l.confMu.RUnlock() <mask> <mask> *c = *l.conf <mask> } <mask> <mask> // Clear memory buffer and remove log files <mask> func (l *queryLog) clear() { <mask> l.fileFlushLock.Lock() <mask> defer l.fileFlushLock.Unlock() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove l.confMu.RLock() defer l.confMu.RUnlock() </s> add var rotationIvl time.Duration func() { l.confMu.RLock() defer l.confMu.RUnlock() rotationIvl = l.conf.RotationIvl }() </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove // Flush the remainder to file. </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled {
<mask> log.Debug("querylog: cleared") <mask> } <mask> <mask> func (l *queryLog) Add(params *AddParams) { <mask> if !l.conf.Enabled { <mask> return <mask> } <mask> <mask> err := params.validate() <mask> if err != nil { </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove if !needFlush { return nil } </s> add </s> remove if err != nil { log.Error("querylog: writing to file: %s", err) </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
entry := &logEntry{
<mask> } <mask> <mask> now := time.Now() <mask> q := params.Question.Question[0] <mask> entry := logEntry{ <mask> Time: now, <mask> <mask> QHost: strings.ToLower(q.Name[:len(q.Name)-1]), <mask> QType: dns.Type(q.Qtype).String(), <mask> QClass: dns.Class(q.Qclass).String(), </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { </s> add if rotTime, now := oldest.Add(rotationIvl), time.Now(); rotTime.After(now) { </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove rot.Format(time.RFC3339), </s> add rotTime.Format(time.RFC3339), </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove // logEntry - represents a single log entry type logEntry struct { // client is the found client information, if any. client *Client Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` ReqECS string `json:"ECS,omitempty"` ClientID string `json:"CID,omitempty"` ClientProto ClientProto `json:"CP"` Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net OrigAnswer []byte `json:",omitempty"` Result filtering.Result Upstream string `json:",omitempty"` IP net.IP `json:"IP"` Elapsed time.Duration Cached bool `json:",omitempty"` AuthenticatedData bool `json:"AD,omitempty"` } // shallowClone returns a shallow clone of e. func (e *logEntry) shallowClone() (clone *logEntry) { cloneVal := *e return &cloneVal } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true)
<mask> if params.ReqECS != nil { <mask> entry.ReqECS = params.ReqECS.String() <mask> } <mask> <mask> if params.Answer != nil { <mask> var a []byte <mask> a, err = params.Answer.Pack() <mask> if err != nil { <mask> log.Error("querylog: Answer.Pack(): %s", err) <mask> <mask> return <mask> } <mask> <mask> entry.Answer = a <mask> } <mask> <mask> if params.OrigAnswer != nil { <mask> var a []byte <mask> a, err = params.OrigAnswer.Pack() <mask> if err != nil { <mask> log.Error("querylog: OrigAnswer.Pack(): %s", err) <mask> <mask> return <mask> } <mask> <mask> entry.OrigAnswer = a <mask> } <mask> <mask> needFlush := false <mask> func() { <mask> l.bufferLock.Lock() <mask> defer l.bufferLock.Unlock() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if !needFlush { return nil } </s> add </s> remove if err != nil { log.Error("querylog: writing to file: %s", err) </s> add </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w")
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
l.buffer = append(l.buffer, entry)
<mask> func() { <mask> l.bufferLock.Lock() <mask> defer l.bufferLock.Unlock() <mask> <mask> l.buffer = append(l.buffer, &entry) <mask> <mask> if !l.conf.FileEnabled { <mask> if len(l.buffer) > int(l.conf.MemSize) { <mask> // Writing to file is disabled, so just remove the oldest entry <mask> // from the slices. </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if !l.conf.FileEnabled { if len(l.buffer) > int(l.conf.MemSize) { </s> add if !fileIsEnabled { if len(l.buffer) > int(memSize) { </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove needFlush := fullFlush </s> add </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove needFlush = len(l.buffer) >= int(l.conf.MemSize) </s> add needFlush = len(l.buffer) >= int(memSize)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
if !fileIsEnabled { if len(l.buffer) > int(memSize) {
<mask> defer l.bufferLock.Unlock() <mask> <mask> l.buffer = append(l.buffer, &entry) <mask> <mask> if !l.conf.FileEnabled { <mask> if len(l.buffer) > int(l.conf.MemSize) { <mask> // Writing to file is disabled, so just remove the oldest entry <mask> // from the slices. <mask> // <mask> // TODO(a.garipov): This should be replaced by a proper ring <mask> // buffer, but it's currently difficult to do that. </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove l.buffer = append(l.buffer, &entry) </s> add l.buffer = append(l.buffer, entry) </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove needFlush := fullFlush </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
needFlush = len(l.buffer) >= int(memSize)
<mask> l.buffer[0] = nil <mask> l.buffer = l.buffer[1:] <mask> } <mask> } else if !l.flushPending { <mask> needFlush = len(l.buffer) >= int(l.conf.MemSize) <mask> if needFlush { <mask> l.flushPending = true <mask> } <mask> } <mask> }() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove if !needFlush { return nil } </s> add </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
<mask> } <mask> } <mask> }() <mask> <mask> // if buffer needs to be flushed to disk, do it now <mask> if needFlush { <mask> go func() { <mask> _ = l.flushLogBuffer(false) <mask> }() <mask> } </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove needFlush = len(l.buffer) >= int(l.conf.MemSize) </s> add needFlush = len(l.buffer) >= int(memSize) </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove if !needFlush { return nil } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) }
<mask> <mask> // if buffer needs to be flushed to disk, do it now <mask> if needFlush { <mask> go func() { <mask> _ = l.flushLogBuffer(false) <mask> }() <mask> } <mask> } <mask> <mask> // ShouldLog returns true if request for the host should be logged. </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove // isIgnored returns true if the host is in the Ignored list. </s> add // isIgnored returns true if the host is in the ignored domains list. It // assumes that l.confMu is locked for reading. </s> remove if !l.conf.FileEnabled { if len(l.buffer) > int(l.conf.MemSize) { </s> add if !fileIsEnabled { if len(l.buffer) > int(memSize) { </s> remove needFlush = len(l.buffer) >= int(l.conf.MemSize) </s> add needFlush = len(l.buffer) >= int(memSize) </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
// isIgnored returns true if the host is in the ignored domains list. It // assumes that l.confMu is locked for reading.
<mask> <mask> return !l.isIgnored(host) <mask> } <mask> <mask> // isIgnored returns true if the host is in the Ignored list. <mask> func (l *queryLog) isIgnored(host string) bool { <mask> return l.conf.Ignored.Has(host) <mask> } </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove // logEntry - represents a single log entry type logEntry struct { // client is the found client information, if any. client *Client Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` ReqECS string `json:"ECS,omitempty"` ClientID string `json:"CID,omitempty"` ClientProto ClientProto `json:"CP"` Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net OrigAnswer []byte `json:",omitempty"` Result filtering.Result Upstream string `json:",omitempty"` IP net.IP `json:"IP"` Elapsed time.Duration Cached bool `json:",omitempty"` AuthenticatedData bool `json:"AD,omitempty"` } // shallowClone returns a shallow clone of e. func (e *logEntry) shallowClone() (clone *logEntry) { cloneVal := *e return &cloneVal } </s> add </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
require.NoError(t, l.flushLogBuffer())
<mask> <mask> // Add disk entries. <mask> addEntry(l, "example.org", net.IPv4(1, 1, 1, 1), net.IPv4(2, 2, 2, 1)) <mask> // Write to disk (first file). <mask> require.NoError(t, l.flushLogBuffer(true)) <mask> // Start writing to the second file. <mask> require.NoError(t, l.rotate()) <mask> // Add disk entries. <mask> addEntry(l, "example.org", net.IPv4(1, 1, 1, 2), net.IPv4(2, 2, 2, 2)) <mask> // Write to disk. </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog_test.go
require.NoError(t, l.flushLogBuffer())
<mask> require.NoError(t, l.rotate()) <mask> // Add disk entries. <mask> addEntry(l, "example.org", net.IPv4(1, 1, 1, 2), net.IPv4(2, 2, 2, 2)) <mask> // Write to disk. <mask> require.NoError(t, l.flushLogBuffer(true)) <mask> // Add memory entries. <mask> addEntry(l, "test.example.org", net.IPv4(1, 1, 1, 3), net.IPv4(2, 2, 2, 3)) <mask> addEntry(l, "example.com", net.IPv4(1, 1, 1, 4), net.IPv4(2, 2, 2, 4)) <mask> <mask> type tcAssertion struct { </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog_test.go
require.NoError(t, l.flushLogBuffer())
<mask> for i := 0; i < entNum; i++ { <mask> addEntry(l, secondPageDomain, net.IPv4(1, 1, 1, 1), net.IPv4(2, 2, 2, 1)) <mask> } <mask> // Write them to the first file. <mask> require.NoError(t, l.flushLogBuffer(true)) <mask> // Add more to the in-memory part of log. <mask> for i := 0; i < entNum; i++ { <mask> addEntry(l, firstPageDomain, net.IPv4(1, 1, 1, 1), net.IPv4(2, 2, 2, 1)) <mask> } <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog_test.go
require.NoError(t, l.flushLogBuffer())
<mask> for i := 0; i < entNum; i++ { <mask> addEntry(l, "example.org", net.IPv4(1, 1, 1, 1), net.IPv4(2, 2, 2, 1)) <mask> } <mask> // Write them to disk. <mask> require.NoError(t, l.flushLogBuffer(true)) <mask> <mask> params := newSearchParams() <mask> <mask> for _, maxFileScanEntries := range []int{5, 0} { <mask> t.Run(fmt.Sprintf("limit_%d", maxFileScanEntries), func(t *testing.T) { </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog_test.go
func (l *queryLog) flushLogBuffer() (err error) {
<mask> ) <mask> <mask> // flushLogBuffer flushes the current buffer to file and resets the current <mask> // buffer. <mask> func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { <mask> if !l.conf.FileEnabled { <mask> return nil <mask> } <mask> <mask> l.fileFlushLock.Lock() <mask> defer l.fileFlushLock.Unlock() <mask> <mask> // Flush the remainder to file. <mask> var flushBuffer []*logEntry </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove // Flush the remainder to file. </s> add </s> remove needFlush := fullFlush </s> add </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove l.buffer = append(l.buffer, &entry) </s> add l.buffer = append(l.buffer, entry)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
<mask> <mask> l.fileFlushLock.Lock() <mask> defer l.fileFlushLock.Unlock() <mask> <mask> // Flush the remainder to file. <mask> var flushBuffer []*logEntry <mask> needFlush := fullFlush <mask> func() { <mask> l.bufferLock.Lock() <mask> defer l.bufferLock.Unlock() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove needFlush := fullFlush </s> add </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove l.buffer = append(l.buffer, &entry) </s> add l.buffer = append(l.buffer, entry)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
<mask> defer l.fileFlushLock.Unlock() <mask> <mask> // Flush the remainder to file. <mask> var flushBuffer []*logEntry <mask> needFlush := fullFlush <mask> func() { <mask> l.bufferLock.Lock() <mask> defer l.bufferLock.Unlock() <mask> <mask> needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove // Flush the remainder to file. </s> add </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove needFlush = len(l.buffer) >= int(l.conf.MemSize) </s> add needFlush = len(l.buffer) >= int(memSize) </s> remove l.buffer = append(l.buffer, &entry) </s> add l.buffer = append(l.buffer, entry)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
flushBuffer = l.buffer l.buffer = nil l.flushPending = false
<mask> func() { <mask> l.bufferLock.Lock() <mask> defer l.bufferLock.Unlock() <mask> <mask> needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) <mask> if needFlush { <mask> flushBuffer = l.buffer <mask> l.buffer = nil <mask> l.flushPending = false <mask> } <mask> }() <mask> if !needFlush { <mask> return nil <mask> } <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove needFlush = len(l.buffer) >= int(l.conf.MemSize) </s> add needFlush = len(l.buffer) >= int(memSize) </s> remove needFlush := fullFlush </s> add </s> remove if !needFlush { return nil } </s> add </s> remove l.buffer = append(l.buffer, &entry) </s> add l.buffer = append(l.buffer, entry) </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
<mask> l.buffer = nil <mask> l.flushPending = false <mask> } <mask> }() <mask> if !needFlush { <mask> return nil <mask> } <mask> <mask> err = l.flushToFile(flushBuffer) <mask> if err != nil { <mask> log.Error("querylog: writing to file: %s", err) <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if err != nil { log.Error("querylog: writing to file: %s", err) </s> add </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove needFlush = len(l.buffer) >= int(l.conf.MemSize) </s> add needFlush = len(l.buffer) >= int(memSize)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
<mask> return nil <mask> } <mask> <mask> err = l.flushToFile(flushBuffer) <mask> if err != nil { <mask> log.Error("querylog: writing to file: %s", err) <mask> <mask> return err <mask> } <mask> <mask> return nil </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if !needFlush { return nil } </s> add </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
return errors.Annotate(err, "writing to file: %w")
<mask> err = l.flushToFile(flushBuffer) <mask> if err != nil { <mask> log.Error("querylog: writing to file: %s", err) <mask> <mask> return err <mask> } <mask> <mask> return nil <mask> } <mask> <mask> // flushToFile saves the specified log entries to the query log file <mask> func (l *queryLog) flushToFile(buffer []*logEntry) (err error) { <mask> if len(buffer) == 0 { </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if err != nil { log.Error("querylog: writing to file: %s", err) </s> add </s> remove if !needFlush { return nil } </s> add </s> remove l.confMu.RLock() defer l.confMu.RUnlock() </s> add var rotationIvl time.Duration func() { l.confMu.RLock() defer l.confMu.RUnlock() rotationIvl = l.conf.RotationIvl }() </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
var rotationIvl time.Duration func() { l.confMu.RLock() defer l.confMu.RUnlock() rotationIvl = l.conf.RotationIvl }()
<mask> <mask> // checkAndRotate rotates log files if those are older than the specified <mask> // rotation interval. <mask> func (l *queryLog) checkAndRotate() { <mask> l.confMu.RLock() <mask> defer l.confMu.RUnlock() <mask> <mask> oldest, err := l.readFileFirstTimeValue() <mask> if err != nil && !errors.Is(err, os.ErrNotExist) { <mask> log.Error("querylog: reading oldest record for rotation: %s", err) <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
if rotTime, now := oldest.Add(rotationIvl), time.Now(); rotTime.After(now) {
<mask> <mask> return <mask> } <mask> <mask> if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { <mask> log.Debug( <mask> "querylog: %s <= %s, not rotating", <mask> now.Format(time.RFC3339), <mask> rot.Format(time.RFC3339), <mask> ) </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove rot.Format(time.RFC3339), </s> add rotTime.Format(time.RFC3339), </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
rotTime.Format(time.RFC3339),
<mask> if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { <mask> log.Debug( <mask> "querylog: %s <= %s, not rotating", <mask> now.Format(time.RFC3339), <mask> rot.Format(time.RFC3339), <mask> ) <mask> <mask> return <mask> } <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { </s> add if rotTime, now := oldest.Add(rotationIvl), time.Now(); rotTime.After(now) { </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
//go:build windows // +build windows
<mask> //go:build !(linux || darwin || freebsd || openbsd) <mask> // +build !linux,!darwin,!freebsd,!openbsd <mask> <mask> package aghnet <mask> <mask> import ( <mask> "io" </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> remove vr.CanAutoUpdate = &canUpdate </s> add
[ "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/aghnet/net_windows.go
func canBindPrivilegedPorts() (can bool, err error) { return true, nil }
<mask> ) <mask> <mask> func ifaceHasStaticIP(string) (ok bool, err error) { <mask> return false, aghos.Unsupported("checking static ip") <mask> } <mask> <mask> func ifaceSetStaticIP(string) (err error) { <mask> return aghos.Unsupported("setting static ip") </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove // TODO(a.garipov): Figure out the purpose of %T verb. aghhttp.Error( r, w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", vcu, err, err, ) </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/aghnet/net_windows.go
"fmt"
<mask> "context" <mask> "encoding/json" <mask> "net/http" <mask> "os" <mask> "os/exec" <mask> "path/filepath" <mask> "runtime" </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove CanAutoUpdate *bool `json:"can_autoupdate,omitempty"` </s> add </s> remove // w.Header().Set("Content-Type", "application/json") </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
w.Header().Set("Content-Type", "application/json")
<mask> <mask> // Get the latest available version from the Internet <mask> func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) { <mask> resp := &versionResponse{} <mask> if Context.disableUpdate { <mask> resp.Disabled = true <mask> err := json.NewEncoder(w).Encode(resp) </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> remove // TODO(a.garipov): Figure out the purpose of %T verb. aghhttp.Error( r, w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", vcu, err, err, ) </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
<mask> // Get the latest available version from the Internet <mask> func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) { <mask> resp := &versionResponse{} <mask> if Context.disableUpdate { <mask> // w.Header().Set("Content-Type", "application/json") <mask> resp.Disabled = true <mask> _ = json.NewEncoder(w).Encode(resp) <mask> // TODO(e.burkov): Add error handling and deal with headers. <mask> return <mask> } </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove vr.CanAutoUpdate = &canUpdate </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) }
<mask> resp := &versionResponse{} <mask> if Context.disableUpdate { <mask> // w.Header().Set("Content-Type", "application/json") <mask> resp.Disabled = true <mask> _ = json.NewEncoder(w).Encode(resp) <mask> // TODO(e.burkov): Add error handling and deal with headers. <mask> return <mask> } <mask> <mask> req := &struct { <mask> Recheck bool `json:"recheck_now"` </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove vr.CanAutoUpdate = &canUpdate </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
aghhttp.Error(r, w, http.StatusBadRequest, "parsing request: %s", err)
<mask> var err error <mask> if r.ContentLength != 0 { <mask> err = json.NewDecoder(r.Body).Decode(req) <mask> if err != nil { <mask> aghhttp.Error(r, w, http.StatusBadRequest, "JSON parse: %s", err) <mask> <mask> return <mask> } <mask> } <mask> </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } } </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove for i := 0; i != 3; i++ { func() { Context.controlLock.Lock() defer Context.controlLock.Unlock() </s> add err = requestVersionInfo(resp, req.Recheck) if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusBadGateway, "%s", err) return } </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
err = requestVersionInfo(resp, req.Recheck) if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusBadGateway, "%s", err) return }
<mask> return <mask> } <mask> } <mask> <mask> for i := 0; i != 3; i++ { <mask> func() { <mask> Context.controlLock.Lock() <mask> defer Context.controlLock.Unlock() <mask> <mask> resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) <mask> }() <mask> <mask> if err != nil { </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } } </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "JSON parse: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "parsing request: %s", err) </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } }
<mask> func() { <mask> Context.controlLock.Lock() <mask> defer Context.controlLock.Unlock() <mask> <mask> resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) <mask> }() <mask> <mask> if err != nil { <mask> var terr temporaryError <mask> if errors.As(err, &terr) && terr.Temporary() { <mask> // Temporary network error. This case may happen while </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // Temporary network error. This case may happen while // we're restarting our DNS server. Log and sleep for // some time. </s> add // Temporary network error. This case may happen while we're // restarting our DNS server. Log and sleep for some time. </s> remove for i := 0; i != 3; i++ { func() { Context.controlLock.Lock() defer Context.controlLock.Unlock() </s> add err = requestVersionInfo(resp, req.Recheck) if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusBadGateway, "%s", err) return } </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
// requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck)
<mask> } <mask> } <mask> <mask> if err != nil { <mask> var terr temporaryError <mask> if errors.As(err, &terr) && terr.Temporary() { <mask> // Temporary network error. This case may happen while we're </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // Temporary network error. This case may happen while // we're restarting our DNS server. Log and sleep for // some time. </s> add // Temporary network error. This case may happen while we're // restarting our DNS server. Log and sleep for some time. </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } } </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "JSON parse: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "parsing request: %s", err)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
// Temporary network error. This case may happen while we're // restarting our DNS server. Log and sleep for some time.
<mask> <mask> if err != nil { <mask> var terr temporaryError <mask> if errors.As(err, &terr) && terr.Temporary() { <mask> // Temporary network error. This case may happen while <mask> // we're restarting our DNS server. Log and sleep for <mask> // some time. <mask> // <mask> // See https://github.com/AdguardTeam/AdGuardHome/issues/934. <mask> d := time.Duration(i) * time.Second <mask> log.Info("temp net error: %q; sleeping for %s and retrying", err, d) <mask> time.Sleep(d) </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove log.Info("temp net error: %q; sleeping for %s and retrying", err, d) </s> add log.Info("update: temp net error: %q; sleeping for %s and retrying", err, d) </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } } </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> remove // w.Header().Set("Content-Type", "application/json") </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
log.Info("update: temp net error: %q; sleeping for %s and retrying", err, d)
<mask> // some time. <mask> // <mask> // See https://github.com/AdguardTeam/AdGuardHome/issues/934. <mask> d := time.Duration(i) * time.Second <mask> log.Info("temp net error: %q; sleeping for %s and retrying", err, d) <mask> time.Sleep(d) <mask> <mask> continue <mask> } <mask> } </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // Temporary network error. This case may happen while // we're restarting our DNS server. Log and sleep for // some time. </s> add // Temporary network error. This case may happen while we're // restarting our DNS server. Log and sleep for some time. </s> remove // TODO(a.garipov): Figure out the purpose of %T verb. aghhttp.Error( r, w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", vcu, err, err, ) </s> add </s> remove Disabled bool `json:"disabled"` </s> add </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
<mask> break <mask> } <mask> if err != nil { <mask> vcu := Context.updater.VersionCheckURL() <mask> // TODO(a.garipov): Figure out the purpose of %T verb. <mask> aghhttp.Error( <mask> r, <mask> w, <mask> http.StatusBadGateway, <mask> "Couldn't get version check json from %s: %T %s\n", <mask> vcu, <mask> err, <mask> err, <mask> ) <mask> <mask> return <mask> } <mask> <mask> resp.confirmAutoUpdate() </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove return </s> add return fmt.Errorf("getting version info from %s: %s", vcu, err) </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove for i := 0; i != 3; i++ { func() { Context.controlLock.Lock() defer Context.controlLock.Unlock() </s> add err = requestVersionInfo(resp, req.Recheck) if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusBadGateway, "%s", err) return } </s> remove log.Info("temp net error: %q; sleeping for %s and retrying", err, d) </s> add log.Info("update: temp net error: %q; sleeping for %s and retrying", err, d) </s> remove // w.Header().Set("Content-Type", "application/json") </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
return fmt.Errorf("getting version info from %s: %s", vcu, err)
<mask> err, <mask> err, <mask> ) <mask> <mask> return <mask> } <mask> <mask> resp.confirmAutoUpdate() <mask> <mask> w.Header().Set("Content-Type", "application/json") </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // TODO(a.garipov): Figure out the purpose of %T verb. aghhttp.Error( r, w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", vcu, err, err, ) </s> add </s> remove log.Info("temp net error: %q; sleeping for %s and retrying", err, d) </s> add log.Info("update: temp net error: %q; sleeping for %s and retrying", err, d) </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
return nil
<mask> <mask> return <mask> } <mask> <mask> resp.confirmAutoUpdate() <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> err = json.NewEncoder(w).Encode(resp) <mask> if err != nil { <mask> aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) <mask> } <mask> } <mask> <mask> // handleUpdate performs an update to the latest available version procedure. <mask> func handleUpdate(w http.ResponseWriter, r *http.Request) { <mask> if Context.updater.NewVersion() == "" { </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } } </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "JSON parse: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "parsing request: %s", err)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
<mask> } <mask> <mask> // versionResponse is the response for /control/version.json endpoint. <mask> type versionResponse struct { <mask> Disabled bool `json:"disabled"` <mask> updater.VersionInfo <mask> } <mask> <mask> // confirmAutoUpdate checks the real possibility of auto update. <mask> func (vr *versionResponse) confirmAutoUpdate() { </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
Disabled bool `json:"disabled"`
<mask> type versionResponse struct { <mask> updater.VersionInfo <mask> } <mask> <mask> // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually <mask> // allowed to perform an automatic update by the OS. <mask> func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { <mask> if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove Disabled bool `json:"disabled"` </s> add </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
// setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return }
<mask> Disabled bool `json:"disabled"` <mask> updater.VersionInfo <mask> } <mask> <mask> // confirmAutoUpdate checks the real possibility of auto update. <mask> func (vr *versionResponse) confirmAutoUpdate() { <mask> if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { <mask> canUpdate := true <mask> <mask> var tlsConf *tlsConfigSettings <mask> if runtime.GOOS != "windows" { <mask> tlsConf = &tlsConfigSettings{} <mask> Context.tls.WriteDiskConfig(tlsConf) </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> remove Disabled bool `json:"disabled"` </s> add </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf)
<mask> func (vr *versionResponse) confirmAutoUpdate() { <mask> if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { <mask> canUpdate := true <mask> <mask> var tlsConf *tlsConfigSettings <mask> if runtime.GOOS != "windows" { <mask> tlsConf = &tlsConfigSettings{} <mask> Context.tls.WriteDiskConfig(tlsConf) <mask> } <mask> <mask> if tlsConf != nil && <mask> ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || <mask> tlsConf.PortDNSOverTLS < 1024 || <mask> tlsConf.PortDNSOverQUIC < 1024)) || </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove vr.CanAutoUpdate = &canUpdate </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err)
<mask> tlsConf = &tlsConfigSettings{} <mask> Context.tls.WriteDiskConfig(tlsConf) <mask> } <mask> <mask> if tlsConf != nil && <mask> ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || <mask> tlsConf.PortDNSOverTLS < 1024 || <mask> tlsConf.PortDNSOverQUIC < 1024)) || <mask> config.BindPort < 1024 || <mask> config.DNS.Port < 1024) { <mask> canUpdate, _ = aghnet.CanBindPrivilegedPorts() <mask> } <mask> vr.CanAutoUpdate = &canUpdate <mask> } <mask> } <mask> </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> remove vr.CanAutoUpdate = &canUpdate </s> add </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
<mask> config.BindPort < 1024 || <mask> config.DNS.Port < 1024) { <mask> canUpdate, _ = aghnet.CanBindPrivilegedPorts() <mask> } <mask> vr.CanAutoUpdate = &canUpdate <mask> } <mask> } <mask> <mask> // finishUpdate completes an update procedure. <mask> func finishUpdate(ctx context.Context) { </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
vr.CanAutoUpdate = &canUpdate return nil } // tlsConfUsesPrivilegedPorts returns true if the provided TLS configuration // indicates that privileged ports are used. func tlsConfUsesPrivilegedPorts(c *tlsConfigSettings) (ok bool) { return c.Enabled && (c.PortHTTPS < 1024 || c.PortDNSOverTLS < 1024 || c.PortDNSOverQUIC < 1024)
<mask> return fmt.Errorf("checking ability to bind privileged ports: %w", err) <mask> } <mask> } <mask> } <mask> <mask> // finishUpdate completes an update procedure. <mask> func finishUpdate(ctx context.Context) { <mask> log.Info("Stopping all tasks") <mask> cleanup(ctx) </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove vr.CanAutoUpdate = &canUpdate </s> add </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return }
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
CanAutoUpdate *bool `json:"can_autoupdate,omitempty"`
<mask> const versionCheckPeriod = 8 * time.Hour <mask> <mask> // VersionInfo contains information about a new version. <mask> type VersionInfo struct { <mask> NewVersion string `json:"new_version,omitempty"` <mask> Announcement string `json:"announcement,omitempty"` <mask> AnnouncementURL string `json:"announcement_url,omitempty"` <mask> SelfUpdateMinVersion string `json:"-"` </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove CanAutoUpdate *bool `json:"can_autoupdate,omitempty"` </s> add </s> remove Disabled bool `json:"disabled"` </s> add </s> remove // Temporary network error. This case may happen while // we're restarting our DNS server. Log and sleep for // some time. </s> add // Temporary network error. This case may happen while we're // restarting our DNS server. Log and sleep for some time.
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/updater/check.go
<mask> NewVersion string `json:"new_version,omitempty"` <mask> Announcement string `json:"announcement,omitempty"` <mask> AnnouncementURL string `json:"announcement_url,omitempty"` <mask> SelfUpdateMinVersion string `json:"-"` <mask> CanAutoUpdate *bool `json:"can_autoupdate,omitempty"` <mask> } <mask> <mask> // MaxResponseSize is responses on server's requests maximum length in bytes. <mask> const MaxResponseSize = 64 * 1024 <mask> </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove vr.CanAutoUpdate = &canUpdate </s> add </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/updater/check.go
export const getProfileRequest = createAction('GET_PROFILE_REQUEST'); export const getProfileFailure = createAction('GET_PROFILE_FAILURE'); export const getProfileSuccess = createAction('GET_PROFILE_SUCCESS'); export const getProfile = () => async (dispatch) => { dispatch(getProfileRequest()); try { const profile = await apiClient.getProfile(); dispatch(getProfileSuccess(profile)); } catch (error) { dispatch(addErrorToast({ error })); dispatch(getProfileFailure()); } };
<mask> }; <mask> <mask> export const dnsStatusRequest = createAction('DNS_STATUS_REQUEST'); <mask> export const dnsStatusFailure = createAction('DNS_STATUS_FAILURE'); <mask> export const dnsStatusSuccess = createAction('DNS_STATUS_SUCCESS'); <mask> <mask> export const getDnsStatus = () => async (dispatch) => { <mask> dispatch(dnsStatusRequest()); </s> + client: get profile info
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/actions/index.js
dispatch(getProfile());
<mask> const dnsStatus = await apiClient.getGlobalStatus(); <mask> dispatch(dnsStatusSuccess(dnsStatus)); <mask> dispatch(getVersion()); <mask> dispatch(getTlsStatus()); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error })); <mask> dispatch(dnsStatusFailure()); <mask> } </s> + client: get profile info </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/actions/index.js
// Profile GET_PROFILE = { path: 'profile', method: 'GET' }; getProfile() { const { path, method } = this.GET_PROFILE; return this.makeRequest(path, method); }
<mask> headers: { 'Content-Type': 'application/json' }, <mask> }; <mask> return this.makeRequest(path, method, config); <mask> } <mask> } <mask> <mask> const apiClient = new Api(); <mask> export default apiClient; </s> + client: get profile info </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/api/Api.js
{!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> }
<mask> closeMenu={this.closeMenu} <mask> /> <mask> <div className="header__column"> <mask> <div className="header__right"> <mask> <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <mask> <Trans>sign_out</Trans> <mask> </a> <mask> </div> <mask> </div> <mask> </div> <mask> </div> <mask> </div> </s> + client: get profile info
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/components/Header/index.js
[actions.getProfileRequest]: state => ({ ...state, processingProfile: true }), [actions.getProfileFailure]: state => ({ ...state, processingProfile: false }), [actions.getProfileSuccess]: (state, { payload }) => ({ ...state, name: payload.name, processingProfile: false, }),
<mask> bootstrapDns: (bootstrapDns && bootstrapDns.join('\n')) || '', <mask> processingDnsSettings: false, <mask> }; <mask> }, <mask> }, <mask> { <mask> processing: true, <mask> isCoreRunning: false, <mask> processingVersion: true, </s> + client: get profile info </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/reducers/index.js
processingProfile: true,
<mask> processingUpdate: false, <mask> processingDnsSettings: true, <mask> upstreamDns: '', <mask> bootstrapDns: '', <mask> allServers: false, <mask> protectionEnabled: false, <mask> processingProtection: false, <mask> httpPort: 80, </s> + client: get profile info </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> }
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/reducers/index.js
name: '',
<mask> dnsAddresses: [], <mask> dnsVersion: '', <mask> clients: [], <mask> autoClients: [], <mask> }, <mask> ); <mask> <mask> const dhcp = handleActions( <mask> { </s> + client: get profile info
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/reducers/index.js
<mask> <mask> netIfaces := []net.Interface{} <mask> <mask> for i := range ifaces { <mask> if ifaces[i].Flags&net.FlagPointToPoint != 0 { <mask> // this interface is ppp, we're not interested in this one <mask> continue <mask> } <mask> <mask> iface := ifaces[i] <mask> netIfaces = append(netIfaces, iface) <mask> } <mask> <mask> return netIfaces, nil </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use" </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
// GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only
<mask> <mask> return netIfaces, nil <mask> } <mask> <mask> // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only <mask> // we do not return link-local addresses here <mask> func GetValidNetInterfacesForWeb() ([]NetInterface, error) { <mask> ifaces, err := GetValidNetInterfaces() <mask> if err != nil { <mask> return nil, errorx.Decorate(err, "Couldn't get interfaces") </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
// GetInterfaceByIP - Get interface name by its IP address.
<mask> <mask> return netInterfaces, nil <mask> } <mask> <mask> // Get interface name by its IP address. <mask> func GetInterfaceByIP(ip string) string { <mask> ifaces, err := GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> return "" <mask> } </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove if ifaces[i].Flags&net.FlagPointToPoint != 0 { // this interface is ppp, we're not interested in this one continue } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
// GetSubnet - Get IP address with netmask for the specified interface
<mask> <mask> return "" <mask> } <mask> <mask> // Get IP address with netmask for the specified interface <mask> // Returns an empty string if it fails to find it <mask> func GetSubnet(ifaceName string) string { <mask> netIfaces, err := GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> log.Error("Could not get network interfaces info: %v", err) </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove if ifaces[i].Flags&net.FlagPointToPoint != 0 { // this interface is ppp, we're not interested in this one continue } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
// CheckPortAvailable - check if TCP port is available
<mask> <mask> return "" <mask> } <mask> <mask> // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily <mask> func CheckPortAvailable(host string, port int) error { <mask> ln, err := net.Listen("tcp", net.JoinHostPort(host, strconv.Itoa(port))) <mask> if err != nil { <mask> return err <mask> } </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use" </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
// CheckPacketPortAvailable - check if UDP port is available
<mask> } <mask> <mask> func CheckPacketPortAvailable(host string, port int) error { <mask> ln, err := net.ListenPacket("udp", net.JoinHostPort(host, strconv.Itoa(port))) <mask> if err != nil { <mask> return err </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use" </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
// ErrorIsAddrInUse - check if error is "address already in use"
<mask> time.Sleep(100 * time.Millisecond) <mask> return err <mask> } <mask> <mask> // check if error is "address already in use" <mask> func ErrorIsAddrInUse(err error) bool { <mask> errOpError, ok := err.(*net.OpError) <mask> if !ok { <mask> return false <mask> } </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove if ifaces[i].Flags&net.FlagPointToPoint != 0 { // this interface is ppp, we're not interested in this one continue } </s> add </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
"example_upstream_regular_port": "DNS biasa (lebih dari UDP, dengan port);",
<mask> "example_comment_meaning": "hanya sebuah komentar;", <mask> "example_comment_hash": "# Juga sebuah komentar.", <mask> "example_regex_meaning": "blokir akses ke domain yang cocok dengan ekspresi reguler yang ditentukan.", <mask> "example_upstream_regular": "DNS reguler (melalui UDP);", <mask> "example_upstream_udp": "DNS biasa (lebih dari UDP, nama host);", <mask> "example_upstream_dot": "terenkripsi <0>DNS-over-TLS</0>;", <mask> "example_upstream_doh": "terenkripsi <0>DNS-over-HTTPS</0>;", <mask> "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0>;", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "dns_allowlists": "DNS toestemmingslijsten", </s> add "dns_allowlists": "DNS-toelatingslijsten", </s> remove "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", </s> add "dns_allowlists_desc": "Domeinen van DNS-toelatingslijsten zijn toegestaan, zelfs als ze op een van de blokkeerlijsten staan.",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/id.json
"example_upstream_tcp_port": "DNS biasa (melalui TCP, dengan port);",
<mask> "example_upstream_doh": "terenkripsi <0>DNS-over-HTTPS</0>;", <mask> "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0>;", <mask> "example_upstream_sdns": "<0>Stempel DNS</0> untuk <1>DNSCrypt</1> atau pengarah <2>DNS-over-HTTPS</2>;", <mask> "example_upstream_tcp": "DNS reguler (melalui TCP);", <mask> "example_upstream_tcp_hostname": "DNS biasa (lebih dari TCP, nama host);", <mask> "all_lists_up_to_date_toast": "Semua daftar sudah diperbarui", <mask> "updated_upstream_dns_toast": "Server upstream berhasil disimpan", <mask> "dns_test_ok_toast": "Server DNS yang ditentukan bekerja dengan benar", <mask> "dns_test_not_ok_toast": "Server \"{{key}}\": tidak dapat digunakan, mohon cek bahwa Anda telah menulisnya dengan benar", <mask> "dns_test_warning_toast": "Upstream \"{{key}}\" tidak menanggapi permintaan pengujian dan mungkin tidak berfungsi dengan baik", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", </s> add "dns_allowlists_desc": "Domeinen van DNS-toelatingslijsten zijn toegestaan, zelfs als ze op een van de blokkeerlijsten staan.",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/id.json
"example_upstream_regular_port": "DNS regolare (su UDP, con porta);",
<mask> "example_comment_meaning": "solo un commento;", <mask> "example_comment_hash": "# Anche un commento.", <mask> "example_regex_meaning": "blocca l'accesso ai domini corrispondenti alla specifica espressione regolare.", <mask> "example_upstream_regular": "DNS regolare (over UDP);", <mask> "example_upstream_udp": "DNS regolare (over UDP, nome host);", <mask> "example_upstream_dot": "<0>DNS su TLS</0> crittografato;", <mask> "example_upstream_doh": "<0>DNS su HTTPS</0> crittografato;", <mask> "example_upstream_doq": "<0>DNS su QUIC</0> crittografato;", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "dns_allowlists": "DNS toestemmingslijsten", </s> add "dns_allowlists": "DNS-toelatingslijsten",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/it.json
"dns_allowlists": "DNS-toelatingslijsten",
<mask> "no_servers_specified": "Geen servers gespecificeerd", <mask> "general_settings": "Algemene instellingen", <mask> "dns_settings": "DNS instellingen", <mask> "dns_blocklists": "DNS blokkeerlijsten", <mask> "dns_allowlists": "DNS toestemmingslijsten", <mask> "dns_blocklists_desc": "AdGuard Home zal domeinen blokkeren die voorkomen in de blokkeerlijsten.", <mask> "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", <mask> "custom_filtering_rules": "Aangepaste filter regels", <mask> "encryption_settings": "Encryptie instellingen", <mask> "dhcp_settings": "DHCP instellingen", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", </s> add "dns_allowlists_desc": "Domeinen van DNS-toelatingslijsten zijn toegestaan, zelfs als ze op een van de blokkeerlijsten staan.", </s> remove "no_whitelist_added": "Geen toestemmingslijsten toegevoegd", </s> add "no_whitelist_added": "Geen toelatingslijsten toegevoegd", </s> remove "add_allowlist": "Toestemmingslijst toevoegen", </s> add "add_allowlist": "Toelatingslijst toevoegen", </s> remove "choose_allowlist": "Toestemmingslijsten selecteren", </s> add "choose_allowlist": "Toelatingslijsten selecteren",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"dns_allowlists_desc": "Domeinen van DNS-toelatingslijsten zijn toegestaan, zelfs als ze op een van de blokkeerlijsten staan.",
<mask> "dns_settings": "DNS instellingen", <mask> "dns_blocklists": "DNS blokkeerlijsten", <mask> "dns_allowlists": "DNS toestemmingslijsten", <mask> "dns_blocklists_desc": "AdGuard Home zal domeinen blokkeren die voorkomen in de blokkeerlijsten.", <mask> "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", <mask> "custom_filtering_rules": "Aangepaste filter regels", <mask> "encryption_settings": "Encryptie instellingen", <mask> "dhcp_settings": "DHCP instellingen", <mask> "upstream_dns": "Upstream DNS-servers", <mask> "upstream_dns_help": "Een server-adres per regel invoeren. <a>Meer weten</a> over het configureren van upstream DNS-servers.", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "dns_allowlists": "DNS toestemmingslijsten", </s> add "dns_allowlists": "DNS-toelatingslijsten", </s> remove "no_whitelist_added": "Geen toestemmingslijsten toegevoegd", </s> add "no_whitelist_added": "Geen toelatingslijsten toegevoegd", </s> remove "add_allowlist": "Toestemmingslijst toevoegen", </s> add "add_allowlist": "Toelatingslijst toevoegen",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"no_whitelist_added": "Geen toelatingslijsten toegevoegd",
<mask> "delete_table_action": "Verwijderen", <mask> "elapsed": "Verstreken", <mask> "filters_and_hosts_hint": "AdGuard Home kan overweg met basic adblock regels en hosts bestanden syntaxis.", <mask> "no_blocklist_added": "Geen blokkeerlijsten toegevoegd", <mask> "no_whitelist_added": "Geen toestemmingslijsten toegevoegd", <mask> "add_blocklist": "Blokkeerlijst toevoegen", <mask> "add_allowlist": "Toestemmingslijst toevoegen", <mask> "cancel_btn": "Annuleren", <mask> "enter_name_hint": "Voeg naam toe", <mask> "enter_url_or_path_hint": "Voer een URL in of het pad van de lijst", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "add_allowlist": "Toestemmingslijst toevoegen", </s> add "add_allowlist": "Toelatingslijst toevoegen", </s> remove "new_allowlist": "Nieuwe toestemmingslijst", </s> add "new_allowlist": "Nieuwe toelatingslijst", </s> remove "choose_allowlist": "Toestemmingslijsten selecteren", </s> add "choose_allowlist": "Toelatingslijsten selecteren", </s> remove "dns_allowlists": "DNS toestemmingslijsten", </s> add "dns_allowlists": "DNS-toelatingslijsten", </s> remove "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", </s> add "dns_allowlists_desc": "Domeinen van DNS-toelatingslijsten zijn toegestaan, zelfs als ze op een van de blokkeerlijsten staan.",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"add_allowlist": "Toelatingslijst toevoegen",
<mask> "filters_and_hosts_hint": "AdGuard Home kan overweg met basic adblock regels en hosts bestanden syntaxis.", <mask> "no_blocklist_added": "Geen blokkeerlijsten toegevoegd", <mask> "no_whitelist_added": "Geen toestemmingslijsten toegevoegd", <mask> "add_blocklist": "Blokkeerlijst toevoegen", <mask> "add_allowlist": "Toestemmingslijst toevoegen", <mask> "cancel_btn": "Annuleren", <mask> "enter_name_hint": "Voeg naam toe", <mask> "enter_url_or_path_hint": "Voer een URL in of het pad van de lijst", <mask> "check_updates_btn": "Controleer op updates", <mask> "new_blocklist": "Nieuwe blokkeerlijst", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "no_whitelist_added": "Geen toestemmingslijsten toegevoegd", </s> add "no_whitelist_added": "Geen toelatingslijsten toegevoegd", </s> remove "new_allowlist": "Nieuwe toestemmingslijst", </s> add "new_allowlist": "Nieuwe toelatingslijst", </s> remove "edit_allowlist": "Toestemmingslijst beheren", </s> add "edit_allowlist": "Toelatingslijst bewerken", </s> remove "choose_allowlist": "Toestemmingslijsten selecteren", </s> add "choose_allowlist": "Toelatingslijsten selecteren", </s> remove "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", </s> add "dns_allowlists_desc": "Domeinen van DNS-toelatingslijsten zijn toegestaan, zelfs als ze op een van de blokkeerlijsten staan.",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"new_allowlist": "Nieuwe toelatingslijst",
<mask> "enter_name_hint": "Voeg naam toe", <mask> "enter_url_or_path_hint": "Voer een URL in of het pad van de lijst", <mask> "check_updates_btn": "Controleer op updates", <mask> "new_blocklist": "Nieuwe blokkeerlijst", <mask> "new_allowlist": "Nieuwe toestemmingslijst", <mask> "edit_blocklist": "Blokkeerlijst beheren", <mask> "edit_allowlist": "Toestemmingslijst beheren", <mask> "choose_blocklist": "Blokkeringslijsten selecteren", <mask> "choose_allowlist": "Toestemmingslijsten selecteren", <mask> "enter_valid_blocklist": "Voer een geldige URL in voor de blokkeerlijst.", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "edit_allowlist": "Toestemmingslijst beheren", </s> add "edit_allowlist": "Toelatingslijst bewerken", </s> remove "choose_allowlist": "Toestemmingslijsten selecteren", </s> add "choose_allowlist": "Toelatingslijsten selecteren", </s> remove "add_allowlist": "Toestemmingslijst toevoegen", </s> add "add_allowlist": "Toelatingslijst toevoegen", </s> remove "no_whitelist_added": "Geen toestemmingslijsten toegevoegd", </s> add "no_whitelist_added": "Geen toelatingslijsten toegevoegd", </s> remove "host_whitelisted": "De host staat op de toestemmingslijst", </s> add "host_whitelisted": "De host staat op de toelatingslijst",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"edit_allowlist": "Toelatingslijst bewerken",
<mask> "check_updates_btn": "Controleer op updates", <mask> "new_blocklist": "Nieuwe blokkeerlijst", <mask> "new_allowlist": "Nieuwe toestemmingslijst", <mask> "edit_blocklist": "Blokkeerlijst beheren", <mask> "edit_allowlist": "Toestemmingslijst beheren", <mask> "choose_blocklist": "Blokkeringslijsten selecteren", <mask> "choose_allowlist": "Toestemmingslijsten selecteren", <mask> "enter_valid_blocklist": "Voer een geldige URL in voor de blokkeerlijst.", <mask> "enter_valid_allowlist": "Voer een geldige URL in voor de toestemmingslijst.", <mask> "form_error_url_format": "Ongeldig URL-opmaak", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "choose_allowlist": "Toestemmingslijsten selecteren", </s> add "choose_allowlist": "Toelatingslijsten selecteren", </s> remove "new_allowlist": "Nieuwe toestemmingslijst", </s> add "new_allowlist": "Nieuwe toelatingslijst", </s> remove "add_allowlist": "Toestemmingslijst toevoegen", </s> add "add_allowlist": "Toelatingslijst toevoegen", </s> remove "host_whitelisted": "De host staat op de toestemmingslijst", </s> add "host_whitelisted": "De host staat op de toelatingslijst", </s> remove "no_whitelist_added": "Geen toestemmingslijsten toegevoegd", </s> add "no_whitelist_added": "Geen toelatingslijsten toegevoegd",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"choose_allowlist": "Toelatingslijsten selecteren",
<mask> "new_allowlist": "Nieuwe toestemmingslijst", <mask> "edit_blocklist": "Blokkeerlijst beheren", <mask> "edit_allowlist": "Toestemmingslijst beheren", <mask> "choose_blocklist": "Blokkeringslijsten selecteren", <mask> "choose_allowlist": "Toestemmingslijsten selecteren", <mask> "enter_valid_blocklist": "Voer een geldige URL in voor de blokkeerlijst.", <mask> "enter_valid_allowlist": "Voer een geldige URL in voor de toestemmingslijst.", <mask> "form_error_url_format": "Ongeldig URL-opmaak", <mask> "form_error_url_or_path_format": "Ongeldig URL of pad van de lijst", <mask> "custom_filter_rules": "Aangepaste filterregels", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "edit_allowlist": "Toestemmingslijst beheren", </s> add "edit_allowlist": "Toelatingslijst bewerken", </s> remove "new_allowlist": "Nieuwe toestemmingslijst", </s> add "new_allowlist": "Nieuwe toelatingslijst", </s> remove "add_allowlist": "Toestemmingslijst toevoegen", </s> add "add_allowlist": "Toelatingslijst toevoegen", </s> remove "no_whitelist_added": "Geen toestemmingslijsten toegevoegd", </s> add "no_whitelist_added": "Geen toelatingslijsten toegevoegd", </s> remove "host_whitelisted": "De host staat op de toestemmingslijst", </s> add "host_whitelisted": "De host staat op de toelatingslijst",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"example_upstream_regular_port": "standaard DNS (via UDP, met poort);",
<mask> "example_comment_meaning": "zomaar een opmerking;", <mask> "example_comment_hash": "# Ook een opmerking.", <mask> "example_regex_meaning": "toegang blokkeren tot de domeinen die overeenkomen met de opgegeven reguliere expressie.", <mask> "example_upstream_regular": "standaard DNS (over UDP);", <mask> "example_upstream_udp": "standaard DNS (via UDP, hostnaam);", <mask> "example_upstream_dot": "versleutelde <0>DNS-via-TLS</0>;", <mask> "example_upstream_doh": "versleutelde <0>DNS-via-HTTPS</0>;", <mask> "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0>;", <mask> "example_upstream_sdns": "<0>DNS Stamps</0> voor <1>DNSCrypt</1> of <2>DNS-via-HTTPS</2> oplossingen;", <mask> "example_upstream_tcp": "standaard DNS (over TCP);", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "dns_allowlists": "DNS toestemmingslijsten", </s> add "dns_allowlists": "DNS-toelatingslijsten", </s> remove "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", </s> add "dns_allowlists_desc": "Domeinen van DNS-toelatingslijsten zijn toegestaan, zelfs als ze op een van de blokkeerlijsten staan.",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"example_upstream_tcp_port": "standaard DNS (via TCP, met poort);",
<mask> "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0>;", <mask> "example_upstream_sdns": "<0>DNS Stamps</0> voor <1>DNSCrypt</1> of <2>DNS-via-HTTPS</2> oplossingen;", <mask> "example_upstream_tcp": "standaard DNS (over TCP);", <mask> "example_upstream_tcp_hostname": "standaard DNS (via TCP, hostnaam);", <mask> "all_lists_up_to_date_toast": "Alle lijsten zijn reeds actueel", <mask> "updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen", <mask> "dns_test_ok_toast": "Opgegeven DNS-servers werken correct", <mask> "dns_test_not_ok_toast": "Server \"{{key}}\": kon niet worden gebruikt, controleer of je het correct hebt geschreven", <mask> "dns_test_warning_toast": "Upstream \"{{key}}\" reageert niet op testverzoeken en werkt mogelijk niet goed", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", </s> add "dns_allowlists_desc": "Domeinen van DNS-toelatingslijsten zijn toegestaan, zelfs als ze op een van de blokkeerlijsten staan.", </s> remove "show_whitelisted_responses": "Op toestemmingslijst", </s> add "show_whitelisted_responses": "Op toelatingslijst",
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"host_whitelisted": "De host staat op de toelatingslijst",
<mask> "form_enter_host": "Voer een hostnaam in", <mask> "filtered_custom_rules": "Gefilterd door aangepaste filterregels", <mask> "choose_from_list": "Uit de lijst selecteren", <mask> "add_custom_list": "Aangepaste lijst toevoegen", <mask> "host_whitelisted": "De host staat op de toestemmingslijst", <mask> "check_ip": "IP-adressen: {{ip}}", <mask> "check_cname": "CNAME: {{cname}}", <mask> "check_reason": "Reden: {{reason}}", <mask> "check_service": "Servicenaam: {{service}}", <mask> "service_name": "Naam service", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "choose_allowlist": "Toestemmingslijsten selecteren", </s> add "choose_allowlist": "Toelatingslijsten selecteren", </s> remove "edit_allowlist": "Toestemmingslijst beheren", </s> add "edit_allowlist": "Toelatingslijst bewerken", </s> remove "new_allowlist": "Nieuwe toestemmingslijst", </s> add "new_allowlist": "Nieuwe toelatingslijst", </s> remove "add_allowlist": "Toestemmingslijst toevoegen", </s> add "add_allowlist": "Toelatingslijst toevoegen", </s> remove "show_whitelisted_responses": "Op toestemmingslijst", </s> add "show_whitelisted_responses": "Op toelatingslijst",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
"show_whitelisted_responses": "Op toelatingslijst",
<mask> "dnssec_enable_desc": "Zet de DNSSEC-vlag aan bij uitgaande DNS-query's en controleer het resultaat (DNSSEC-compatibele resolver is vereist)", <mask> "validated_with_dnssec": "Gevalideerd met DNSSEC", <mask> "all_queries": "Alle vragen", <mask> "show_blocked_responses": "Geblokkeerd", <mask> "show_whitelisted_responses": "Op toestemmingslijst", <mask> "show_processed_responses": "Verwerkt", <mask> "blocked_safebrowsing": "Geblokkeerd door Veilig browsen", <mask> "blocked_adult_websites": "Geblokkeerd door ouderlijk toezicht", <mask> "blocked_threats": "Geblokkeerde bedreigingen", <mask> "allowed": "Toegestaan", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "host_whitelisted": "De host staat op de toestemmingslijst", </s> add "host_whitelisted": "De host staat op de toelatingslijst", </s> remove "no_whitelist_added": "Geen toestemmingslijsten toegevoegd", </s> add "no_whitelist_added": "Geen toelatingslijsten toegevoegd", </s> remove "add_allowlist": "Toestemmingslijst toevoegen", </s> add "add_allowlist": "Toelatingslijst toevoegen", </s> remove "new_allowlist": "Nieuwe toestemmingslijst", </s> add "new_allowlist": "Nieuwe toelatingslijst",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/nl.json
await sleep(400);
<mask> requests.push(request(url, locale)); <mask> <mask> // Don't request the Crowdin API too aggressively to prevent spurious <mask> // 400 errors. <mask> await sleep(300); <mask> } <mask> <mask> Promise <mask> .all(requests) <mask> .then((res) => { </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> remove "show_whitelisted_responses": "Op toestemmingslijst", </s> add "show_whitelisted_responses": "Op toelatingslijst", </s> remove "host_whitelisted": "De host staat op de toestemmingslijst", </s> add "host_whitelisted": "De host staat op de toelatingslijst", </s> remove "choose_allowlist": "Toestemmingslijsten selecteren", </s> add "choose_allowlist": "Toelatingslijsten selecteren",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
scripts/translations/download.js
<mask> github.com/fsnotify/fsnotify v1.4.9 <mask> github.com/gobuffalo/packr v1.30.1 <mask> github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714 <mask> github.com/insomniacslk/dhcp v0.0.0-20200621044212-d74cd86ad5b8 <mask> github.com/joomcode/errorx v1.0.3 <mask> github.com/kardianos/service v1.1.0 <mask> github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7 <mask> github.com/mdlayher/raw v0.0.0-20191009151244-50f2db8cc065 <mask> github.com/miekg/dns v1.1.35 <mask> github.com/rogpeppe/go-internal v1.5.2 // indirect </s> Pull request:* all: remove github.com/joomcode/errorx dependency Merge in DNS/adguard-home from 2240-removing-errorx-dependency to master Squashed commit of the following: commit 5bbe0567356f06e3b9ee5b3dc38d357b472cacb1 Merge: a6040850d 02d16a0b4 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:32:22 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit a6040850da3cefb131208097477b0956e80063fb Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:23:36 2020 +0300 * dhcpd: convert some abbreviations to lowercase. commit d05bd51b994906b0ff52c5a8e779bd1f512f4bb7 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 12:47:20 2020 +0300 * agherr: last final fixes commit 164bca55035ff44e50b0abb33e129a0d24ffe87c Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 19:11:10 2020 +0300 * all: final fixes again commit a0ac26f409c0b28a176cf2861d52c2f471b59484 Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 18:51:39 2020 +0300 * all: final fixes commit 6147b02d402b513323b07e85856b348884f3a088 Merge: 9fd3af1a3 62cc334f4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:26:03 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit 9fd3af1a39a3189b5c41315a8ad1568ae5cb4fc9 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:23:08 2020 +0300 * all: remove useless helper commit 7cd9aeae639762b28b25f354d69c5cf74f670211 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 17:19:26 2020 +0300 * agherr: improved code tidiness commit a74a49236e9aaace070646dac710de9201105262 Merge: dc9dedbf2 df34ee5c0 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:54:29 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit dc9dedbf205756e3adaa3bc776d349bf3d8c69a5 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:40:08 2020 +0300 * agherr: improve and cover by tests commit fd6bfe9e282156cc60e006cb7cd46cce4d3a07a8 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 14:06:27 2020 +0300 * all: improve code quality commit ea00c2f8c5060e9611f9a80cfd0e4a039526d0c4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 13:03:57 2020 +0300 * all: fix linter style warnings commit 8e75e1a681a7218c2b4c69adfa2b7e1e2966f9ac Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 12:29:26 2020 +0300 * all: remove github.com/joomcode/errorx dependency Closes #2240. </s> remove github.com/joomcode/errorx v1.0.3 h1:3e1mi0u7/HTPNdg6d6DYyKGBhA5l9XpsfuVE29NxnWw= github.com/joomcode/errorx v1.0.3/go.mod h1:eQzdtdlNyN7etw6YCS4W4+lu442waxZYw5yvz0ULrRo= </s> add </s> remove var ( nextFilterID = time.Now().Unix() // semi-stable way to generate an unique ID ) </s> add var nextFilterID = time.Now().Unix() // semi-stable way to generate an unique ID </s> remove MaxAge: ls.LogMaxAge, //days </s> add MaxAge: ls.LogMaxAge, // days </s> remove "github.com/joomcode/errorx" </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> remove log.Debug("DHCPv4: received message: %s", req.Summary()) </s> add log.Debug("dhcpv4: received message: %s", req.Summary())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2baa33fb1f69dc01e91b585373dfedcb8c888693
go.mod
<mask> github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= <mask> github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= <mask> github.com/joomcode/errorx v1.0.1 h1:CalpDWz14ZHd68fIqluJasJosAewpz2TFaJALrUxjrk= <mask> github.com/joomcode/errorx v1.0.1/go.mod h1:kgco15ekB6cs+4Xjzo7SPeXzx38PbJzBwbnu9qfVNHQ= <mask> github.com/joomcode/errorx v1.0.3 h1:3e1mi0u7/HTPNdg6d6DYyKGBhA5l9XpsfuVE29NxnWw= <mask> github.com/joomcode/errorx v1.0.3/go.mod h1:eQzdtdlNyN7etw6YCS4W4+lu442waxZYw5yvz0ULrRo= <mask> github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= <mask> github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= <mask> github.com/kardianos/service v1.1.0 h1:QV2SiEeWK42P0aEmGcsAgjApw/lRxkwopvT+Gu6t1/0= <mask> github.com/kardianos/service v1.1.0/go.mod h1:RrJI2xn5vve/r32U5suTbeaSGoMU6GbNPoj36CVYcHc= <mask> github.com/karrick/godirwalk v1.10.12 h1:BqUm+LuJcXjGv1d2mj3gBiQyrQ57a0rYoAmhvJQ7RDU= </s> Pull request:* all: remove github.com/joomcode/errorx dependency Merge in DNS/adguard-home from 2240-removing-errorx-dependency to master Squashed commit of the following: commit 5bbe0567356f06e3b9ee5b3dc38d357b472cacb1 Merge: a6040850d 02d16a0b4 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:32:22 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit a6040850da3cefb131208097477b0956e80063fb Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:23:36 2020 +0300 * dhcpd: convert some abbreviations to lowercase. commit d05bd51b994906b0ff52c5a8e779bd1f512f4bb7 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 12:47:20 2020 +0300 * agherr: last final fixes commit 164bca55035ff44e50b0abb33e129a0d24ffe87c Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 19:11:10 2020 +0300 * all: final fixes again commit a0ac26f409c0b28a176cf2861d52c2f471b59484 Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 18:51:39 2020 +0300 * all: final fixes commit 6147b02d402b513323b07e85856b348884f3a088 Merge: 9fd3af1a3 62cc334f4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:26:03 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit 9fd3af1a39a3189b5c41315a8ad1568ae5cb4fc9 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:23:08 2020 +0300 * all: remove useless helper commit 7cd9aeae639762b28b25f354d69c5cf74f670211 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 17:19:26 2020 +0300 * agherr: improved code tidiness commit a74a49236e9aaace070646dac710de9201105262 Merge: dc9dedbf2 df34ee5c0 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:54:29 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit dc9dedbf205756e3adaa3bc776d349bf3d8c69a5 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:40:08 2020 +0300 * agherr: improve and cover by tests commit fd6bfe9e282156cc60e006cb7cd46cce4d3a07a8 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 14:06:27 2020 +0300 * all: improve code quality commit ea00c2f8c5060e9611f9a80cfd0e4a039526d0c4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 13:03:57 2020 +0300 * all: fix linter style warnings commit 8e75e1a681a7218c2b4c69adfa2b7e1e2966f9ac Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 12:29:26 2020 +0300 * all: remove github.com/joomcode/errorx dependency Closes #2240. </s> remove github.com/joomcode/errorx v1.0.3 </s> add </s> remove log.Debug("DHCPv4: bad option string: %s", o) </s> add log.Debug("dhcpv4: bad option string: %s", o) </s> remove return nil, nil, fmt.Errorf("filterlist.NewFileRuleList(): %s: %s", f.FilePath, err) </s> add return nil, nil, fmt.Errorf("filterlist.NewFileRuleList(): %s: %w", f.FilePath, err) </s> remove return nil, nil, fmt.Errorf("ioutil.ReadFile(): %s: %s", f.FilePath, err) </s> add return nil, nil, fmt.Errorf("ioutil.ReadFile(): %s: %w", f.FilePath, err) </s> remove return s, fmt.Errorf("DHCPv6: invalid range-start IP: %s", conf.RangeStart) </s> add return s, fmt.Errorf("dhcpv6: invalid range-start IP: %s", conf.RangeStart)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2baa33fb1f69dc01e91b585373dfedcb8c888693
go.sum
return false, fmt.Errorf("couldn't find interface by name %s: %w", ifaceName, err)
<mask> // and waits for a response for a period defined by defaultDiscoverTime <mask> func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { <mask> iface, err := net.InterfaceByName(ifaceName) <mask> if err != nil { <mask> return false, wrapErrPrint(err, "Couldn't find interface by name %s", ifaceName) <mask> } <mask> <mask> // get ipv4 address of an interface <mask> ifaceIPNet := getIfaceIPv4(*iface) <mask> if len(ifaceIPNet) == 0 { </s> Pull request:* all: remove github.com/joomcode/errorx dependency Merge in DNS/adguard-home from 2240-removing-errorx-dependency to master Squashed commit of the following: commit 5bbe0567356f06e3b9ee5b3dc38d357b472cacb1 Merge: a6040850d 02d16a0b4 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:32:22 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit a6040850da3cefb131208097477b0956e80063fb Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:23:36 2020 +0300 * dhcpd: convert some abbreviations to lowercase. commit d05bd51b994906b0ff52c5a8e779bd1f512f4bb7 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 12:47:20 2020 +0300 * agherr: last final fixes commit 164bca55035ff44e50b0abb33e129a0d24ffe87c Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 19:11:10 2020 +0300 * all: final fixes again commit a0ac26f409c0b28a176cf2861d52c2f471b59484 Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 18:51:39 2020 +0300 * all: final fixes commit 6147b02d402b513323b07e85856b348884f3a088 Merge: 9fd3af1a3 62cc334f4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:26:03 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit 9fd3af1a39a3189b5c41315a8ad1568ae5cb4fc9 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:23:08 2020 +0300 * all: remove useless helper commit 7cd9aeae639762b28b25f354d69c5cf74f670211 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 17:19:26 2020 +0300 * agherr: improved code tidiness commit a74a49236e9aaace070646dac710de9201105262 Merge: dc9dedbf2 df34ee5c0 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:54:29 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit dc9dedbf205756e3adaa3bc776d349bf3d8c69a5 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:40:08 2020 +0300 * agherr: improve and cover by tests commit fd6bfe9e282156cc60e006cb7cd46cce4d3a07a8 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 14:06:27 2020 +0300 * all: improve code quality commit ea00c2f8c5060e9611f9a80cfd0e4a039526d0c4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 13:03:57 2020 +0300 * all: fix linter style warnings commit 8e75e1a681a7218c2b4c69adfa2b7e1e2966f9ac Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 12:29:26 2020 +0300 * all: remove github.com/joomcode/errorx dependency Closes #2240. </s> remove return false, fmt.Errorf("DHCPv6: net.InterfaceByName: %s: %s", ifaceName, err) </s> add return false, fmt.Errorf("dhcpv6: net.InterfaceByName: %s: %w", ifaceName, err) </s> remove return wrapErrPrint(err, "Couldn't find interface by name %s", s.conf.InterfaceName) </s> add return fmt.Errorf("couldn't find interface by name %s: %w", s.conf.InterfaceName, err) </s> remove return fmt.Errorf("DHCPv4: Couldn't find interface by name %s: %s", s.conf.InterfaceName, err) </s> add return fmt.Errorf("dhcpv4: Couldn't find interface by name %s: %w", s.conf.InterfaceName, err) </s> remove log.Debug("DHCPv4: starting...") </s> add log.Debug("dhcpv4: starting...") </s> remove return nil, fmt.Errorf("couldn't get list of interfaces: %s", err) </s> add return nil, fmt.Errorf("couldn't get list of interfaces: %w", err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2baa33fb1f69dc01e91b585373dfedcb8c888693
internal/dhcpd/check_other_dhcp.go
return false, fmt.Errorf("dhcpv4.NewDiscovery: %w", err)
<mask> hostname, _ := os.Hostname() <mask> <mask> req, err := dhcpv4.NewDiscovery(iface.HardwareAddr) <mask> if err != nil { <mask> return false, fmt.Errorf("dhcpv4.NewDiscovery: %s", err) <mask> } <mask> req.Options.Update(dhcpv4.OptClientIdentifier(iface.HardwareAddr)) <mask> req.Options.Update(dhcpv4.OptHostName(hostname)) <mask> <mask> // resolve 0.0.0.0:68 </s> Pull request:* all: remove github.com/joomcode/errorx dependency Merge in DNS/adguard-home from 2240-removing-errorx-dependency to master Squashed commit of the following: commit 5bbe0567356f06e3b9ee5b3dc38d357b472cacb1 Merge: a6040850d 02d16a0b4 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:32:22 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit a6040850da3cefb131208097477b0956e80063fb Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:23:36 2020 +0300 * dhcpd: convert some abbreviations to lowercase. commit d05bd51b994906b0ff52c5a8e779bd1f512f4bb7 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 12:47:20 2020 +0300 * agherr: last final fixes commit 164bca55035ff44e50b0abb33e129a0d24ffe87c Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 19:11:10 2020 +0300 * all: final fixes again commit a0ac26f409c0b28a176cf2861d52c2f471b59484 Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 18:51:39 2020 +0300 * all: final fixes commit 6147b02d402b513323b07e85856b348884f3a088 Merge: 9fd3af1a3 62cc334f4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:26:03 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit 9fd3af1a39a3189b5c41315a8ad1568ae5cb4fc9 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:23:08 2020 +0300 * all: remove useless helper commit 7cd9aeae639762b28b25f354d69c5cf74f670211 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 17:19:26 2020 +0300 * agherr: improved code tidiness commit a74a49236e9aaace070646dac710de9201105262 Merge: dc9dedbf2 df34ee5c0 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:54:29 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit dc9dedbf205756e3adaa3bc776d349bf3d8c69a5 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:40:08 2020 +0300 * agherr: improve and cover by tests commit fd6bfe9e282156cc60e006cb7cd46cce4d3a07a8 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 14:06:27 2020 +0300 * all: improve code quality commit ea00c2f8c5060e9611f9a80cfd0e4a039526d0c4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 13:03:57 2020 +0300 * all: fix linter style warnings commit 8e75e1a681a7218c2b4c69adfa2b7e1e2966f9ac Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 12:29:26 2020 +0300 * all: remove github.com/joomcode/errorx dependency Closes #2240. </s> remove return false, fmt.Errorf("DHCPv6: dhcpv6.NewSolicit: %s", err) </s> add return false, fmt.Errorf("dhcpv6: dhcpv6.NewSolicit: %w", err) </s> remove return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", src) </s> add return false, fmt.Errorf("couldn't resolve UDP address %s: %w", src, err) </s> remove return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", dst) </s> add return false, fmt.Errorf("couldn't resolve UDP address %s: %w", dst, err) </s> remove return false, fmt.Errorf("DHCPv6: Couldn't resolve UDP address %s: %s", dst, err) </s> add return false, fmt.Errorf("dhcpv6: Couldn't resolve UDP address %s: %w", dst, err) </s> remove return false, wrapErrPrint(err, "Resolved UDP address is not %s", src) </s> add return false, fmt.Errorf("resolved UDP address is not %s: %w", src, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2baa33fb1f69dc01e91b585373dfedcb8c888693
internal/dhcpd/check_other_dhcp.go
return false, fmt.Errorf("couldn't resolve UDP address %s: %w", src, err)
<mask> <mask> // resolve 0.0.0.0:68 <mask> udpAddr, err := net.ResolveUDPAddr("udp4", src) <mask> if err != nil { <mask> return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", src) <mask> } <mask> <mask> if !udpAddr.IP.To4().Equal(srcIP) { <mask> return false, wrapErrPrint(err, "Resolved UDP address is not %s", src) <mask> } </s> Pull request:* all: remove github.com/joomcode/errorx dependency Merge in DNS/adguard-home from 2240-removing-errorx-dependency to master Squashed commit of the following: commit 5bbe0567356f06e3b9ee5b3dc38d357b472cacb1 Merge: a6040850d 02d16a0b4 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:32:22 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit a6040850da3cefb131208097477b0956e80063fb Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:23:36 2020 +0300 * dhcpd: convert some abbreviations to lowercase. commit d05bd51b994906b0ff52c5a8e779bd1f512f4bb7 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 12:47:20 2020 +0300 * agherr: last final fixes commit 164bca55035ff44e50b0abb33e129a0d24ffe87c Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 19:11:10 2020 +0300 * all: final fixes again commit a0ac26f409c0b28a176cf2861d52c2f471b59484 Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 18:51:39 2020 +0300 * all: final fixes commit 6147b02d402b513323b07e85856b348884f3a088 Merge: 9fd3af1a3 62cc334f4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:26:03 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit 9fd3af1a39a3189b5c41315a8ad1568ae5cb4fc9 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:23:08 2020 +0300 * all: remove useless helper commit 7cd9aeae639762b28b25f354d69c5cf74f670211 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 17:19:26 2020 +0300 * agherr: improved code tidiness commit a74a49236e9aaace070646dac710de9201105262 Merge: dc9dedbf2 df34ee5c0 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:54:29 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit dc9dedbf205756e3adaa3bc776d349bf3d8c69a5 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:40:08 2020 +0300 * agherr: improve and cover by tests commit fd6bfe9e282156cc60e006cb7cd46cce4d3a07a8 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 14:06:27 2020 +0300 * all: improve code quality commit ea00c2f8c5060e9611f9a80cfd0e4a039526d0c4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 13:03:57 2020 +0300 * all: fix linter style warnings commit 8e75e1a681a7218c2b4c69adfa2b7e1e2966f9ac Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 12:29:26 2020 +0300 * all: remove github.com/joomcode/errorx dependency Closes #2240. </s> remove return false, wrapErrPrint(err, "Resolved UDP address is not %s", src) </s> add return false, fmt.Errorf("resolved UDP address is not %s: %w", src, err) </s> remove return false, wrapErrPrint(err, "DHCPv6: Couldn't resolve UDP address %s", src) </s> add return false, fmt.Errorf("dhcpv6: Couldn't resolve UDP address %s: %w", src, err) </s> remove return false, wrapErrPrint(err, "DHCPv6: Resolved UDP address is not %s", src) </s> add return false, fmt.Errorf("dhcpv6: Resolved UDP address is not %s: %w", src, err) </s> remove return false, fmt.Errorf("DHCPv6: dhcpv6.NewSolicit: %s", err) </s> add return false, fmt.Errorf("dhcpv6: dhcpv6.NewSolicit: %w", err) </s> remove return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", dst) </s> add return false, fmt.Errorf("couldn't resolve UDP address %s: %w", dst, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2baa33fb1f69dc01e91b585373dfedcb8c888693
internal/dhcpd/check_other_dhcp.go
return false, fmt.Errorf("resolved UDP address is not %s: %w", src, err)
<mask> return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", src) <mask> } <mask> <mask> if !udpAddr.IP.To4().Equal(srcIP) { <mask> return false, wrapErrPrint(err, "Resolved UDP address is not %s", src) <mask> } <mask> <mask> // resolve 255.255.255.255:67 <mask> dstAddr, err := net.ResolveUDPAddr("udp4", dst) <mask> if err != nil { </s> Pull request:* all: remove github.com/joomcode/errorx dependency Merge in DNS/adguard-home from 2240-removing-errorx-dependency to master Squashed commit of the following: commit 5bbe0567356f06e3b9ee5b3dc38d357b472cacb1 Merge: a6040850d 02d16a0b4 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:32:22 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit a6040850da3cefb131208097477b0956e80063fb Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:23:36 2020 +0300 * dhcpd: convert some abbreviations to lowercase. commit d05bd51b994906b0ff52c5a8e779bd1f512f4bb7 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 12:47:20 2020 +0300 * agherr: last final fixes commit 164bca55035ff44e50b0abb33e129a0d24ffe87c Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 19:11:10 2020 +0300 * all: final fixes again commit a0ac26f409c0b28a176cf2861d52c2f471b59484 Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 18:51:39 2020 +0300 * all: final fixes commit 6147b02d402b513323b07e85856b348884f3a088 Merge: 9fd3af1a3 62cc334f4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:26:03 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit 9fd3af1a39a3189b5c41315a8ad1568ae5cb4fc9 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:23:08 2020 +0300 * all: remove useless helper commit 7cd9aeae639762b28b25f354d69c5cf74f670211 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 17:19:26 2020 +0300 * agherr: improved code tidiness commit a74a49236e9aaace070646dac710de9201105262 Merge: dc9dedbf2 df34ee5c0 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:54:29 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit dc9dedbf205756e3adaa3bc776d349bf3d8c69a5 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:40:08 2020 +0300 * agherr: improve and cover by tests commit fd6bfe9e282156cc60e006cb7cd46cce4d3a07a8 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 14:06:27 2020 +0300 * all: improve code quality commit ea00c2f8c5060e9611f9a80cfd0e4a039526d0c4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 13:03:57 2020 +0300 * all: fix linter style warnings commit 8e75e1a681a7218c2b4c69adfa2b7e1e2966f9ac Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 12:29:26 2020 +0300 * all: remove github.com/joomcode/errorx dependency Closes #2240. </s> remove return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", src) </s> add return false, fmt.Errorf("couldn't resolve UDP address %s: %w", src, err) </s> remove return false, wrapErrPrint(err, "DHCPv6: Resolved UDP address is not %s", src) </s> add return false, fmt.Errorf("dhcpv6: Resolved UDP address is not %s: %w", src, err) </s> remove return false, wrapErrPrint(err, "DHCPv6: Couldn't resolve UDP address %s", src) </s> add return false, fmt.Errorf("dhcpv6: Couldn't resolve UDP address %s: %w", src, err) </s> remove return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", dst) </s> add return false, fmt.Errorf("couldn't resolve UDP address %s: %w", dst, err) </s> remove return false, fmt.Errorf("DHCPv6: dhcpv6.NewSolicit: %s", err) </s> add return false, fmt.Errorf("dhcpv6: dhcpv6.NewSolicit: %w", err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2baa33fb1f69dc01e91b585373dfedcb8c888693
internal/dhcpd/check_other_dhcp.go
return false, fmt.Errorf("couldn't resolve UDP address %s: %w", dst, err)
<mask> <mask> // resolve 255.255.255.255:67 <mask> dstAddr, err := net.ResolveUDPAddr("udp4", dst) <mask> if err != nil { <mask> return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", dst) <mask> } <mask> <mask> // bind to 0.0.0.0:68 <mask> log.Tracef("Listening to udp4 %+v", udpAddr) <mask> c, err := nclient4.NewRawUDPConn(ifaceName, 68) </s> Pull request:* all: remove github.com/joomcode/errorx dependency Merge in DNS/adguard-home from 2240-removing-errorx-dependency to master Squashed commit of the following: commit 5bbe0567356f06e3b9ee5b3dc38d357b472cacb1 Merge: a6040850d 02d16a0b4 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:32:22 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit a6040850da3cefb131208097477b0956e80063fb Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:23:36 2020 +0300 * dhcpd: convert some abbreviations to lowercase. commit d05bd51b994906b0ff52c5a8e779bd1f512f4bb7 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 12:47:20 2020 +0300 * agherr: last final fixes commit 164bca55035ff44e50b0abb33e129a0d24ffe87c Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 19:11:10 2020 +0300 * all: final fixes again commit a0ac26f409c0b28a176cf2861d52c2f471b59484 Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 18:51:39 2020 +0300 * all: final fixes commit 6147b02d402b513323b07e85856b348884f3a088 Merge: 9fd3af1a3 62cc334f4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:26:03 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit 9fd3af1a39a3189b5c41315a8ad1568ae5cb4fc9 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:23:08 2020 +0300 * all: remove useless helper commit 7cd9aeae639762b28b25f354d69c5cf74f670211 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 17:19:26 2020 +0300 * agherr: improved code tidiness commit a74a49236e9aaace070646dac710de9201105262 Merge: dc9dedbf2 df34ee5c0 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:54:29 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit dc9dedbf205756e3adaa3bc776d349bf3d8c69a5 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:40:08 2020 +0300 * agherr: improve and cover by tests commit fd6bfe9e282156cc60e006cb7cd46cce4d3a07a8 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 14:06:27 2020 +0300 * all: improve code quality commit ea00c2f8c5060e9611f9a80cfd0e4a039526d0c4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 13:03:57 2020 +0300 * all: fix linter style warnings commit 8e75e1a681a7218c2b4c69adfa2b7e1e2966f9ac Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 12:29:26 2020 +0300 * all: remove github.com/joomcode/errorx dependency Closes #2240. </s> remove return false, wrapErrPrint(err, "Couldn't listen on :68") </s> add return false, fmt.Errorf("couldn't listen on :68: %w", err) </s> remove return false, wrapErrPrint(err, "Resolved UDP address is not %s", src) </s> add return false, fmt.Errorf("resolved UDP address is not %s: %w", src, err) </s> remove return false, fmt.Errorf("DHCPv6: Couldn't resolve UDP address %s: %s", dst, err) </s> add return false, fmt.Errorf("dhcpv6: Couldn't resolve UDP address %s: %w", dst, err) </s> remove return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", src) </s> add return false, fmt.Errorf("couldn't resolve UDP address %s: %w", src, err) </s> remove return false, wrapErrPrint(err, "DHCPv6: Resolved UDP address is not %s", src) </s> add return false, fmt.Errorf("dhcpv6: Resolved UDP address is not %s: %w", src, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2baa33fb1f69dc01e91b585373dfedcb8c888693
internal/dhcpd/check_other_dhcp.go
return false, fmt.Errorf("couldn't listen on :68: %w", err)
<mask> // bind to 0.0.0.0:68 <mask> log.Tracef("Listening to udp4 %+v", udpAddr) <mask> c, err := nclient4.NewRawUDPConn(ifaceName, 68) <mask> if err != nil { <mask> return false, wrapErrPrint(err, "Couldn't listen on :68") <mask> } <mask> if c != nil { <mask> defer c.Close() <mask> } <mask> </s> Pull request:* all: remove github.com/joomcode/errorx dependency Merge in DNS/adguard-home from 2240-removing-errorx-dependency to master Squashed commit of the following: commit 5bbe0567356f06e3b9ee5b3dc38d357b472cacb1 Merge: a6040850d 02d16a0b4 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:32:22 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit a6040850da3cefb131208097477b0956e80063fb Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:23:36 2020 +0300 * dhcpd: convert some abbreviations to lowercase. commit d05bd51b994906b0ff52c5a8e779bd1f512f4bb7 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 12:47:20 2020 +0300 * agherr: last final fixes commit 164bca55035ff44e50b0abb33e129a0d24ffe87c Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 19:11:10 2020 +0300 * all: final fixes again commit a0ac26f409c0b28a176cf2861d52c2f471b59484 Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 18:51:39 2020 +0300 * all: final fixes commit 6147b02d402b513323b07e85856b348884f3a088 Merge: 9fd3af1a3 62cc334f4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:26:03 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit 9fd3af1a39a3189b5c41315a8ad1568ae5cb4fc9 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:23:08 2020 +0300 * all: remove useless helper commit 7cd9aeae639762b28b25f354d69c5cf74f670211 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 17:19:26 2020 +0300 * agherr: improved code tidiness commit a74a49236e9aaace070646dac710de9201105262 Merge: dc9dedbf2 df34ee5c0 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:54:29 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit dc9dedbf205756e3adaa3bc776d349bf3d8c69a5 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:40:08 2020 +0300 * agherr: improve and cover by tests commit fd6bfe9e282156cc60e006cb7cd46cce4d3a07a8 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 14:06:27 2020 +0300 * all: improve code quality commit ea00c2f8c5060e9611f9a80cfd0e4a039526d0c4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 13:03:57 2020 +0300 * all: fix linter style warnings commit 8e75e1a681a7218c2b4c69adfa2b7e1e2966f9ac Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 12:29:26 2020 +0300 * all: remove github.com/joomcode/errorx dependency Closes #2240. </s> remove return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", dst) </s> add return false, fmt.Errorf("couldn't resolve UDP address %s: %w", dst, err) </s> remove return false, fmt.Errorf("DHCPv6: Couldn't listen on :546: %s", err) </s> add return false, fmt.Errorf("dhcpv6: Couldn't listen on :546: %w", err) </s> remove return false, fmt.Errorf("DHCPv6: Couldn't resolve UDP address %s: %s", dst, err) </s> add return false, fmt.Errorf("dhcpv6: Couldn't resolve UDP address %s: %w", dst, err) </s> remove return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", src) </s> add return false, fmt.Errorf("couldn't resolve UDP address %s: %w", src, err) </s> remove return false, wrapErrPrint(err, "Couldn't send a packet to %s", dst) </s> add return false, fmt.Errorf("couldn't send a packet to %s: %w", dst, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2baa33fb1f69dc01e91b585373dfedcb8c888693
internal/dhcpd/check_other_dhcp.go
return false, fmt.Errorf("couldn't send a packet to %s: %w", dst, err)
<mask> <mask> // send to 255.255.255.255:67 <mask> _, err = c.WriteTo(req.ToBytes(), dstAddr) <mask> if err != nil { <mask> return false, wrapErrPrint(err, "Couldn't send a packet to %s", dst) <mask> } <mask> <mask> for { <mask> // wait for answer <mask> log.Tracef("Waiting %v for an answer", defaultDiscoverTime) </s> Pull request:* all: remove github.com/joomcode/errorx dependency Merge in DNS/adguard-home from 2240-removing-errorx-dependency to master Squashed commit of the following: commit 5bbe0567356f06e3b9ee5b3dc38d357b472cacb1 Merge: a6040850d 02d16a0b4 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:32:22 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit a6040850da3cefb131208097477b0956e80063fb Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 14:23:36 2020 +0300 * dhcpd: convert some abbreviations to lowercase. commit d05bd51b994906b0ff52c5a8e779bd1f512f4bb7 Author: Eugene Burkov <[email protected]> Date: Thu Nov 5 12:47:20 2020 +0300 * agherr: last final fixes commit 164bca55035ff44e50b0abb33e129a0d24ffe87c Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 19:11:10 2020 +0300 * all: final fixes again commit a0ac26f409c0b28a176cf2861d52c2f471b59484 Author: Ainar Garipov <[email protected]> Date: Tue Nov 3 18:51:39 2020 +0300 * all: final fixes commit 6147b02d402b513323b07e85856b348884f3a088 Merge: 9fd3af1a3 62cc334f4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:26:03 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit 9fd3af1a39a3189b5c41315a8ad1568ae5cb4fc9 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 18:23:08 2020 +0300 * all: remove useless helper commit 7cd9aeae639762b28b25f354d69c5cf74f670211 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 17:19:26 2020 +0300 * agherr: improved code tidiness commit a74a49236e9aaace070646dac710de9201105262 Merge: dc9dedbf2 df34ee5c0 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:54:29 2020 +0300 Merge branch 'master' into 2240-removing-errorx-dependency commit dc9dedbf205756e3adaa3bc776d349bf3d8c69a5 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 16:40:08 2020 +0300 * agherr: improve and cover by tests commit fd6bfe9e282156cc60e006cb7cd46cce4d3a07a8 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 14:06:27 2020 +0300 * all: improve code quality commit ea00c2f8c5060e9611f9a80cfd0e4a039526d0c4 Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 13:03:57 2020 +0300 * all: fix linter style warnings commit 8e75e1a681a7218c2b4c69adfa2b7e1e2966f9ac Author: Eugene Burkov <[email protected]> Date: Tue Nov 3 12:29:26 2020 +0300 * all: remove github.com/joomcode/errorx dependency Closes #2240. </s> remove return false, fmt.Errorf("DHCPv6: Couldn't send a packet to %s: %s", dst, err) </s> add return false, fmt.Errorf("dhcpv6: Couldn't send a packet to %s: %w", dst, err) </s> remove return false, wrapErrPrint(err, "Couldn't resolve UDP address %s", dst) </s> add return false, fmt.Errorf("couldn't resolve UDP address %s: %w", dst, err) </s> remove log.Debug("DHCPv6 RA: starting to send periodic RouterAdvertisement packets") </s> add log.Debug("dhcpv6 ra: starting to send periodic RouterAdvertisement packets") </s> remove return false, wrapErrPrint(err, "Resolved UDP address is not %s", src) </s> add return false, fmt.Errorf("resolved UDP address is not %s: %w", src, err) </s> remove return false, wrapErrPrint(err, "Couldn't find interface by name %s", ifaceName) </s> add return false, fmt.Errorf("couldn't find interface by name %s: %w", ifaceName, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/2baa33fb1f69dc01e91b585373dfedcb8c888693
internal/dhcpd/check_other_dhcp.go