Skip to content

Commit

Permalink
Merge branch 'master' into ADG-7988
Browse files Browse the repository at this point in the history
  • Loading branch information
IldarKamalov committed Jan 16, 2024
2 parents dfd1eff + 6dbeb5b commit b3c6c20
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ NOTE: Add new changes BELOW THIS COMMENT.

### Changed

- The bootstrapped upstream addresses now updated according to the TTL of the
bootstrap DNS response ([#6321]).
- Logging level of timeout errors is now `error` instead of `debug` ([#6574]).
- The field `"upstream_mode"` in `POST /control/dns_config` and
`GET /control/dns_info` HTTP APIs now accepts `load_balance` value. Check
Expand Down Expand Up @@ -82,6 +84,7 @@ In this release, the schema version has changed from 27 to 28.
- Omitted CNAME records in safe search results, which can cause YouTube to not
work on iOS ([#6352]).

[#6321]: https://github.com/AdguardTeam/AdGuardHome/issues/6321
[#6352]: https://github.com/AdguardTeam/AdGuardHome/issues/6352
[#6409]: https://github.com/AdguardTeam/AdGuardHome/issues/6409
[#6480]: https://github.com/AdguardTeam/AdGuardHome/issues/6480
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/AdguardTeam/AdGuardHome
go 1.20

require (
github.com/AdguardTeam/dnsproxy v0.61.1
github.com/AdguardTeam/dnsproxy v0.62.0
github.com/AdguardTeam/golibs v0.18.1
github.com/AdguardTeam/urlfilter v0.17.3
github.com/NYTimes/gziphandler v1.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/AdguardTeam/dnsproxy v0.61.1 h1:RdGVTHZR8N6eAyae13ORSlvn9qNeHK/h2g9mbVM/VS4=
github.com/AdguardTeam/dnsproxy v0.61.1/go.mod h1:IdmXdkpc+m+S2EajJkVZDZm//yQ4mQm2FCOugQpc/N8=
github.com/AdguardTeam/dnsproxy v0.62.0 h1:IaWW+Ln4SJ4V+y8qyVlTlYDN3ATDkqWCufph+Gxz82c=
github.com/AdguardTeam/dnsproxy v0.62.0/go.mod h1:IdmXdkpc+m+S2EajJkVZDZm//yQ4mQm2FCOugQpc/N8=
github.com/AdguardTeam/golibs v0.18.1 h1:6u0fvrIj2qjUsRdbIGJ9AR0g5QRSWdKIo/DYl3tp5aM=
github.com/AdguardTeam/golibs v0.18.1/go.mod h1:DKhCIXHcUYtBhU8ibTLKh1paUL96n5zhQBlx763sj+U=
github.com/AdguardTeam/urlfilter v0.17.3 h1:fg/ObbnO0Cv6aw0tW6N/ETDMhhNvmcUUOZ7HlmKC3rw=
Expand Down
9 changes: 7 additions & 2 deletions internal/dnsforward/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,22 @@ func (req *jsonDNSConfig) checkBootstrap() (err error) {
}

var b string
defer func() { err = errors.Annotate(err, "checking bootstrap %s: invalid address: %w", b) }()
defer func() { err = errors.Annotate(err, "checking bootstrap %s: %w", b) }()

for _, b = range *req.Bootstraps {
if b == "" {
return errors.Error("empty")
}

if _, err = upstream.NewUpstreamResolver(b, nil); err != nil {
var resolver *upstream.UpstreamResolver
if resolver, err = upstream.NewUpstreamResolver(b, nil); err != nil {
// Don't wrap the error because it's informative enough as is.
return err
}

if err = resolver.Close(); err != nil {
return fmt.Errorf("closing %s: %w", b, err)
}
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions internal/dnsforward/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ func TestDNSForwardHTTP_handleSetConfig(t *testing.T) {
`upstream servers: validating upstream "!!!": not an ip:port`,
}, {
name: "bootstraps_bad",
wantSet: `validating dns config: checking bootstrap a: invalid address: not a bootstrap: ` +
`ParseAddr("a"): unable to parse IP`,
wantSet: `validating dns config: checking bootstrap a: not a bootstrap: ParseAddr("a"): ` +
`unable to parse IP`,
}, {
name: "cache_bad_ttl",
wantSet: `validating dns config: cache_ttl_min must be less than or equal to cache_ttl_max`,
Expand Down
2 changes: 1 addition & 1 deletion internal/dnsforward/upstreams.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (s *Server) createBootstrap(

var parallel upstream.ParallelResolver
for _, b := range boots {
parallel = append(parallel, b)
parallel = append(parallel, upstream.NewCachingResolver(b))
}

if s.etcHosts != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/next/dnssvc/dnssvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func addressesToUpstreams(
// TODO(e.burkov): Add system hosts resolver here.
var bootstrap upstream.ParallelResolver
for _, r := range boots {
bootstrap = append(bootstrap, r)
bootstrap = append(bootstrap, upstream.NewCachingResolver(r))
}

upstreams = make([]upstream.Upstream, len(upsStrs))
Expand Down

0 comments on commit b3c6c20

Please sign in to comment.