docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
listlengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
req := &dnsConfig{} err := json.NewDecoder(r.Body).Decode(req)
<mask> return min <= max <mask> } <mask> <mask> func (s *Server) handleSetConfig(w http.ResponseWriter, r *http.Request) { <mask> req := dnsConfig{} <mask> err := json.NewDecoder(r.Body).Decode(&req) <mask> if err != nil { <mask> aghhttp.Error(r, w, http.StatusBadRequest, "json Encode: %s", err) <mask> <mask> return <mask> } </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "json Encode: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "decoding request: %s", err) </s> remove if req.Upstreams != nil { if err = ValidateUpstreams(*req.Upstreams); err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) return } } var errBoot string if errBoot, err = req.checkBootstrap(); err != nil { aghhttp.Error( r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", errBoot, err, ) return } switch { case !req.checkBlockingMode(): aghhttp.Error(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") return case !req.checkUpstreamsMode(): aghhttp.Error(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") return case !req.checkCacheTTL(): aghhttp.Error( r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max", ) </s> add err = req.validate(s.subnetDetector) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) </s> remove if err = s.Reconfigure(nil); err != nil { </s> add err = s.Reconfigure(nil) if err != nil { </s> remove func (s *Server) setConfig(dc dnsConfig) (restart bool) { </s> add func (s *Server) setConfig(dc *dnsConfig) (restart bool) { </s> remove func (s *Server) setConfigRestartable(dc dnsConfig) (restart bool) { </s> add func (s *Server) setConfigRestartable(dc *dnsConfig) (restart bool) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
aghhttp.Error(r, w, http.StatusBadRequest, "decoding request: %s", err)
<mask> func (s *Server) handleSetConfig(w http.ResponseWriter, r *http.Request) { <mask> req := dnsConfig{} <mask> err := json.NewDecoder(r.Body).Decode(&req) <mask> if err != nil { <mask> aghhttp.Error(r, w, http.StatusBadRequest, "json Encode: %s", err) <mask> <mask> return <mask> } <mask> <mask> if req.Upstreams != nil { </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove req := dnsConfig{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req := &dnsConfig{} err := json.NewDecoder(r.Body).Decode(req) </s> remove if req.Upstreams != nil { if err = ValidateUpstreams(*req.Upstreams); err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) return } } var errBoot string if errBoot, err = req.checkBootstrap(); err != nil { aghhttp.Error( r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", errBoot, err, ) return } switch { case !req.checkBlockingMode(): aghhttp.Error(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") return case !req.checkUpstreamsMode(): aghhttp.Error(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") return case !req.checkCacheTTL(): aghhttp.Error( r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max", ) </s> add err = req.validate(s.subnetDetector) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) </s> remove if err = s.Reconfigure(nil); err != nil { </s> add err = s.Reconfigure(nil) if err != nil { </s> remove func (req *dnsConfig) checkBootstrap() (string, error) { if req.Bootstraps == nil { return "", nil </s> add // validate returns an error if any field of req is invalid. func (req *dnsConfig) validate(snd *aghnet.SubnetDetector) (err error) { if req.Upstreams != nil { err = ValidateUpstreams(*req.Upstreams) if err != nil { return fmt.Errorf("validating upstream servers: %w", err) } </s> remove func (s *Server) setConfig(dc dnsConfig) (restart bool) { </s> add func (s *Server) setConfig(dc *dnsConfig) (restart bool) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
err = req.validate(s.subnetDetector) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err)
<mask> <mask> return <mask> } <mask> <mask> if req.Upstreams != nil { <mask> if err = ValidateUpstreams(*req.Upstreams); err != nil { <mask> aghhttp.Error(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) <mask> <mask> return <mask> } <mask> } <mask> <mask> var errBoot string <mask> if errBoot, err = req.checkBootstrap(); err != nil { <mask> aghhttp.Error( <mask> r, <mask> w, <mask> http.StatusBadRequest, <mask> "%s can not be used as bootstrap dns cause: %s", <mask> errBoot, <mask> err, <mask> ) <mask> <mask> return <mask> } <mask> <mask> switch { <mask> case !req.checkBlockingMode(): <mask> aghhttp.Error(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") <mask> <mask> return <mask> case !req.checkUpstreamsMode(): <mask> aghhttp.Error(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") <mask> <mask> return <mask> case !req.checkCacheTTL(): <mask> aghhttp.Error( <mask> r, <mask> w, <mask> http.StatusBadRequest, <mask> "cache_ttl_min must be less or equal than cache_ttl_max", <mask> ) <mask> <mask> return <mask> default: <mask> // Go on. <mask> } </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "json Encode: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "decoding request: %s", err) </s> remove return "", nil </s> add switch { case !req.checkBlockingMode(): return errors.Error("blocking_mode: incorrect value") case !req.checkUpstreamsMode(): return errors.Error("upstream_mode: incorrect value") case !req.checkCacheTTL(): return errors.Error("cache_ttl_min must be less or equal than cache_ttl_max") default: return nil } </s> remove req := dnsConfig{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req := &dnsConfig{} err := json.NewDecoder(r.Body).Decode(req) </s> remove default: // Go on. </s> add </s> remove if err = s.Reconfigure(nil); err != nil { </s> add err = s.Reconfigure(nil) if err != nil {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
<mask> "cache_ttl_min must be less or equal than cache_ttl_max", <mask> ) <mask> <mask> return <mask> default: <mask> // Go on. <mask> } <mask> <mask> restart := s.setConfig(req) <mask> s.conf.ConfigModified() <mask> </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove if req.Upstreams != nil { if err = ValidateUpstreams(*req.Upstreams); err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) return } } var errBoot string if errBoot, err = req.checkBootstrap(); err != nil { aghhttp.Error( r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", errBoot, err, ) return } switch { case !req.checkBlockingMode(): aghhttp.Error(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") return case !req.checkUpstreamsMode(): aghhttp.Error(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") return case !req.checkCacheTTL(): aghhttp.Error( r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max", ) </s> add err = req.validate(s.subnetDetector) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) </s> remove return "", nil </s> add switch { case !req.checkBlockingMode(): return errors.Error("blocking_mode: incorrect value") case !req.checkUpstreamsMode(): return errors.Error("upstream_mode: incorrect value") case !req.checkCacheTTL(): return errors.Error("cache_ttl_min must be less or equal than cache_ttl_max") default: return nil } </s> remove if err = s.Reconfigure(nil); err != nil { </s> add err = s.Reconfigure(nil) if err != nil { </s> remove wantSet: `a can not be used as bootstrap dns cause: ` + `invalid bootstrap server address: ` + </s> add wantSet: `checking bootstrap a: invalid address: ` + </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
err = s.Reconfigure(nil) if err != nil {
<mask> restart := s.setConfig(req) <mask> s.conf.ConfigModified() <mask> <mask> if restart { <mask> if err = s.Reconfigure(nil); err != nil { <mask> aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) <mask> } <mask> } <mask> } <mask> </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove if req.Upstreams != nil { if err = ValidateUpstreams(*req.Upstreams); err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) return } } var errBoot string if errBoot, err = req.checkBootstrap(); err != nil { aghhttp.Error( r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", errBoot, err, ) return } switch { case !req.checkBlockingMode(): aghhttp.Error(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") return case !req.checkUpstreamsMode(): aghhttp.Error(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") return case !req.checkCacheTTL(): aghhttp.Error( r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max", ) </s> add err = req.validate(s.subnetDetector) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "json Encode: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "decoding request: %s", err) </s> remove if dc.RateLimit != nil { restart = restart || s.conf.Ratelimit != *dc.RateLimit </s> add if dc.RateLimit != nil && s.conf.Ratelimit != *dc.RateLimit { </s> remove default: // Go on. </s> add </s> remove req := dnsConfig{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req := &dnsConfig{} err := json.NewDecoder(r.Body).Decode(req)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
func (s *Server) setConfigRestartable(dc *dnsConfig) (restart bool) {
<mask> } <mask> } <mask> } <mask> <mask> func (s *Server) setConfigRestartable(dc dnsConfig) (restart bool) { <mask> if dc.Upstreams != nil { <mask> s.conf.UpstreamDNS = *dc.Upstreams <mask> restart = true <mask> } <mask> </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove func (s *Server) setConfig(dc dnsConfig) (restart bool) { </s> add func (s *Server) setConfig(dc *dnsConfig) (restart bool) { </s> remove if dc.RateLimit != nil { restart = restart || s.conf.Ratelimit != *dc.RateLimit </s> add if dc.RateLimit != nil && s.conf.Ratelimit != *dc.RateLimit { </s> remove if err = s.Reconfigure(nil); err != nil { </s> add err = s.Reconfigure(nil) if err != nil { </s> remove for _, valid := range []string{ "", "fastest_addr", "parallel", } { if *req.UpstreamMode == valid { return true </s> add var b string defer func() { err = errors.Annotate(err, "checking bootstrap %s: invalid address: %w", b) }() for _, b = range *req.Bootstraps { if b == "" { return errors.Error("empty") } if _, err = upstream.NewResolver(b, nil); err != nil { return err
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
if dc.RateLimit != nil && s.conf.Ratelimit != *dc.RateLimit {
<mask> s.conf.BootstrapDNS = *dc.Bootstraps <mask> restart = true <mask> } <mask> <mask> if dc.RateLimit != nil { <mask> restart = restart || s.conf.Ratelimit != *dc.RateLimit <mask> s.conf.Ratelimit = *dc.RateLimit <mask> } <mask> <mask> if dc.EDNSCSEnabled != nil { <mask> s.conf.EnableEDNSClientSubnet = *dc.EDNSCSEnabled </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove if err = s.Reconfigure(nil); err != nil { </s> add err = s.Reconfigure(nil) if err != nil { </s> remove func (s *Server) setConfigRestartable(dc dnsConfig) (restart bool) { </s> add func (s *Server) setConfigRestartable(dc *dnsConfig) (restart bool) { </s> remove func (s *Server) setConfig(dc dnsConfig) (restart bool) { </s> add func (s *Server) setConfig(dc *dnsConfig) (restart bool) { </s> remove for _, valid := range []string{ "", "fastest_addr", "parallel", } { if *req.UpstreamMode == valid { return true </s> add var b string defer func() { err = errors.Annotate(err, "checking bootstrap %s: invalid address: %w", b) }() for _, b = range *req.Bootstraps { if b == "" { return errors.Error("empty") } if _, err = upstream.NewResolver(b, nil); err != nil { return err
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
restart = true
<mask> <mask> if dc.RateLimit != nil && s.conf.Ratelimit != *dc.RateLimit { <mask> s.conf.Ratelimit = *dc.RateLimit <mask> } <mask> <mask> if dc.EDNSCSEnabled != nil { <mask> s.conf.EnableEDNSClientSubnet = *dc.EDNSCSEnabled </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove if dc.RateLimit != nil { restart = restart || s.conf.Ratelimit != *dc.RateLimit </s> add if dc.RateLimit != nil && s.conf.Ratelimit != *dc.RateLimit { </s> remove if err = s.Reconfigure(nil); err != nil { </s> add err = s.Reconfigure(nil) if err != nil { </s> remove for _, boot := range *req.Bootstraps { if boot == "" { return boot, fmt.Errorf("invalid bootstrap server address: empty") </s> add if req.LocalPTRUpstreams != nil { err = ValidateUpstreamsPrivate(*req.LocalPTRUpstreams, snd) if err != nil { return fmt.Errorf("validating private upstream servers: %w", err) </s> remove if _, err := upstream.NewResolver(boot, nil); err != nil { return boot, fmt.Errorf("invalid bootstrap server address: %w", err) } </s> add err = req.checkBootstrap() if err != nil { return err
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
func (s *Server) setConfig(dc *dnsConfig) (restart bool) {
<mask> <mask> return restart <mask> } <mask> <mask> func (s *Server) setConfig(dc dnsConfig) (restart bool) { <mask> s.serverLock.Lock() <mask> defer s.serverLock.Unlock() <mask> <mask> if dc.ProtectionEnabled != nil { <mask> s.conf.ProtectionEnabled = *dc.ProtectionEnabled </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove func (s *Server) setConfigRestartable(dc dnsConfig) (restart bool) { </s> add func (s *Server) setConfigRestartable(dc *dnsConfig) (restart bool) { </s> remove func (s *Server) getDNSConfig() dnsConfig { </s> add func (s *Server) getDNSConfig() (c *dnsConfig) { </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "json Encode: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "decoding request: %s", err) </s> remove if dc.RateLimit != nil { restart = restart || s.conf.Ratelimit != *dc.RateLimit </s> add if dc.RateLimit != nil && s.conf.Ratelimit != *dc.RateLimit { </s> remove req := dnsConfig{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req := &dnsConfig{} err := json.NewDecoder(r.Body).Decode(req)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
// IsCommentOrEmpty returns true if s starts with a "#" character or is empty. // This function is useful for filtering out non-upstream lines from upstream // configs.
<mask> BootstrapDNS []string `json:"bootstrap_dns"` <mask> PrivateUpstreams []string `json:"private_upstream"` <mask> } <mask> <mask> // IsCommentOrEmpty returns true of the string starts with a "#" character or is <mask> // an empty string. This function is useful for filtering out non-upstream <mask> // lines from upstream configs. <mask> func IsCommentOrEmpty(s string) (ok bool) { <mask> return len(s) == 0 || s[0] == '#' <mask> } <mask> <mask> // ValidateUpstreams validates each upstream and returns an error if any </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. </s> add // LocalNetChecker is used to check if the IP address belongs to a local // network. type LocalNetChecker interface { // IsLocallyServedNetwork returns true if ip is contained in any of address // registries defined by RFC 6303. IsLocallyServedNetwork(ip net.IP) (ok bool) } // type check var _ LocalNetChecker = (*aghnet.SubnetDetector)(nil) // newUpstreamConfig validates upstreams and returns an appropriate upstream // configuration or nil if it can't be built. </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue </s> remove // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { // No need to validate comments </s> add // TODO(e.burkov): Perhaps proxy.ParseUpstreamsConfig should validate upstreams // slice already so that this function may be considered useless. func newUpstreamConfig(upstreams []string) (conf *proxy.UpstreamConfig, err error) { // No need to validate comments and empty lines. </s> remove func (req *dnsConfig) checkBootstrap() (string, error) { if req.Bootstraps == nil { return "", nil </s> add // validate returns an error if any field of req is invalid. func (req *dnsConfig) validate(snd *aghnet.SubnetDetector) (err error) { if req.Upstreams != nil { err = ValidateUpstreams(*req.Upstreams) if err != nil { return fmt.Errorf("validating upstream servers: %w", err) }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
// LocalNetChecker is used to check if the IP address belongs to a local // network. type LocalNetChecker interface { // IsLocallyServedNetwork returns true if ip is contained in any of address // registries defined by RFC 6303. IsLocallyServedNetwork(ip net.IP) (ok bool) } // type check var _ LocalNetChecker = (*aghnet.SubnetDetector)(nil) // newUpstreamConfig validates upstreams and returns an appropriate upstream // configuration or nil if it can't be built.
<mask> func IsCommentOrEmpty(s string) (ok bool) { <mask> return len(s) == 0 || s[0] == '#' <mask> } <mask> <mask> // ValidateUpstreams validates each upstream and returns an error if any <mask> // upstream is invalid or if there are no default upstreams specified. <mask> // <mask> // TODO(e.burkov): Move into aghnet or even into dnsproxy. <mask> func ValidateUpstreams(upstreams []string) (err error) { <mask> // No need to validate comments <mask> upstreams = stringutil.FilterOut(upstreams, IsCommentOrEmpty) </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { // No need to validate comments </s> add // TODO(e.burkov): Perhaps proxy.ParseUpstreamsConfig should validate upstreams // slice already so that this function may be considered useless. func newUpstreamConfig(upstreams []string) (conf *proxy.UpstreamConfig, err error) { // No need to validate comments and empty lines. </s> remove // Consider this case valid because defaultDNS will be used </s> add </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue </s> remove // IsCommentOrEmpty returns true of the string starts with a "#" character or is // an empty string. This function is useful for filtering out non-upstream // lines from upstream configs. </s> add // IsCommentOrEmpty returns true if s starts with a "#" character or is empty. // This function is useful for filtering out non-upstream lines from upstream // configs. </s> remove func (req *dnsConfig) checkBootstrap() (string, error) { if req.Bootstraps == nil { return "", nil </s> add // validate returns an error if any field of req is invalid. func (req *dnsConfig) validate(snd *aghnet.SubnetDetector) (err error) { if req.Upstreams != nil { err = ValidateUpstreams(*req.Upstreams) if err != nil { return fmt.Errorf("validating upstream servers: %w", err) }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
// TODO(e.burkov): Perhaps proxy.ParseUpstreamsConfig should validate upstreams // slice already so that this function may be considered useless. func newUpstreamConfig(upstreams []string) (conf *proxy.UpstreamConfig, err error) { // No need to validate comments and empty lines.
<mask> <mask> // ValidateUpstreams validates each upstream and returns an error if any <mask> // upstream is invalid or if there are no default upstreams specified. <mask> // <mask> // TODO(e.burkov): Move into aghnet or even into dnsproxy. <mask> func ValidateUpstreams(upstreams []string) (err error) { <mask> // No need to validate comments <mask> upstreams = stringutil.FilterOut(upstreams, IsCommentOrEmpty) <mask> <mask> // Consider this case valid because defaultDNS will be used <mask> if len(upstreams) == 0 { <mask> return nil </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove // Consider this case valid because defaultDNS will be used </s> add </s> remove // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. </s> add // LocalNetChecker is used to check if the IP address belongs to a local // network. type LocalNetChecker interface { // IsLocallyServedNetwork returns true if ip is contained in any of address // registries defined by RFC 6303. IsLocallyServedNetwork(ip net.IP) (ok bool) } // type check var _ LocalNetChecker = (*aghnet.SubnetDetector)(nil) // newUpstreamConfig validates upstreams and returns an appropriate upstream // configuration or nil if it can't be built. </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue </s> remove return nil </s> add // Consider this case valid since it means the default server should be // used. return nil, nil </s> remove // IsCommentOrEmpty returns true of the string starts with a "#" character or is // an empty string. This function is useful for filtering out non-upstream // lines from upstream configs. </s> add // IsCommentOrEmpty returns true if s starts with a "#" character or is empty. // This function is useful for filtering out non-upstream lines from upstream // configs.
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
<mask> // TODO(e.burkov): Move into aghnet or even into dnsproxy. <mask> func ValidateUpstreams(upstreams []string) (err error) { <mask> // No need to validate comments <mask> upstreams = stringutil.FilterOut(upstreams, IsCommentOrEmpty) <mask> <mask> // Consider this case valid because defaultDNS will be used <mask> if len(upstreams) == 0 { <mask> return nil <mask> } <mask> <mask> _, err = proxy.ParseUpstreamsConfig( </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { // No need to validate comments </s> add // TODO(e.burkov): Perhaps proxy.ParseUpstreamsConfig should validate upstreams // slice already so that this function may be considered useless. func newUpstreamConfig(upstreams []string) (conf *proxy.UpstreamConfig, err error) { // No need to validate comments and empty lines. </s> remove return nil </s> add // Consider this case valid since it means the default server should be // used. return nil, nil </s> remove // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. </s> add // LocalNetChecker is used to check if the IP address belongs to a local // network. type LocalNetChecker interface { // IsLocallyServedNetwork returns true if ip is contained in any of address // registries defined by RFC 6303. IsLocallyServedNetwork(ip net.IP) (ok bool) } // type check var _ LocalNetChecker = (*aghnet.SubnetDetector)(nil) // newUpstreamConfig validates upstreams and returns an appropriate upstream // configuration or nil if it can't be built. </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue </s> remove _, err = proxy.ParseUpstreamsConfig( </s> add conf, err = proxy.ParseUpstreamsConfig(
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
// Consider this case valid since it means the default server should be // used. return nil, nil
<mask> upstreams = stringutil.FilterOut(upstreams, IsCommentOrEmpty) <mask> <mask> // Consider this case valid because defaultDNS will be used <mask> if len(upstreams) == 0 { <mask> return nil <mask> } <mask> <mask> _, err = proxy.ParseUpstreamsConfig( <mask> upstreams, <mask> &upstream.Options{ </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove // Consider this case valid because defaultDNS will be used </s> add </s> remove // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { // No need to validate comments </s> add // TODO(e.burkov): Perhaps proxy.ParseUpstreamsConfig should validate upstreams // slice already so that this function may be considered useless. func newUpstreamConfig(upstreams []string) (conf *proxy.UpstreamConfig, err error) { // No need to validate comments and empty lines. </s> remove _, err = proxy.ParseUpstreamsConfig( </s> add conf, err = proxy.ParseUpstreamsConfig( </s> remove &upstream.Options{ Bootstrap: []string{}, Timeout: DefaultTimeout, }, </s> add &upstream.Options{Bootstrap: []string{}, Timeout: DefaultTimeout}, </s> remove if req.Upstreams != nil { if err = ValidateUpstreams(*req.Upstreams); err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) return } } var errBoot string if errBoot, err = req.checkBootstrap(); err != nil { aghhttp.Error( r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", errBoot, err, ) return } switch { case !req.checkBlockingMode(): aghhttp.Error(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") return case !req.checkUpstreamsMode(): aghhttp.Error(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") return case !req.checkCacheTTL(): aghhttp.Error( r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max", ) </s> add err = req.validate(s.subnetDetector) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
conf, err = proxy.ParseUpstreamsConfig(
<mask> if len(upstreams) == 0 { <mask> return nil <mask> } <mask> <mask> _, err = proxy.ParseUpstreamsConfig( <mask> upstreams, <mask> &upstream.Options{ <mask> Bootstrap: []string{}, <mask> Timeout: DefaultTimeout, <mask> }, </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove &upstream.Options{ Bootstrap: []string{}, Timeout: DefaultTimeout, }, </s> add &upstream.Options{Bootstrap: []string{}, Timeout: DefaultTimeout}, </s> remove return nil </s> add // Consider this case valid since it means the default server should be // used. return nil, nil </s> remove return err </s> add return nil, err } else if len(conf.Upstreams) == 0 { return nil, errors.Error("no default upstreams specified") </s> remove // Consider this case valid because defaultDNS will be used </s> add </s> remove for _, valid := range []string{ "", "fastest_addr", "parallel", } { if *req.UpstreamMode == valid { return true </s> add var b string defer func() { err = errors.Annotate(err, "checking bootstrap %s: invalid address: %w", b) }() for _, b = range *req.Bootstraps { if b == "" { return errors.Error("empty") } if _, err = upstream.NewResolver(b, nil); err != nil { return err
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
&upstream.Options{Bootstrap: []string{}, Timeout: DefaultTimeout},
<mask> } <mask> <mask> _, err = proxy.ParseUpstreamsConfig( <mask> upstreams, <mask> &upstream.Options{ <mask> Bootstrap: []string{}, <mask> Timeout: DefaultTimeout, <mask> }, <mask> ) <mask> if err != nil { <mask> return err <mask> } <mask> </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove _, err = proxy.ParseUpstreamsConfig( </s> add conf, err = proxy.ParseUpstreamsConfig( </s> remove return err </s> add return nil, err } else if len(conf.Upstreams) == 0 { return nil, errors.Error("no default upstreams specified") </s> remove return nil </s> add // Consider this case valid since it means the default server should be // used. return nil, nil </s> remove if !defaultUpstreamFound { defaultUpstreamFound = useDefault </s> add if !lnc.IsLocallyServedNetwork(subnet.IP) { errs = append( errs, fmt.Errorf("arpa domain %q should point to a locally-served network", domain), ) </s> remove for _, valid := range []string{ "", "fastest_addr", "parallel", } { if *req.UpstreamMode == valid { return true </s> add var b string defer func() { err = errors.Annotate(err, "checking bootstrap %s: invalid address: %w", b) }() for _, b = range *req.Bootstraps { if b == "" { return errors.Error("empty") } if _, err = upstream.NewResolver(b, nil); err != nil { return err
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
return nil, err } else if len(conf.Upstreams) == 0 { return nil, errors.Error("no default upstreams specified")
<mask> Timeout: DefaultTimeout, <mask> }, <mask> ) <mask> if err != nil { <mask> return err <mask> } <mask> <mask> var defaultUpstreamFound bool <mask> for _, u := range upstreams { <mask> var useDefault bool </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove var defaultUpstreamFound bool </s> add </s> remove var useDefault bool useDefault, err = validateUpstream(u) </s> add _, err = validateUpstream(u) </s> remove &upstream.Options{ Bootstrap: []string{}, Timeout: DefaultTimeout, }, </s> add &upstream.Options{Bootstrap: []string{}, Timeout: DefaultTimeout}, </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue </s> remove _, err = proxy.ParseUpstreamsConfig( </s> add conf, err = proxy.ParseUpstreamsConfig(
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
<mask> if err != nil { <mask> return err <mask> } <mask> <mask> var defaultUpstreamFound bool <mask> for _, u := range upstreams { <mask> var useDefault bool <mask> useDefault, err = validateUpstream(u) <mask> if err != nil { <mask> return err </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove var useDefault bool useDefault, err = validateUpstream(u) </s> add _, err = validateUpstream(u) </s> remove return err </s> add return nil, err } else if len(conf.Upstreams) == 0 { return nil, errors.Error("no default upstreams specified") </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue </s> remove for _, valid := range []string{ "", "fastest_addr", "parallel", } { if *req.UpstreamMode == valid { return true </s> add var b string defer func() { err = errors.Annotate(err, "checking bootstrap %s: invalid address: %w", b) }() for _, b = range *req.Bootstraps { if b == "" { return errors.Error("empty") } if _, err = upstream.NewResolver(b, nil); err != nil { return err </s> remove if req.UpstreamMode == nil { return true </s> add valid := []string{"", "fastest_addr", "parallel"} return req.UpstreamMode == nil || stringutil.InSlice(valid, *req.UpstreamMode) } func (req *dnsConfig) checkBootstrap() (err error) { if req.Bootstraps == nil { return nil
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
_, err = validateUpstream(u)
<mask> } <mask> <mask> var defaultUpstreamFound bool <mask> for _, u := range upstreams { <mask> var useDefault bool <mask> useDefault, err = validateUpstream(u) <mask> if err != nil { <mask> return err <mask> } <mask> <mask> if !defaultUpstreamFound { </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove var defaultUpstreamFound bool </s> add </s> remove return err </s> add return nil, err } else if len(conf.Upstreams) == 0 { return nil, errors.Error("no default upstreams specified") </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue </s> remove for _, valid := range []string{ "", "fastest_addr", "parallel", } { if *req.UpstreamMode == valid { return true </s> add var b string defer func() { err = errors.Annotate(err, "checking bootstrap %s: invalid address: %w", b) }() for _, b = range *req.Bootstraps { if b == "" { return errors.Error("empty") } if _, err = upstream.NewResolver(b, nil); err != nil { return err </s> remove if !defaultUpstreamFound { defaultUpstreamFound = useDefault </s> add if !lnc.IsLocallyServedNetwork(subnet.IP) { errs = append( errs, fmt.Errorf("arpa domain %q should point to a locally-served network", domain), )
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue
<mask> for _, u := range upstreams { <mask> var useDefault bool <mask> useDefault, err = validateUpstream(u) <mask> if err != nil { <mask> return err <mask> } <mask> <mask> if !defaultUpstreamFound { <mask> defaultUpstreamFound = useDefault <mask> } </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove var useDefault bool useDefault, err = validateUpstream(u) </s> add _, err = validateUpstream(u) </s> remove var defaultUpstreamFound bool </s> add </s> remove return err </s> add return nil, err } else if len(conf.Upstreams) == 0 { return nil, errors.Error("no default upstreams specified") </s> remove if !defaultUpstreamFound { defaultUpstreamFound = useDefault </s> add if !lnc.IsLocallyServedNetwork(subnet.IP) { errs = append( errs, fmt.Errorf("arpa domain %q should point to a locally-served network", domain), ) </s> remove if !defaultUpstreamFound { return fmt.Errorf("no default upstreams specified") </s> add if len(errs) > 0 { return errors.List("checking domain-specific upstreams", errs...)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
if !lnc.IsLocallyServedNetwork(subnet.IP) { errs = append( errs, fmt.Errorf("arpa domain %q should point to a locally-served network", domain), )
<mask> if err != nil { <mask> return err <mask> } <mask> <mask> if !defaultUpstreamFound { <mask> defaultUpstreamFound = useDefault <mask> } <mask> } <mask> <mask> if !defaultUpstreamFound { <mask> return fmt.Errorf("no default upstreams specified") </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove if !defaultUpstreamFound { return fmt.Errorf("no default upstreams specified") </s> add if len(errs) > 0 { return errors.List("checking domain-specific upstreams", errs...) </s> remove var useDefault bool useDefault, err = validateUpstream(u) </s> add _, err = validateUpstream(u) </s> remove return err </s> add return nil, err } else if len(conf.Upstreams) == 0 { return nil, errors.Error("no default upstreams specified") </s> remove var defaultUpstreamFound bool </s> add </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
if len(errs) > 0 { return errors.List("checking domain-specific upstreams", errs...)
<mask> defaultUpstreamFound = useDefault <mask> } <mask> } <mask> <mask> if !defaultUpstreamFound { <mask> return fmt.Errorf("no default upstreams specified") <mask> } <mask> <mask> return nil <mask> } <mask> </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove if !defaultUpstreamFound { defaultUpstreamFound = useDefault </s> add if !lnc.IsLocallyServedNetwork(subnet.IP) { errs = append( errs, fmt.Errorf("arpa domain %q should point to a locally-served network", domain), ) </s> remove return err </s> add return nil, err } else if len(conf.Upstreams) == 0 { return nil, errors.Error("no default upstreams specified") </s> remove var useDefault bool useDefault, err = validateUpstream(u) </s> add _, err = validateUpstream(u) </s> remove var defaultUpstreamFound bool </s> add </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http.go
wantSet: `validating upstream servers: bad ipport address "!!!": ` + `address !!!: missing port in address`,
<mask> name: "upstream_mode_fastest_addr", <mask> wantSet: "", <mask> }, { <mask> name: "upstream_dns_bad", <mask> wantSet: `wrong upstreams specification: bad ipport address "!!!": address !!!: ` + <mask> `missing port in address`, <mask> }, { <mask> name: "bootstraps_bad", <mask> wantSet: `a can not be used as bootstrap dns cause: ` + <mask> `invalid bootstrap server address: ` + <mask> `Resolver a is not eligible to be a bootstrap DNS server`, </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove wantSet: `a can not be used as bootstrap dns cause: ` + `invalid bootstrap server address: ` + </s> add wantSet: `checking bootstrap a: invalid address: ` + </s> remove if req.Upstreams != nil { if err = ValidateUpstreams(*req.Upstreams); err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) return } } var errBoot string if errBoot, err = req.checkBootstrap(); err != nil { aghhttp.Error( r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", errBoot, err, ) return } switch { case !req.checkBlockingMode(): aghhttp.Error(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") return case !req.checkUpstreamsMode(): aghhttp.Error(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") return case !req.checkCacheTTL(): aghhttp.Error( r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max", ) </s> add err = req.validate(s.subnetDetector) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) </s> remove if _, err := upstream.NewResolver(boot, nil); err != nil { return boot, fmt.Errorf("invalid bootstrap server address: %w", err) } </s> add err = req.checkBootstrap() if err != nil { return err </s> remove // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. </s> add // LocalNetChecker is used to check if the IP address belongs to a local // network. type LocalNetChecker interface { // IsLocallyServedNetwork returns true if ip is contained in any of address // registries defined by RFC 6303. IsLocallyServedNetwork(ip net.IP) (ok bool) } // type check var _ LocalNetChecker = (*aghnet.SubnetDetector)(nil) // newUpstreamConfig validates upstreams and returns an appropriate upstream // configuration or nil if it can't be built.
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http_test.go
wantSet: `checking bootstrap a: invalid address: ` +
<mask> wantSet: `wrong upstreams specification: bad ipport address "!!!": address !!!: ` + <mask> `missing port in address`, <mask> }, { <mask> name: "bootstraps_bad", <mask> wantSet: `a can not be used as bootstrap dns cause: ` + <mask> `invalid bootstrap server address: ` + <mask> `Resolver a is not eligible to be a bootstrap DNS server`, <mask> }, { <mask> name: "cache_bad_ttl", <mask> wantSet: `cache_ttl_min must be less or equal than cache_ttl_max`, <mask> }, { </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove wantSet: `wrong upstreams specification: bad ipport address "!!!": address !!!: ` + `missing port in address`, </s> add wantSet: `validating upstream servers: bad ipport address "!!!": ` + `address !!!: missing port in address`, </s> remove if req.Upstreams != nil { if err = ValidateUpstreams(*req.Upstreams); err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) return } } var errBoot string if errBoot, err = req.checkBootstrap(); err != nil { aghhttp.Error( r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", errBoot, err, ) return } switch { case !req.checkBlockingMode(): aghhttp.Error(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") return case !req.checkUpstreamsMode(): aghhttp.Error(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") return case !req.checkCacheTTL(): aghhttp.Error( r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max", ) </s> add err = req.validate(s.subnetDetector) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) </s> remove return "", nil </s> add switch { case !req.checkBlockingMode(): return errors.Error("blocking_mode: incorrect value") case !req.checkUpstreamsMode(): return errors.Error("upstream_mode: incorrect value") case !req.checkCacheTTL(): return errors.Error("cache_ttl_min must be less or equal than cache_ttl_max") default: return nil } </s> remove default: // Go on. </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http_test.go
}, { name: "local_ptr_upstreams_bad", wantSet: `validating private upstream servers: checking domain-specific upstreams: ` + `bad arpa domain name "non.arpa": not a reversed ip network`,
<mask> wantSet: `upstream_mode: incorrect value`, <mask> }, { <mask> name: "local_ptr_upstreams_good", <mask> wantSet: "", <mask> }, { <mask> name: "local_ptr_upstreams_null", <mask> wantSet: "", <mask> }} <mask> </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove wantSet: `wrong upstreams specification: bad ipport address "!!!": address !!!: ` + `missing port in address`, </s> add wantSet: `validating upstream servers: bad ipport address "!!!": ` + `address !!!: missing port in address`, </s> remove wantSet: `a can not be used as bootstrap dns cause: ` + `invalid bootstrap server address: ` + </s> add wantSet: `checking bootstrap a: invalid address: ` + </s> remove return "", nil </s> add switch { case !req.checkBlockingMode(): return errors.Error("blocking_mode: incorrect value") case !req.checkUpstreamsMode(): return errors.Error("upstream_mode: incorrect value") case !req.checkCacheTTL(): return errors.Error("cache_ttl_min must be less or equal than cache_ttl_max") default: return nil } </s> remove _, err = proxy.ParseUpstreamsConfig( </s> add conf, err = proxy.ParseUpstreamsConfig( </s> remove &upstream.Options{ Bootstrap: []string{}, Timeout: DefaultTimeout, }, </s> add &upstream.Options{Bootstrap: []string{}, Timeout: DefaultTimeout},
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http_test.go
func TestValidateUpstreams(t *testing.T) {
<mask> }) <mask> } <mask> } <mask> <mask> func TestValidateUpstreamsSet(t *testing.T) { <mask> testCases := []struct { <mask> name string <mask> wantErr string <mask> set []string <mask> }{{ </s> Pull request: 3381 check private domains Merge in DNS/adguard-home from 3381-validate-privateness to master Closes #3381. Squashed commit of the following: commit 21cb12d10b07bb0bf0578db74ca9ac7b3ac5ae14 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 16:29:59 2022 +0300 all: imp code, docs commit 39793551438cbea71e6ec78d0e05bee2d8dba3e5 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 15:08:36 2022 +0300 all: imp code, docs commit 6b71848fd0980582b1bfe24a34f48608795e9b7d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 14 14:22:00 2022 +0300 all: check private domains </s> remove for _, valid := range []string{ "", "fastest_addr", "parallel", } { if *req.UpstreamMode == valid { return true </s> add var b string defer func() { err = errors.Annotate(err, "checking bootstrap %s: invalid address: %w", b) }() for _, b = range *req.Bootstraps { if b == "" { return errors.Error("empty") } if _, err = upstream.NewResolver(b, nil); err != nil { return err </s> remove // IsCommentOrEmpty returns true of the string starts with a "#" character or is // an empty string. This function is useful for filtering out non-upstream // lines from upstream configs. </s> add // IsCommentOrEmpty returns true if s starts with a "#" character or is empty. // This function is useful for filtering out non-upstream lines from upstream // configs. </s> remove return err </s> add return nil, err } } return conf, nil } // ValidateUpstreams validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. // // TODO(e.burkov): Move into aghnet or even into dnsproxy. func ValidateUpstreams(upstreams []string) (err error) { _, err = newUpstreamConfig(upstreams) return err } // stringKeysSorted returns the sorted slice of string keys of m. // // TODO(e.burkov): Use generics in Go 1.18. Move into golibs. func stringKeysSorted(m map[string][]upstream.Upstream) (sorted []string) { sorted = make([]string, 0, len(m)) for s := range m { sorted = append(sorted, s) } sort.Strings(sorted) return sorted } // ValidateUpstreamsPrivate validates each upstream and returns an error if any // upstream is invalid or if there are no default upstreams specified. It also // checks each domain of domain-specific upstreams for being ARPA pointing to // a locally-served network. lnc must not be nil. func ValidateUpstreamsPrivate(upstreams []string, lnc LocalNetChecker) (err error) { conf, err := newUpstreamConfig(upstreams) if err != nil { return err } if conf == nil { return nil } var errs []error for _, domain := range stringKeysSorted(conf.DomainReservedUpstreams) { var subnet *net.IPNet subnet, err = netutil.SubnetFromReversedAddr(domain) if err != nil { errs = append(errs, err) continue </s> remove if req.Upstreams != nil { if err = ValidateUpstreams(*req.Upstreams); err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) return } } var errBoot string if errBoot, err = req.checkBootstrap(); err != nil { aghhttp.Error( r, w, http.StatusBadRequest, "%s can not be used as bootstrap dns cause: %s", errBoot, err, ) return } switch { case !req.checkBlockingMode(): aghhttp.Error(r, w, http.StatusBadRequest, "blocking_mode: incorrect value") return case !req.checkUpstreamsMode(): aghhttp.Error(r, w, http.StatusBadRequest, "upstream_mode: incorrect value") return case !req.checkCacheTTL(): aghhttp.Error( r, w, http.StatusBadRequest, "cache_ttl_min must be less or equal than cache_ttl_max", ) </s> add err = req.validate(s.subnetDetector) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) </s> remove if req.UpstreamMode == nil { return true </s> add valid := []string{"", "fastest_addr", "parallel"} return req.UpstreamMode == nil || stringutil.InSlice(valid, *req.UpstreamMode) } func (req *dnsConfig) checkBootstrap() (err error) { if req.Bootstraps == nil { return nil
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f13106727890c2bd265ab9e3bbb29b5d5430101b
internal/dnsforward/http_test.go
RUN apk --no-cache add tini
<mask> mkdir -p /opt/adguardhome/conf /opt/adguardhome/work && \ <mask> chown -R nobody: /opt/adguardhome <mask> <mask> ARG DIST_DIR <mask> ARG TARGETARCH <mask> ARG TARGETOS <mask> ARG TARGETVARIANT <mask> </s> Pull request 1794: 3290-kill-zombies Merge in DNS/adguard-home from 3290-kill-zombies to master Updates #3290. Squashed commit of the following: commit 3e0626024243e48e253451a322961e1011976ce3 Merge: 5aa7aa4e 1731ce9c Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 20:04:04 2023 +0500 Merge branch 'master' into 3290-kill-zombies commit 5aa7aa4e17c76d1226ba1d44639c67e12454e4e7 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 16:38:00 2023 +0500 docker: add doc commit 52a0b671c3f229250988ecd32c0bf909b50fc59b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 14:41:41 2023 +0500 docker: add init emulator </s> remove ENTRYPOINT ["/opt/adguardhome/AdGuardHome"] </s> add HEALTHCHECK \ --interval=30s \ --timeout=10s \ --retries=3 \ CMD [ "/opt/adguardhome/scripts/healthcheck.sh" ] </s> remove HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD [ "/opt/adguardhome/scripts/healthcheck.sh" ] </s> add # It seems that the healthckech script sometimes spawns zombie processes, so we # need a way to handle them, since AdGuard Home doesn't know how to keep track # of the processes delegated to it by the OS. Use tini as entry point because # it needs the PID=1 to be the default parent for orphaned processes. # # See https://github.com/adguardTeam/adGuardHome/issues/3290. ENTRYPOINT [ "/sbin/tini", "--" ]
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f191cb07a5c7160ac6fede7ffa4573edcd914751
docker/Dockerfile
HEALTHCHECK \ --interval=30s \ --timeout=10s \ --retries=3 \ CMD [ "/opt/adguardhome/scripts/healthcheck.sh" ]
<mask> COPY --chown=nobody:nogroup\ <mask> ./${DIST_DIR}/docker/scripts\ <mask> /opt/adguardhome/scripts <mask> <mask> ENTRYPOINT ["/opt/adguardhome/AdGuardHome"] <mask> <mask> HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD [ "/opt/adguardhome/scripts/healthcheck.sh" ] <mask> <mask> CMD [ \ <mask> "--no-check-update", \ </s> Pull request 1794: 3290-kill-zombies Merge in DNS/adguard-home from 3290-kill-zombies to master Updates #3290. Squashed commit of the following: commit 3e0626024243e48e253451a322961e1011976ce3 Merge: 5aa7aa4e 1731ce9c Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 20:04:04 2023 +0500 Merge branch 'master' into 3290-kill-zombies commit 5aa7aa4e17c76d1226ba1d44639c67e12454e4e7 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 16:38:00 2023 +0500 docker: add doc commit 52a0b671c3f229250988ecd32c0bf909b50fc59b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 14:41:41 2023 +0500 docker: add init emulator </s> remove HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD [ "/opt/adguardhome/scripts/healthcheck.sh" ] </s> add # It seems that the healthckech script sometimes spawns zombie processes, so we # need a way to handle them, since AdGuard Home doesn't know how to keep track # of the processes delegated to it by the OS. Use tini as entry point because # it needs the PID=1 to be the default parent for orphaned processes. # # See https://github.com/adguardTeam/adGuardHome/issues/3290. ENTRYPOINT [ "/sbin/tini", "--" ]
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f191cb07a5c7160ac6fede7ffa4573edcd914751
docker/Dockerfile
# It seems that the healthckech script sometimes spawns zombie processes, so we # need a way to handle them, since AdGuard Home doesn't know how to keep track # of the processes delegated to it by the OS. Use tini as entry point because # it needs the PID=1 to be the default parent for orphaned processes. # # See https://github.com/adguardTeam/adGuardHome/issues/3290. ENTRYPOINT [ "/sbin/tini", "--" ]
<mask> /opt/adguardhome/scripts <mask> <mask> ENTRYPOINT ["/opt/adguardhome/AdGuardHome"] <mask> <mask> HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD [ "/opt/adguardhome/scripts/healthcheck.sh" ] <mask> <mask> CMD [ \ <mask> "--no-check-update", \ <mask> "-c", "/opt/adguardhome/conf/AdGuardHome.yaml", \ <mask> "-h", "0.0.0.0", \ </s> Pull request 1794: 3290-kill-zombies Merge in DNS/adguard-home from 3290-kill-zombies to master Updates #3290. Squashed commit of the following: commit 3e0626024243e48e253451a322961e1011976ce3 Merge: 5aa7aa4e 1731ce9c Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 20:04:04 2023 +0500 Merge branch 'master' into 3290-kill-zombies commit 5aa7aa4e17c76d1226ba1d44639c67e12454e4e7 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 16:38:00 2023 +0500 docker: add doc commit 52a0b671c3f229250988ecd32c0bf909b50fc59b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 14:41:41 2023 +0500 docker: add init emulator </s> remove ENTRYPOINT ["/opt/adguardhome/AdGuardHome"] </s> add HEALTHCHECK \ --interval=30s \ --timeout=10s \ --retries=3 \ CMD [ "/opt/adguardhome/scripts/healthcheck.sh" ]
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f191cb07a5c7160ac6fede7ffa4573edcd914751
docker/Dockerfile
"/opt/adguardhome/AdGuardHome", \
<mask> <mask> CMD [ \ <mask> "--no-check-update", \ <mask> "-c", "/opt/adguardhome/conf/AdGuardHome.yaml", \ <mask> "-h", "0.0.0.0", \ <mask> "-w", "/opt/adguardhome/work" \ </s> Pull request 1794: 3290-kill-zombies Merge in DNS/adguard-home from 3290-kill-zombies to master Updates #3290. Squashed commit of the following: commit 3e0626024243e48e253451a322961e1011976ce3 Merge: 5aa7aa4e 1731ce9c Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 20:04:04 2023 +0500 Merge branch 'master' into 3290-kill-zombies commit 5aa7aa4e17c76d1226ba1d44639c67e12454e4e7 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 16:38:00 2023 +0500 docker: add doc commit 52a0b671c3f229250988ecd32c0bf909b50fc59b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 31 14:41:41 2023 +0500 docker: add init emulator </s> remove ENTRYPOINT ["/opt/adguardhome/AdGuardHome"] </s> add HEALTHCHECK \ --interval=30s \ --timeout=10s \ --retries=3 \ CMD [ "/opt/adguardhome/scripts/healthcheck.sh" ] </s> remove HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD [ "/opt/adguardhome/scripts/healthcheck.sh" ] </s> add # It seems that the healthckech script sometimes spawns zombie processes, so we # need a way to handle them, since AdGuard Home doesn't know how to keep track # of the processes delegated to it by the OS. Use tini as entry point because # it needs the PID=1 to be the default parent for orphaned processes. # # See https://github.com/adguardTeam/adGuardHome/issues/3290. ENTRYPOINT [ "/sbin/tini", "--" ]
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f191cb07a5c7160ac6fede7ffa4573edcd914751
docker/Dockerfile
BindHost string `yaml:"bind_host"` Port int `yaml:"port"`
<mask> } <mask> <mask> // field ordering is important -- yaml fields will mirror ordering from here <mask> type dnsConfig struct { <mask> Port int `yaml:"port"` <mask> <mask> dnsforward.FilteringConfig `yaml:",inline"` <mask> <mask> UpstreamDNS []string `yaml:"upstream_dns"` <mask> } </s> Allow configuring IP address the DNS server binds to (#552) Closes #550. </s> remove UDPListenAddr: &net.UDPAddr{Port: config.DNS.Port}, TCPListenAddr: &net.TCPAddr{Port: config.DNS.Port}, </s> add UDPListenAddr: &net.UDPAddr{IP: net.ParseIP(config.DNS.BindHost), Port: config.DNS.Port}, TCPListenAddr: &net.TCPAddr{IP: net.ParseIP(config.DNS.BindHost), Port: config.DNS.Port}, </s> remove Port: 53, </s> add BindHost: "0.0.0.0", Port: 53,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f1c3fecfb25224e3a8a700db57fa71b80254fe19
config.go
BindHost: "0.0.0.0", Port: 53,
<mask> ourConfigFilename: "AdGuardHome.yaml", <mask> BindPort: 3000, <mask> BindHost: "127.0.0.1", <mask> DNS: dnsConfig{ <mask> Port: 53, <mask> FilteringConfig: dnsforward.FilteringConfig{ <mask> ProtectionEnabled: true, // whether or not use any of dnsfilter features <mask> FilteringEnabled: true, // whether or not use filter lists <mask> BlockedResponseTTL: 10, // in seconds <mask> QueryLogEnabled: true, </s> Allow configuring IP address the DNS server binds to (#552) Closes #550. </s> remove Port int `yaml:"port"` </s> add BindHost string `yaml:"bind_host"` Port int `yaml:"port"` </s> remove UDPListenAddr: &net.UDPAddr{Port: config.DNS.Port}, TCPListenAddr: &net.TCPAddr{Port: config.DNS.Port}, </s> add UDPListenAddr: &net.UDPAddr{IP: net.ParseIP(config.DNS.BindHost), Port: config.DNS.Port}, TCPListenAddr: &net.TCPAddr{IP: net.ParseIP(config.DNS.BindHost), Port: config.DNS.Port},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f1c3fecfb25224e3a8a700db57fa71b80254fe19
config.go
UDPListenAddr: &net.UDPAddr{IP: net.ParseIP(config.DNS.BindHost), Port: config.DNS.Port}, TCPListenAddr: &net.TCPAddr{IP: net.ParseIP(config.DNS.BindHost), Port: config.DNS.Port},
<mask> }) <mask> } <mask> <mask> newconfig := dnsforward.ServerConfig{ <mask> UDPListenAddr: &net.UDPAddr{Port: config.DNS.Port}, <mask> TCPListenAddr: &net.TCPAddr{Port: config.DNS.Port}, <mask> FilteringConfig: config.DNS.FilteringConfig, <mask> Filters: filters, <mask> } <mask> <mask> for _, u := range config.DNS.UpstreamDNS { </s> Allow configuring IP address the DNS server binds to (#552) Closes #550. </s> remove Port int `yaml:"port"` </s> add BindHost string `yaml:"bind_host"` Port int `yaml:"port"` </s> remove Port: 53, </s> add BindHost: "0.0.0.0", Port: 53,
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f1c3fecfb25224e3a8a700db57fa71b80254fe19
dns.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> returnOK(w) <mask> } <mask> <mask> func handleStatus(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> data := map[string]interface{}{ <mask> "dns_address": config.DNS.BindHost, <mask> "http_port": config.BindPort, <mask> "dns_port": config.DNS.Port, <mask> "protection_enabled": config.DNS.ProtectionEnabled, </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> } <mask> } <mask> <mask> func handleProtectionEnable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.ProtectionEnabled = true <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleProtectionDisable(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleProtectionDisable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.ProtectionEnabled = false <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> // ----- </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> // ----- <mask> // stats <mask> // ----- <mask> func handleQueryLogEnable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.QueryLogEnabled = true <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleQueryLogDisable(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleQueryLogDisable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.QueryLogEnabled = false <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleQueryLog(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleQueryLog(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> data := dnsServer.GetQueryLog() <mask> <mask> jsonVal, err := json.Marshal(data) <mask> if err != nil { <mask> errorText := fmt.Sprintf("Couldn't marshal data into json: %s", err) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> } <mask> } <mask> <mask> func handleStatsTop(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> s := dnsServer.GetStatsTop() <mask> <mask> // use manual json marshalling because we want maps to be sorted by value <mask> statsJSON := bytes.Buffer{} <mask> statsJSON.WriteString("{\n") </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> } <mask> <mask> // handleStatsReset resets the stats caches <mask> func handleStatsReset(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> dnsServer.PurgeStats() <mask> _, err := fmt.Fprintf(w, "OK\n") <mask> if err != nil { <mask> errorText := fmt.Sprintf("Couldn't write body: %s", err) <mask> log.Error(errorText) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> } <mask> <mask> // handleStats returns aggregated stats data for the 24 hours <mask> func handleStats(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> summed := dnsServer.GetAggregatedStats() <mask> <mask> statsJSON, err := json.Marshal(summed) <mask> if err != nil { <mask> errorText := fmt.Sprintf("Unable to marshal status json: %s", err) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> } <mask> <mask> // HandleStatsHistory returns historical stats data for the 24 hours <mask> func handleStatsHistory(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> // handle time unit and prepare our time window size <mask> timeUnitString := r.URL.Query().Get("time_unit") <mask> var timeUnit time.Duration <mask> switch timeUnitString { <mask> case "seconds": </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> // upstreams configuration <mask> // ----------------------- <mask> <mask> func handleSetUpstreamDNS(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> body, err := ioutil.ReadAll(r.Body) <mask> if err != nil { <mask> errorText := fmt.Sprintf("Failed to read request body: %s", err) <mask> log.Error(errorText) <mask> http.Error(w, errorText, http.StatusBadRequest) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> } <mask> } <mask> <mask> func handleTestUpstreamDNS(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> body, err := ioutil.ReadAll(r.Body) <mask> if err != nil { <mask> errorText := fmt.Sprintf("Failed to read request body: %s", err) <mask> log.Error(errorText) <mask> http.Error(w, errorText, 400) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> return nil <mask> } <mask> <mask> func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> now := time.Now() <mask> if now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0 { <mask> // return cached copy <mask> w.Header().Set("Content-Type", "application/json") <mask> w.Write(versionCheckJSON) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> // filtering <mask> // --------- <mask> <mask> func handleFilteringEnable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.FilteringEnabled = true <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleFilteringDisable(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleFilteringDisable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.FilteringEnabled = false <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleFilteringStatus(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleFilteringStatus(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> data := map[string]interface{}{ <mask> "enabled": config.DNS.FilteringEnabled, <mask> } <mask> <mask> config.RLock() </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> } <mask> } <mask> <mask> func handleFilteringAddURL(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> f := filter{} <mask> err := json.NewDecoder(r.Body).Decode(&f) <mask> if err != nil { <mask> httpError(w, http.StatusBadRequest, "Failed to parse request body json: %s", err) <mask> return </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> } <mask> } <mask> <mask> func handleFilteringRemoveURL(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> parameters, err := parseParametersFromBody(r.Body) <mask> if err != nil { <mask> errorText := fmt.Sprintf("failed to parse parameters from body: %s", err) <mask> log.Error(errorText) <mask> http.Error(w, errorText, 400) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleFilteringEnableURL(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> parameters, err := parseParametersFromBody(r.Body) <mask> if err != nil { <mask> errorText := fmt.Sprintf("failed to parse parameters from body: %s", err) <mask> log.Error(errorText) <mask> http.Error(w, errorText, 400) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleFilteringDisableURL(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> parameters, err := parseParametersFromBody(r.Body) <mask> if err != nil { <mask> errorText := fmt.Sprintf("failed to parse parameters from body: %s", err) <mask> log.Error(errorText) <mask> http.Error(w, errorText, 400) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleFilteringSetRules(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> body, err := ioutil.ReadAll(r.Body) <mask> if err != nil { <mask> errorText := fmt.Sprintf("Failed to read request body: %s", err) <mask> log.Error(errorText) <mask> http.Error(w, errorText, 400) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleFilteringRefresh(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> force := r.URL.Query().Get("force") <mask> updated := refreshFiltersIfNecessary(force != "") <mask> fmt.Fprintf(w, "OK %d filters updated\n", updated) <mask> } <mask> </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> // safebrowsing <mask> // ------------ <mask> <mask> func handleSafeBrowsingEnable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.SafeBrowsingEnabled = true <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleSafeBrowsingDisable(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleSafeBrowsingDisable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.SafeBrowsingEnabled = false <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleSafeBrowsingStatus(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleSafeBrowsingStatus(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> data := map[string]interface{}{ <mask> "enabled": config.DNS.SafeBrowsingEnabled, <mask> } <mask> jsonVal, err := json.Marshal(data) <mask> if err != nil { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> // -------- <mask> // parental <mask> // -------- <mask> func handleParentalEnable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> parameters, err := parseParametersFromBody(r.Body) <mask> if err != nil { <mask> errorText := fmt.Sprintf("failed to parse parameters from body: %s", err) <mask> log.Error(errorText) <mask> http.Error(w, errorText, 400) </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleParentalDisable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.ParentalEnabled = false <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleParentalStatus(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleParentalStatus(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> data := map[string]interface{}{ <mask> "enabled": config.DNS.ParentalEnabled, <mask> } <mask> if config.DNS.ParentalEnabled { <mask> data["sensitivity"] = config.DNS.ParentalSensitivity </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> // safebrowsing <mask> // ------------ <mask> <mask> func handleSafeSearchEnable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.SafeSearchEnabled = true <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleSafeSearchDisable(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleSafeSearchDisable(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> config.DNS.SafeSearchEnabled = false <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleSafeSearchStatus(w http.ResponseWriter, r *http.Request) { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleSafeSearchStatus(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> data := map[string]interface{}{ <mask> "enabled": config.DNS.SafeSearchEnabled, <mask> } <mask> jsonVal, err := json.Marshal(data) <mask> if err != nil { </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> Interfaces map[string]interface{} `json:"interfaces"` <mask> } <mask> <mask> func handleInstallGetAddresses(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> data := firstRunData{} <mask> <mask> // find out if port 80 is available -- if not, fall back to 3000 <mask> if checkPortAvailable("", 80) == nil { <mask> data.Web.Port = 80 </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> } <mask> } <mask> <mask> func handleInstallConfigure(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> newSettings := firstRunData{} <mask> err := json.NewDecoder(r.Body).Decode(&newSettings) <mask> if err != nil { <mask> httpError(w, http.StatusBadRequest, "Failed to parse new config json: %s", err) <mask> return </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> // --- <mask> // TLS <mask> // --- <mask> func handleTLSStatus(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> marshalTLS(w, config.TLS) <mask> } <mask> <mask> func handleTLSValidate(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> marshalTLS(w, config.TLS) <mask> } <mask> <mask> func handleTLSValidate(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> data, err := unmarshalTLS(r) <mask> if err != nil { <mask> httpError(w, http.StatusBadRequest, "Failed to unmarshal TLS config: %s", err) <mask> return <mask> } </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> marshalTLS(w, data) <mask> } <mask> <mask> func handleTLSConfigure(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> data, err := unmarshalTLS(r) <mask> if err != nil { <mask> httpError(w, http.StatusBadRequest, "Failed to unmarshal TLS config: %s", err) <mask> return <mask> } </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
log.Tracef("%s %v", r.Method, r.URL)
<mask> // -------------- <mask> // DNS-over-HTTPS <mask> // -------------- <mask> func handleDOH(w http.ResponseWriter, r *http.Request) { <mask> log.Tracef("") <mask> if r.TLS == nil { <mask> httpError(w, http.StatusNotFound, "Not Found") <mask> return <mask> } <mask> </s> * control: print HTTP request with log.Tracef() </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL) </s> remove log.Tracef("") </s> add log.Tracef("%s %v", r.Method, r.URL)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f21daae02368841bdb7b8bff05bf208e3b9ab136
control.go
const defaultSafebrowsingURL = "%s://%s/safebrowsing-lookup-hash.html?prefixes=%s"
<mask> const defaultHTTPTimeout = 5 * time.Minute <mask> const defaultHTTPMaxIdleConnections = 100 <mask> <mask> const defaultSafebrowsingServer = "sb.adtidy.org" <mask> const defaultSafebrowsingURL = "https://%s/safebrowsing-lookup-hash.html?prefixes=%s" <mask> const defaultParentalServer = "pctrl.adguard.com" <mask> const defaultParentalURL = "https://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" <mask> const maxDialCacheSize = 2 // the number of host names for safebrowsing and parental control <mask> <mask> // ErrInvalidSyntax is returned by AddRule when the rule is invalid </s> * dnsfilter: parental/safebrowsing: add setting to switch between HTTP and HTTPS </s> remove const defaultParentalURL = "https://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" </s> add const defaultParentalURL = "%s://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" </s> remove url := fmt.Sprintf(defaultParentalURL, d.parentalServer, hashparam, d.ParentalSensitivity) </s> add schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultParentalURL, schema, d.parentalServer, hashparam, d.ParentalSensitivity) </s> remove url := fmt.Sprintf(defaultSafebrowsingURL, d.safeBrowsingServer, hashparam) </s> add schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultSafebrowsingURL, schema, d.safeBrowsingServer, hashparam)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f23507a5546229d8ce8f69d56667cd5212f026d3
dnsfilter/dnsfilter.go
const defaultParentalURL = "%s://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d"
<mask> <mask> const defaultSafebrowsingServer = "sb.adtidy.org" <mask> const defaultSafebrowsingURL = "https://%s/safebrowsing-lookup-hash.html?prefixes=%s" <mask> const defaultParentalServer = "pctrl.adguard.com" <mask> const defaultParentalURL = "https://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" <mask> const maxDialCacheSize = 2 // the number of host names for safebrowsing and parental control <mask> <mask> // ErrInvalidSyntax is returned by AddRule when the rule is invalid <mask> var ErrInvalidSyntax = errors.New("dnsfilter: invalid rule syntax") <mask> </s> * dnsfilter: parental/safebrowsing: add setting to switch between HTTP and HTTPS </s> remove const defaultSafebrowsingURL = "https://%s/safebrowsing-lookup-hash.html?prefixes=%s" </s> add const defaultSafebrowsingURL = "%s://%s/safebrowsing-lookup-hash.html?prefixes=%s" </s> remove url := fmt.Sprintf(defaultParentalURL, d.parentalServer, hashparam, d.ParentalSensitivity) </s> add schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultParentalURL, schema, d.parentalServer, hashparam, d.ParentalSensitivity) </s> remove url := fmt.Sprintf(defaultSafebrowsingURL, d.safeBrowsingServer, hashparam) </s> add schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultSafebrowsingURL, schema, d.safeBrowsingServer, hashparam)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f23507a5546229d8ce8f69d56667cd5212f026d3
dnsfilter/dnsfilter.go
UsePlainHTTP bool `yaml:"-"` // use plain HTTP for requests to parental and safe browsing servers
<mask> type Config struct { <mask> FilteringTempFilename string `yaml:"filtering_temp_filename"` // temporary file for storing unused filtering rules <mask> ParentalSensitivity int `yaml:"parental_sensitivity"` // must be either 3, 10, 13 or 17 <mask> ParentalEnabled bool `yaml:"parental_enabled"` <mask> SafeSearchEnabled bool `yaml:"safesearch_enabled"` <mask> SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"` <mask> ResolverAddress string // DNS server address <mask> } <mask> </s> * dnsfilter: parental/safebrowsing: add setting to switch between HTTP and HTTPS </s> remove url := fmt.Sprintf(defaultParentalURL, d.parentalServer, hashparam, d.ParentalSensitivity) </s> add schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultParentalURL, schema, d.parentalServer, hashparam, d.ParentalSensitivity) </s> remove url := fmt.Sprintf(defaultSafebrowsingURL, d.safeBrowsingServer, hashparam) </s> add schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultSafebrowsingURL, schema, d.safeBrowsingServer, hashparam) </s> remove const defaultParentalURL = "https://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" </s> add const defaultParentalURL = "%s://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" </s> remove const defaultSafebrowsingURL = "https://%s/safebrowsing-lookup-hash.html?prefixes=%s" </s> add const defaultSafebrowsingURL = "%s://%s/safebrowsing-lookup-hash.html?prefixes=%s"
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f23507a5546229d8ce8f69d56667cd5212f026d3
dnsfilter/dnsfilter.go
schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultSafebrowsingURL, schema, d.safeBrowsingServer, hashparam)
<mask> defer timer.LogElapsed("SafeBrowsing HTTP lookup for %s", host) <mask> } <mask> <mask> format := func(hashparam string) string { <mask> url := fmt.Sprintf(defaultSafebrowsingURL, d.safeBrowsingServer, hashparam) <mask> return url <mask> } <mask> handleBody := func(body []byte, hashes map[string]bool) (Result, error) { <mask> result := Result{} <mask> scanner := bufio.NewScanner(strings.NewReader(string(body))) </s> * dnsfilter: parental/safebrowsing: add setting to switch between HTTP and HTTPS </s> remove url := fmt.Sprintf(defaultParentalURL, d.parentalServer, hashparam, d.ParentalSensitivity) </s> add schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultParentalURL, schema, d.parentalServer, hashparam, d.ParentalSensitivity) </s> remove const defaultParentalURL = "https://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" </s> add const defaultParentalURL = "%s://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" </s> remove const defaultSafebrowsingURL = "https://%s/safebrowsing-lookup-hash.html?prefixes=%s" </s> add const defaultSafebrowsingURL = "%s://%s/safebrowsing-lookup-hash.html?prefixes=%s"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f23507a5546229d8ce8f69d56667cd5212f026d3
dnsfilter/dnsfilter.go
schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultParentalURL, schema, d.parentalServer, hashparam, d.ParentalSensitivity)
<mask> defer timer.LogElapsed("Parental HTTP lookup for %s", host) <mask> } <mask> <mask> format := func(hashparam string) string { <mask> url := fmt.Sprintf(defaultParentalURL, d.parentalServer, hashparam, d.ParentalSensitivity) <mask> return url <mask> } <mask> handleBody := func(body []byte, hashes map[string]bool) (Result, error) { <mask> // parse json <mask> var m []struct { </s> * dnsfilter: parental/safebrowsing: add setting to switch between HTTP and HTTPS </s> remove url := fmt.Sprintf(defaultSafebrowsingURL, d.safeBrowsingServer, hashparam) </s> add schema := "https" if d.UsePlainHTTP { schema = "http" } url := fmt.Sprintf(defaultSafebrowsingURL, schema, d.safeBrowsingServer, hashparam) </s> remove const defaultParentalURL = "https://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" </s> add const defaultParentalURL = "%s://%s/check-parental-control-hash?prefixes=%s&sensitivity=%d" </s> remove const defaultSafebrowsingURL = "https://%s/safebrowsing-lookup-hash.html?prefixes=%s" </s> add const defaultSafebrowsingURL = "%s://%s/safebrowsing-lookup-hash.html?prefixes=%s"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f23507a5546229d8ce8f69d56667cd5212f026d3
dnsfilter/dnsfilter.go
github.com/dimfeld/httptreemux/v5 v5.4.0
<mask> github.com/ameshkov/dnscrypt/v2 v2.2.3 <mask> github.com/digineo/go-ipset/v2 v2.2.1 <mask> github.com/fsnotify/fsnotify v1.5.4 <mask> github.com/go-ping/ping v0.0.0-20211130115550-779d1e919534 <mask> github.com/google/go-cmp v0.5.7 <mask> github.com/google/gopacket v1.1.19 </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove rand.Seed(time.Now().UnixNano()) </s> add start := time.Now() rand.Seed(start.UnixNano())
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
go.mod
github.com/dimfeld/httptreemux/v5 v5.4.0 h1:IiHYEjh+A7pYbhWyjmGnj5HZK6gpOOvyBXCJ+BE8/Gs= github.com/dimfeld/httptreemux/v5 v5.4.0/go.mod h1:QeEylH57C0v3VO0tkKraVz9oD3Uu93CKPnTLbsidvSw=
<mask> github.com/digineo/go-ipset/v2 v2.2.1 h1:k6skY+0fMqeUjjeWO/m5OuWPSZUAn7AucHMnQ1MX77g= <mask> github.com/digineo/go-ipset/v2 v2.2.1/go.mod h1:wBsNzJlZlABHUITkesrggFnZQtgW5wkqw1uo8Qxe0VU= <mask> github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= <mask> github.com/fanliao/go-promise v0.0.0-20141029170127-1890db352a72/go.mod h1:PjfxuH4FZdUyfMdtBio2lsRr1AKEaVPwelzuHuh8Lqc= <mask> github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= <mask> github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= <mask> github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= <mask> github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove rand.Seed(time.Now().UnixNano()) </s> add start := time.Now() rand.Seed(start.UnixNano())
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
go.sum
start := time.Now() rand.Seed(start.UnixNano())
<mask> // Main is the entry point of application. <mask> func Main(clientBuildFS fs.FS) { <mask> // # Initial Configuration <mask> <mask> rand.Seed(time.Now().UnixNano()) <mask> <mask> // TODO(a.garipov): Set up logging. <mask> <mask> // # Web Service <mask> </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove u := &url.URL{ Scheme: "http", Host: addrs[0], Path: "/health-check", } </s> add return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper() </s> remove func TestService_Start_getHealthCheck(t *testing.T) { </s> add // testStart is the server start value for tests. var testStart = time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC) // newTestServer creates and starts a new web service instance as well as its // sole address. It also registers a cleanup procedure, which shuts the // instance down. // // TODO(a.garipov): Use svc or remove it. func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { t.Helper()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/cmd/cmd.go
Start: start,
<mask> IP: net.IP{127, 0, 0, 1}, <mask> Port: 3001, <mask> }}, <mask> Timeout: 60 * time.Second, <mask> }) <mask> <mask> err := web.Start() </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove func TestService_Start_getHealthCheck(t *testing.T) { </s> add // testStart is the server start value for tests. var testStart = time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC) // newTestServer creates and starts a new web service instance as well as its // sole address. It also registers a cleanup procedure, which shuts the // instance down. // // TODO(a.garipov): Use svc or remove it. func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { t.Helper() </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "creating req") </s> remove svc := websvc.New(c) </s> add svc = websvc.New(c) </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "performing req") require.Equal(t, wantCode, resp.StatusCode)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/cmd/cmd.go
httptreemux "github.com/dimfeld/httptreemux/v5"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/agh" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> ) <mask> <mask> // Config is the AdGuard Home web service configuration structure. <mask> type Config struct { <mask> // TLS is the optional TLS configuration. If TLS is not nil, <mask> // SecureAddresses must not be empty. </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove func TestService_Start_getHealthCheck(t *testing.T) { </s> add // testStart is the server start value for tests. var testStart = time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC) // newTestServer creates and starts a new web service instance as well as its // sole address. It also registers a cleanup procedure, which shuts the // instance down. // // TODO(a.garipov): Use svc or remove it. func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { t.Helper() </s> remove rand.Seed(time.Now().UnixNano()) </s> add start := time.Now() rand.Seed(start.UnixNano()) </s> remove u := &url.URL{ Scheme: "http", Host: addrs[0], Path: "/health-check", } </s> add return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper()
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc.go
// Start is the time of start of AdGuard Home. Start time.Time
<mask> SecureAddresses []*netutil.IPPort <mask> <mask> // Timeout is the timeout for all server operations. <mask> Timeout time.Duration <mask> } <mask> <mask> // Service is the AdGuard Home web service. A nil *Service is a valid service <mask> // that does nothing. </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove func TestService_Start_getHealthCheck(t *testing.T) { </s> add // testStart is the server start value for tests. var testStart = time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC) // newTestServer creates and starts a new web service instance as well as its // sole address. It also registers a cleanup procedure, which shuts the // instance down. // // TODO(a.garipov): Use svc or remove it. func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { t.Helper() </s> remove u := &url.URL{ Scheme: "http", Host: addrs[0], Path: "/health-check", } </s> add return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper() </s> remove rand.Seed(time.Now().UnixNano()) </s> add start := time.Now() rand.Seed(start.UnixNano())
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc.go
start time.Time
<mask> type Service struct { <mask> tls *tls.Config <mask> servers []*http.Server <mask> timeout time.Duration <mask> } <mask> <mask> // New returns a new properly initialized *Service. If c is nil, svc is a nil <mask> // *Service that does nothing. </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove func TestService_Start_getHealthCheck(t *testing.T) { </s> add // testStart is the server start value for tests. var testStart = time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC) // newTestServer creates and starts a new web service instance as well as its // sole address. It also registers a cleanup procedure, which shuts the // instance down. // // TODO(a.garipov): Use svc or remove it. func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { t.Helper() </s> remove u := &url.URL{ Scheme: "http", Host: addrs[0], Path: "/health-check", } </s> add return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper() </s> remove rand.Seed(time.Now().UnixNano()) </s> add start := time.Now() rand.Seed(start.UnixNano())
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc.go
start: c.Start,
<mask> svc = &Service{ <mask> tls: c.TLS, <mask> timeout: c.Timeout, <mask> } <mask> <mask> mux := newMux(svc) </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove mux := http.NewServeMux() mux.HandleFunc("/health-check", svc.handleGetHealthCheck) </s> add mux := newMux(svc) </s> remove svc := websvc.New(c) </s> add svc = websvc.New(c) </s> remove func TestService_Start_getHealthCheck(t *testing.T) { </s> add // testStart is the server start value for tests. var testStart = time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC) // newTestServer creates and starts a new web service instance as well as its // sole address. It also registers a cleanup procedure, which shuts the // instance down. // // TODO(a.garipov): Use svc or remove it. func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { t.Helper()
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc.go
mux := newMux(svc)
<mask> tls: c.TLS, <mask> timeout: c.Timeout, <mask> } <mask> <mask> mux := http.NewServeMux() <mask> mux.HandleFunc("/health-check", svc.handleGetHealthCheck) <mask> <mask> for _, a := range c.Addresses { <mask> addr := a.String() <mask> errLog := log.StdLog("websvc: http: "+addr, log.ERROR) <mask> svc.servers = append(svc.servers, &http.Server{ </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove body, err := io.ReadAll(resp.Body) require.NoError(t, err) </s> add return body } func TestService_Start_getHealthCheck(t *testing.T) { _, addr := newTestServer(t) u := &url.URL{ Scheme: "http", Host: addr, Path: websvc.PathHealthCheck, } body := httpGet(t, u, http.StatusOK) </s> remove func TestService_Start_getHealthCheck(t *testing.T) { </s> add // testStart is the server start value for tests. var testStart = time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC) // newTestServer creates and starts a new web service instance as well as its // sole address. It also registers a cleanup procedure, which shuts the // instance down. // // TODO(a.garipov): Use svc or remove it. func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { t.Helper()
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc.go
// testStart is the server start value for tests. var testStart = time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC) // newTestServer creates and starts a new web service instance as well as its // sole address. It also registers a cleanup procedure, which shuts the // instance down. // // TODO(a.garipov): Use svc or remove it. func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { t.Helper()
<mask> ) <mask> <mask> const testTimeout = 1 * time.Second <mask> <mask> func TestService_Start_getHealthCheck(t *testing.T) { <mask> c := &websvc.Config{ <mask> TLS: nil, <mask> Addresses: []*netutil.IPPort{{ <mask> IP: net.IP{127, 0, 0, 1}, <mask> Port: 0, </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove body, err := io.ReadAll(resp.Body) require.NoError(t, err) </s> add return body } func TestService_Start_getHealthCheck(t *testing.T) { _, addr := newTestServer(t) u := &url.URL{ Scheme: "http", Host: addr, Path: websvc.PathHealthCheck, } body := httpGet(t, u, http.StatusOK) </s> remove svc := websvc.New(c) </s> add svc = websvc.New(c)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc_test.go
Start: testStart,
<mask> SecureAddresses: nil, <mask> Timeout: testTimeout, <mask> } <mask> <mask> svc = websvc.New(c) <mask> <mask> err := svc.Start() </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove svc := websvc.New(c) </s> add svc = websvc.New(c) </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "creating req") </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "performing req") require.Equal(t, wantCode, resp.StatusCode)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc_test.go
svc = websvc.New(c)
<mask> SecureAddresses: nil, <mask> Timeout: testTimeout, <mask> } <mask> <mask> svc := websvc.New(c) <mask> <mask> err := svc.Start() <mask> require.NoError(t, err) <mask> t.Cleanup(func() { <mask> ctx, cancel := context.WithTimeout(context.Background(), testTimeout) </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "creating req") </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "performing req") require.Equal(t, wantCode, resp.StatusCode) </s> remove assert.Equal(t, http.StatusOK, resp.StatusCode) </s> add body, err = io.ReadAll(resp.Body) require.NoErrorf(t, err, "reading body") </s> remove u := &url.URL{ Scheme: "http", Host: addrs[0], Path: "/health-check", } </s> add return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc_test.go
return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper()
<mask> <mask> addrs := svc.Addrs() <mask> require.Len(t, addrs, 1) <mask> <mask> u := &url.URL{ <mask> Scheme: "http", <mask> Host: addrs[0], <mask> Path: "/health-check", <mask> } <mask> req, err := http.NewRequest(http.MethodGet, u.String(), nil) <mask> require.NoError(t, err) <mask> <mask> httpCli := &http.Client{ <mask> Timeout: testTimeout, </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "creating req") </s> remove body, err := io.ReadAll(resp.Body) require.NoError(t, err) </s> add return body } func TestService_Start_getHealthCheck(t *testing.T) { _, addr := newTestServer(t) u := &url.URL{ Scheme: "http", Host: addr, Path: websvc.PathHealthCheck, } body := httpGet(t, u, http.StatusOK) </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "performing req") require.Equal(t, wantCode, resp.StatusCode) </s> remove svc := websvc.New(c) </s> add svc = websvc.New(c)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc_test.go
require.NoErrorf(t, err, "creating req")
<mask> Host: addrs[0], <mask> Path: "/health-check", <mask> } <mask> req, err := http.NewRequest(http.MethodGet, u.String(), nil) <mask> require.NoError(t, err) <mask> <mask> httpCli := &http.Client{ <mask> Timeout: testTimeout, <mask> } <mask> resp, err := httpCli.Do(req) </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "performing req") require.Equal(t, wantCode, resp.StatusCode) </s> remove u := &url.URL{ Scheme: "http", Host: addrs[0], Path: "/health-check", } </s> add return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper() </s> remove svc := websvc.New(c) </s> add svc = websvc.New(c) </s> remove body, err := io.ReadAll(resp.Body) require.NoError(t, err) </s> add return body } func TestService_Start_getHealthCheck(t *testing.T) { _, addr := newTestServer(t) u := &url.URL{ Scheme: "http", Host: addr, Path: websvc.PathHealthCheck, } body := httpGet(t, u, http.StatusOK)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc_test.go
require.NoErrorf(t, err, "performing req") require.Equal(t, wantCode, resp.StatusCode)
<mask> httpCli := &http.Client{ <mask> Timeout: testTimeout, <mask> } <mask> resp, err := httpCli.Do(req) <mask> require.NoError(t, err) <mask> <mask> testutil.CleanupAndRequireSuccess(t, resp.Body.Close) <mask> <mask> assert.Equal(t, http.StatusOK, resp.StatusCode) <mask> </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove assert.Equal(t, http.StatusOK, resp.StatusCode) </s> add body, err = io.ReadAll(resp.Body) require.NoErrorf(t, err, "reading body") </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "creating req") </s> remove body, err := io.ReadAll(resp.Body) require.NoError(t, err) </s> add return body } func TestService_Start_getHealthCheck(t *testing.T) { _, addr := newTestServer(t) u := &url.URL{ Scheme: "http", Host: addr, Path: websvc.PathHealthCheck, } body := httpGet(t, u, http.StatusOK) </s> remove svc := websvc.New(c) </s> add svc = websvc.New(c) </s> remove u := &url.URL{ Scheme: "http", Host: addrs[0], Path: "/health-check", } </s> add return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc_test.go
body, err = io.ReadAll(resp.Body) require.NoErrorf(t, err, "reading body")
<mask> require.NoError(t, err) <mask> <mask> testutil.CleanupAndRequireSuccess(t, resp.Body.Close) <mask> <mask> assert.Equal(t, http.StatusOK, resp.StatusCode) <mask> <mask> body, err := io.ReadAll(resp.Body) <mask> require.NoError(t, err) <mask> <mask> assert.Equal(t, []byte("OK"), body) </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove body, err := io.ReadAll(resp.Body) require.NoError(t, err) </s> add return body } func TestService_Start_getHealthCheck(t *testing.T) { _, addr := newTestServer(t) u := &url.URL{ Scheme: "http", Host: addr, Path: websvc.PathHealthCheck, } body := httpGet(t, u, http.StatusOK) </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "performing req") require.Equal(t, wantCode, resp.StatusCode) </s> remove svc := websvc.New(c) </s> add svc = websvc.New(c) </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "creating req") </s> remove u := &url.URL{ Scheme: "http", Host: addrs[0], Path: "/health-check", } </s> add return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc_test.go
return body } func TestService_Start_getHealthCheck(t *testing.T) { _, addr := newTestServer(t) u := &url.URL{ Scheme: "http", Host: addr, Path: websvc.PathHealthCheck, } body := httpGet(t, u, http.StatusOK)
<mask> testutil.CleanupAndRequireSuccess(t, resp.Body.Close) <mask> <mask> assert.Equal(t, http.StatusOK, resp.StatusCode) <mask> <mask> body, err := io.ReadAll(resp.Body) <mask> require.NoError(t, err) <mask> <mask> assert.Equal(t, []byte("OK"), body) <mask> } </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove assert.Equal(t, http.StatusOK, resp.StatusCode) </s> add body, err = io.ReadAll(resp.Body) require.NoErrorf(t, err, "reading body") </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "performing req") require.Equal(t, wantCode, resp.StatusCode) </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "creating req") </s> remove svc := websvc.New(c) </s> add svc = websvc.New(c) </s> remove u := &url.URL{ Scheme: "http", Host: addrs[0], Path: "/health-check", } </s> add return svc, addrs[0] } // httpGet is a helper that performs an HTTP GET request and returns the body of // the response as well as checks that the status code is correct. // // TODO(a.garipov): Add helpers for other methods. func httpGet(t testing.TB, u *url.URL, wantCode int) (body []byte) { t.Helper()
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
internal/v1/websvc/websvc_test.go
'arch': 'amd64'
<mask> 'GetV1SystemInfoResp': <mask> 'description': > <mask> Information about the AdGuard Home server. <mask> 'example': <mask> 'channel': 'release' <mask> 'new_version': 'v0.108.1' <mask> 'os': 'linux' <mask> 'start': 1614345496000 <mask> 'version': 'v0.108.0' <mask> 'properties': </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove 'new_version': 'v0.106.1' </s> add 'new_version': 'v0.108.1' 'os': 'linux' </s> remove 'version': 'v0.106.0' </s> add 'version': 'v0.108.0'
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
openapi/v1.yaml
'new_version': 'v0.108.1' 'os': 'linux'
<mask> 'description': > <mask> Information about the AdGuard Home server. <mask> 'example': <mask> 'channel': 'release' <mask> 'new_version': 'v0.106.1' <mask> 'start': 1614345496000 <mask> 'version': 'v0.106.0' <mask> 'properties': <mask> 'channel': <mask> '$ref': '#/components/schemas/Channel' </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove 'version': 'v0.106.0' </s> add 'version': 'v0.108.0'
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
openapi/v1.yaml
'version': 'v0.108.0'
<mask> 'example': <mask> 'channel': 'release' <mask> 'new_version': 'v0.106.1' <mask> 'start': 1614345496000 <mask> 'version': 'v0.106.0' <mask> 'properties': <mask> 'channel': <mask> '$ref': '#/components/schemas/Channel' <mask> 'new_version': <mask> 'description': > </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove 'new_version': 'v0.106.1' </s> add 'new_version': 'v0.108.1' 'os': 'linux'
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
openapi/v1.yaml
'arch': 'description': > CPU architecture. 'type': 'string'
<mask> 'start': 1614345496000 <mask> 'version': 'v0.108.0' <mask> 'properties': <mask> 'channel': <mask> '$ref': '#/components/schemas/Channel' <mask> 'new_version': <mask> 'description': > </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove 'version': 'v0.106.0' </s> add 'version': 'v0.108.0' </s> remove 'new_version': 'v0.106.1' </s> add 'new_version': 'v0.108.1' 'os': 'linux'
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
openapi/v1.yaml
'os': 'description': > Operating system type. 'type': 'string'
<mask> updated, if any. If there are none, this field is absent. <mask> 'type': 'string' <mask> 'start': <mask> 'description': > <mask> Unix time at which AdGuard Home started working, in milliseconds. <mask> 'format': 'double' <mask> 'type': 'number' </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove 'new_version': 'v0.106.1' </s> add 'new_version': 'v0.108.1' 'os': 'linux'
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
openapi/v1.yaml
- 'arch'
<mask> 'description': > <mask> Current AdGuard Home version. <mask> 'type': 'string' <mask> 'required': <mask> - 'channel' <mask> - 'os' <mask> - 'start' <mask> - 'version' <mask> 'type': 'object' </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove 'new_version': 'v0.106.1' </s> add 'new_version': 'v0.108.1' 'os': 'linux'
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
openapi/v1.yaml
- 'os'
<mask> 'required': <mask> - 'arch' <mask> - 'channel' <mask> - 'start' <mask> - 'version' <mask> 'type': 'object' <mask> </s> Pull request: websvc: add system info Merge in DNS/adguard-home from websvc-system-info to master Squashed commit of the following: commit 333aaa0602da254e25e0262a10080bf44a3718a7 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:32:32 2022 +0300 websvc: fmt commit d8a35bf71dcc59fdd595494e5b220e3d24516728 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu May 12 16:10:11 2022 +0300 websvc: refactor, imp tests commit dfeb24f3f35513bf51323d3ab6f717f582a1defc Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed May 11 20:52:02 2022 +0300 websvc: add system info </s> remove func TestService_Start_getHealthCheck(t *testing.T) { </s> add // testStart is the server start value for tests. var testStart = time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC) // newTestServer creates and starts a new web service instance as well as its // sole address. It also registers a cleanup procedure, which shuts the // instance down. // // TODO(a.garipov): Use svc or remove it. func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { t.Helper()
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f289f4b1b6f91f38d99ac8b9e3f9bdc9536609e7
openapi/v1.yaml
var defaultDNS = []string{"https://dns.adguard.com/dns-query", "https://dns.cloudflare.com/dns-query"}
<mask> <mask> UpstreamDNS []string `yaml:"upstream_dns"` <mask> } <mask> <mask> var defaultDNS = []string{"tls://1.1.1.1", "tls://1.0.0.1"} <mask> var defaultBootstrap = []string{"1.1.1.1"} <mask> <mask> type tlsConfigSettings struct { <mask> Enabled bool `yaml:"enabled" json:"enabled"` // Enabled is the encryption (DOT/DOH/HTTPS) status <mask> ServerName string `yaml:"server_name" json:"server_name,omitempty"` // ServerName is the hostname of your HTTPS/TLS server </s> [change] config, control, openapi: fix issues from reviw </s> remove // bootstrap servers are plain DNS only. We should remove tls:// https:// and sdns:// hosts from slice bootstraps := []string{} </s> add // bootstrap servers are plain DNS only. We should return http error if there are tls:// https:// or sdns:// hosts in slice </s> remove TestUpstreams: type: "object" description: "Upstream servers to be tested" required: - "upstream_dns" properties: upstream_dns: type: "array" description: 'Upstream servers, port is optional after colon' items: type: "string" example: - "tls://1.1.1.1" - "tls://1.0.0.1" </s> add </s> remove $ref: "#/definitions/TestUpstreams" </s> add $ref: "#/definitions/UpstreamsConfig" </s> remove description: "Upstream servers to be tested" </s> add description: "Upstream configuration to be tested" </s> remove if len(bootstraps) > 0 { config.DNS.BootstrapDNS = bootstraps </s> add if len(newconfig.BootstrapDNS) > 0 { config.DNS.BootstrapDNS = newconfig.BootstrapDNS
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/f2e547a54e50162caa25b562e49e2846dd92b575
config.go