dnsforward: imp code
This commit is contained in:
parent
6f5c271895
commit
0e925c1fcf
|
@ -267,7 +267,7 @@ 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 == "" {
|
||||
|
@ -278,7 +278,9 @@ func (req *jsonDNSConfig) checkBootstrap() (err error) {
|
|||
if resolver, err = upstream.NewUpstreamResolver(b, nil); err != nil {
|
||||
// Don't wrap the error because it's informative enough as is.
|
||||
return err
|
||||
} else if err = resolver.Close(); err != nil {
|
||||
}
|
||||
|
||||
if err = resolver.Close(); err != nil {
|
||||
return fmt.Errorf("closing %s: %w", b, err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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`,
|
||||
|
|
Loading…
Reference in New Issue