Pull request 1962: upd-code-deps

Squashed commit of the following:

commit 7a24cf8f9c5515f642cbfc7e730b95005eeab11d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Aug 15 14:54:16 2023 +0300

    all: upd code, deps, tools
This commit is contained in:
Ainar Garipov
2023-08-15 15:09:08 +03:00
parent 887c48cee8
commit 05262d7b6b
19 changed files with 103 additions and 148 deletions

View File

@@ -49,9 +49,8 @@ func (s *Server) DialContext(ctx context.Context, network, addr string) (conn ne
continue
}
return conn, err
return conn, nil
}
// TODO(a.garipov): Use errors.Join in Go 1.20.
return nil, errors.List(fmt.Sprintf("dialing %q", addr), dialErrs...)
return nil, errors.Join(dialErrs...)
}

View File

@@ -441,7 +441,7 @@ func ValidateUpstreams(upstreams []string) (err error) {
func ValidateUpstreamsPrivate(upstreams []string, privateNets netutil.SubnetSet) (err error) {
conf, err := newUpstreamConfig(upstreams)
if err != nil {
return err
return fmt.Errorf("creating config: %w", err)
}
if conf == nil {
@@ -469,11 +469,7 @@ func ValidateUpstreamsPrivate(upstreams []string, privateNets netutil.SubnetSet)
}
}
if len(errs) > 0 {
return errors.List("checking domain-specific upstreams", errs...)
}
return nil
return errors.Annotate(errors.Join(errs...), "checking domain-specific upstreams: %w")
}
var protocols = []string{

View File

@@ -405,9 +405,9 @@ func TestValidateUpstreamsPrivate(t *testing.T) {
u: "[/128.in-addr.arpa/]#",
}, {
name: "several_bad",
wantErr: `checking domain-specific upstreams: 2 errors: ` +
`"arpa domain \"1.2.3.4.in-addr.arpa.\" should point to a locally-served network", ` +
`"bad arpa domain name \"non.arpa.\": not a reversed ip network"`,
wantErr: `checking domain-specific upstreams: ` +
`arpa domain "1.2.3.4.in-addr.arpa." should point to a locally-served network` + "\n" +
`bad arpa domain name "non.arpa.": not a reversed ip network`,
u: "[/non.arpa/1.2.3.4.in-addr.arpa/127.in-addr.arpa/]#",
}, {
name: "partial_good",