Pull request 2125: 6321 upd proxy

Updates #6321.

Squashed commit of the following:

commit 033f4d427bc965c8c5b5fc452ddc938b71c8d4f4
Merge: febf5b568 f7995aa02
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Jan 16 12:42:50 2024 +0300

    Merge branch 'master' into 6321-upd-proxy

commit febf5b568b012ccdce86c1d0dde710b99f5729b2
Merge: 7e4b247a4 58b47adaf
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Jan 16 12:34:28 2024 +0300

    Merge branch 'master' into 6321-upd-proxy

commit 7e4b247a40263225dda3aaa77b823c056ae49541
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Fri Jan 12 14:37:28 2024 +0300

    all: upd proxy revision

commit 0e925c1fcfb5ea4b712360721b62ecef1c8355d8
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Jan 11 14:24:47 2024 +0300

    dnsforward: imp code

commit 6f5c271895f973f6b3ad842cb987cdc2c89856f8
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Wed Jan 10 16:34:02 2024 +0300

    all: use caching resolver more, imp code

commit ce3f3137d2a2ed5da7829f9ecf49bab388d44852
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Wed Jan 10 16:00:08 2024 +0300

    all: log changes

commit ce90dbcda8586fda0d12d86ef609de505ae87164
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Wed Jan 10 13:01:25 2024 +0300

    dnsforward: use caching resolvers

commit 208fbaf0aa50df33f8482a441d361d106fc7b146
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Wed Jan 10 12:52:15 2024 +0300

    all: upd proxy
This commit is contained in:
Eugene Burkov
2024-01-16 13:18:22 +03:00
parent f7995aa022
commit 6dbeb5b971
7 changed files with 17 additions and 9 deletions

View File

@@ -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

View File

@@ -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`,

View File

@@ -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 {