Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package dnsproxy for openSUSE:Factory checked in at 2023-10-19 22:47:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dnsproxy (Old) and /work/SRC/openSUSE:Factory/.dnsproxy.new.1945 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dnsproxy" Thu Oct 19 22:47:39 2023 rev:10 rq:1118638 version:0.56.2 Changes: -------- --- /work/SRC/openSUSE:Factory/dnsproxy/dnsproxy.changes 2023-10-15 19:30:05.386407720 +0200 +++ /work/SRC/openSUSE:Factory/.dnsproxy.new.1945/dnsproxy.changes 2023-10-19 22:50:06.404497619 +0200 @@ -1,0 +2,8 @@ +Wed Oct 18 17:02:54 UTC 2023 - Eyad Issa <eyadlore...@gmail.com> + +- Update to version 0.56.2: + * Fixed: quic-go has been updated to fix QUIC issues on FreeBSD. (Pull request 291) + * Pull request 289: updated dependencies + * Pull request 288: close bootstraps + +------------------------------------------------------------------- Old: ---- dnsproxy-0.56.1.obscpio New: ---- dnsproxy-0.56.2.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dnsproxy.spec ++++++ --- /var/tmp/diff_new_pack.n8WZap/_old 2023-10-19 22:50:07.692544337 +0200 +++ /var/tmp/diff_new_pack.n8WZap/_new 2023-10-19 22:50:07.692544337 +0200 @@ -17,7 +17,7 @@ Name: dnsproxy -Version: 0.56.1 +Version: 0.56.2 Release: 0 Summary: A DNS proxy server License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.n8WZap/_old 2023-10-19 22:50:07.720545351 +0200 +++ /var/tmp/diff_new_pack.n8WZap/_new 2023-10-19 22:50:07.724545497 +0200 @@ -2,7 +2,7 @@ <service name="obs_scm" mode="manual"> <param name="scm">git</param> <param name="url">https://github.com/AdguardTeam/dnsproxy.git</param> - <param name="revision">v0.56.1</param> + <param name="revision">v0.56.2</param> <param name="match-tag">*</param> <param name="versionrewrite-pattern">v(\d+\.\d+\.\d+)</param> <param name="versionformat">@PARENT_TAG@</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.n8WZap/_old 2023-10-19 22:50:07.740546078 +0200 +++ /var/tmp/diff_new_pack.n8WZap/_new 2023-10-19 22:50:07.744546222 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/AdguardTeam/dnsproxy.git</param> - <param name="changesrevision">60d2174079eb8e920c7de87f7e4f7409d80aa9c3</param></service></servicedata> + <param name="changesrevision">46b2b1cb22104b4380f32986e783caac7a795223</param></service></servicedata> (No newline at EOF) ++++++ dnsproxy-0.56.1.obscpio -> dnsproxy-0.56.2.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/.github/workflows/build.yaml new/dnsproxy-0.56.2/.github/workflows/build.yaml --- old/dnsproxy-0.56.1/.github/workflows/build.yaml 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/.github/workflows/build.yaml 2023-10-17 15:09:58.000000000 +0200 @@ -1,7 +1,7 @@ name: Build 'env': - 'GO_VERSION': '1.20.8' + 'GO_VERSION': '1.20.10' 'on': 'push': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/.github/workflows/docker.yml new/dnsproxy-0.56.2/.github/workflows/docker.yml --- old/dnsproxy-0.56.1/.github/workflows/docker.yml 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/.github/workflows/docker.yml 2023-10-17 15:09:58.000000000 +0200 @@ -1,7 +1,7 @@ 'name': Docker 'env': - 'GO_VERSION': '1.20.8' + 'GO_VERSION': '1.20.10' 'on': 'push': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/.github/workflows/lint.yaml new/dnsproxy-0.56.2/.github/workflows/lint.yaml --- old/dnsproxy-0.56.1/.github/workflows/lint.yaml 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/.github/workflows/lint.yaml 2023-10-17 15:09:58.000000000 +0200 @@ -1,7 +1,7 @@ 'name': 'lint' 'env': - 'GO_VERSION': '1.20.8' + 'GO_VERSION': '1.20.10' 'on': 'push': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/bamboo-specs/bamboo.yaml new/dnsproxy-0.56.2/bamboo-specs/bamboo.yaml --- old/dnsproxy-0.56.1/bamboo-specs/bamboo.yaml 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/bamboo-specs/bamboo.yaml 2023-10-17 15:09:58.000000000 +0200 @@ -10,7 +10,7 @@ # exact patch version as opposed to a minor one to make sure that this exact # version is actually used and not whatever the docker daemon on the CI has # cached a few months ago. - 'dockerGo': 'golang:1.20.8' + 'dockerGo': 'golang:1.20.10' 'maintainer': 'Adguard Go Team' 'name': 'dnsproxy' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/go.mod new/dnsproxy-0.56.2/go.mod --- old/dnsproxy-0.56.1/go.mod 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/go.mod 2023-10-17 15:09:58.000000000 +0200 @@ -11,11 +11,11 @@ github.com/jessevdk/go-flags v1.5.0 github.com/miekg/dns v1.1.56 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/quic-go/quic-go v0.39.0 + github.com/quic-go/quic-go v0.39.1 github.com/stretchr/testify v1.8.4 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/net v0.15.0 - golang.org/x/sys v0.12.0 + golang.org/x/net v0.17.0 + golang.org/x/sys v0.13.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -32,7 +32,7 @@ github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-20 v0.3.4 // indirect go.uber.org/mock v0.3.0 // indirect - golang.org/x/crypto v0.13.0 // indirect + golang.org/x/crypto v0.14.0 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/tools v0.13.0 // indirect diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/go.sum new/dnsproxy-0.56.2/go.sum --- old/dnsproxy-0.56.1/go.sum 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/go.sum 2023-10-17 15:09:58.000000000 +0200 @@ -44,26 +44,26 @@ github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= github.com/quic-go/qtls-go1-20 v0.3.4/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/quic-go/quic-go v0.39.0 h1:AgP40iThFMY0bj8jGxROhw3S0FMGa8ryqsmi9tBH3So= -github.com/quic-go/quic-go v0.39.0/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= +github.com/quic-go/quic-go v0.39.1 h1:d/m3oaN/SD2c+f7/yEjZxe2zEVotXprnrCCJ2y/ZZFE= +github.com/quic-go/quic-go v0.39.1/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/scripts/make/go-lint.sh new/dnsproxy-0.56.2/scripts/make/go-lint.sh --- old/dnsproxy-0.56.1/scripts/make/go-lint.sh 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/scripts/make/go-lint.sh 2023-10-17 15:09:58.000000000 +0200 @@ -35,7 +35,7 @@ go_version="$( "${GO:-go}" version )" readonly go_version -go_min_version='go1.20.8' +go_min_version='go1.20.10' go_version_msg=" warning: your go version (${go_version}) is different from the recommended minimal one (${go_min_version}). if you have the version installed, please set the GO environment variable. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/upstream/doh.go new/dnsproxy-0.56.2/upstream/doh.go --- old/dnsproxy-0.56.1/upstream/doh.go 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/upstream/doh.go 2023-10-17 15:09:58.000000000 +0200 @@ -49,6 +49,9 @@ // one. getDialer DialerInitializer + // closeBoot is the function to close the bootstrap upstreams. + closeBoot closeFunc + // addr is the DNS-over-HTTPS server URL. addr *url.URL @@ -89,7 +92,7 @@ httpVersions = DefaultHTTPVersions } - getDialer, err := newDialerInitializer(addr, opts) + getDialer, closeBoot, err := newDialerInitializer(addr, opts) if err != nil { // Don't wrap the error since it's informative enough as is. return nil, err @@ -97,6 +100,7 @@ ups := &dnsOverHTTPS{ getDialer: getDialer, + closeBoot: closeBoot, addr: addr, quicConfig: &quic.Config{ KeepAlivePeriod: QUICKeepAlivePeriod, @@ -191,11 +195,11 @@ runtime.SetFinalizer(p, nil) - if p.client == nil { - return nil + if p.client != nil { + err = p.closeClient(p.client) } - return p.closeClient(p.client) + return errors.Join(err, errors.Annotate(p.closeBoot(), "closing bootstrap: %w")) } // closeClient cleans up resources used by client if necessary. Note, that at diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/upstream/dot.go new/dnsproxy-0.56.2/upstream/dot.go --- old/dnsproxy-0.56.1/upstream/dot.go 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/upstream/dot.go 2023-10-17 15:09:58.000000000 +0200 @@ -31,6 +31,9 @@ // new one. getDialer DialerInitializer + // closeBoot is the function to close the bootstrap upstreams. + closeBoot closeFunc + // tlsConf is the configuration of TLS. tlsConf *tls.Config @@ -54,7 +57,7 @@ func newDoT(addr *url.URL, opts *Options) (ups Upstream, err error) { addPort(addr, defaultPortDoT) - getDialer, err := newDialerInitializer(addr, opts) + getDialer, closeBoot, err := newDialerInitializer(addr, opts) if err != nil { // Don't wrap the error since it's informative enough as is. return nil, err @@ -63,6 +66,7 @@ tlsUps := &dnsOverTLS{ addr: addr, getDialer: getDialer, + closeBoot: closeBoot, // #nosec G402 -- TLS certificate verification could be disabled by // configuration. tlsConf: &tls.Config{ @@ -147,11 +151,9 @@ } } - if len(closeErrs) > 0 { - return errors.List("closing tls conns", closeErrs...) - } + closeErrs = append(closeErrs, errors.Annotate(p.closeBoot(), "closing bootstrap: %w")) - return nil + return errors.Join(closeErrs...) } // conn returns the first available connection from the pool if there is any, or diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/upstream/plain.go new/dnsproxy-0.56.2/upstream/plain.go --- old/dnsproxy-0.56.1/upstream/plain.go 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/upstream/plain.go 2023-10-17 15:09:58.000000000 +0200 @@ -37,6 +37,9 @@ // one. getDialer DialerInitializer + // closeBoot is the function to close the bootstrap upstreams. + closeBoot closeFunc + // net is the network of the connections. net network @@ -59,7 +62,7 @@ addPort(addr, defaultPortPlain) - getDialer, err := newDialerInitializer(addr, opts) + getDialer, closeBoot, err := newDialerInitializer(addr, opts) if err != nil { return nil, err } @@ -67,6 +70,7 @@ return &plainDNS{ addr: addr, getDialer: getDialer, + closeBoot: closeBoot, net: addr.Scheme, timeout: opts.Timeout, }, nil @@ -175,7 +179,7 @@ // Close implements the [Upstream] interface for *plainDNS. func (p *plainDNS) Close() (err error) { - return nil + return errors.Annotate(p.closeBoot(), "closing bootstrap: %w") } // errQuestion is returned when a message has malformed question section. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/upstream/quic.go new/dnsproxy-0.56.2/upstream/quic.go --- old/dnsproxy-0.56.1/upstream/quic.go 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/upstream/quic.go 2023-10-17 15:09:58.000000000 +0200 @@ -57,6 +57,9 @@ // one. getDialer DialerInitializer + // closeBoot is the function to close the bootstrap upstreams. + closeBoot closeFunc + // addr is the DNS-over-QUIC server URL. addr *url.URL @@ -97,13 +100,14 @@ func newDoQ(addr *url.URL, opts *Options) (u Upstream, err error) { addPort(addr, defaultPortDoQ) - getDialer, err := newDialerInitializer(addr, opts) + getDialer, closeBoot, err := newDialerInitializer(addr, opts) if err != nil { return nil, err } u = &dnsOverQUIC{ getDialer: getDialer, + closeBoot: closeBoot, addr: addr, quicConfig: &quic.Config{ KeepAlivePeriod: QUICKeepAlivePeriod, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsproxy-0.56.1/upstream/upstream.go new/dnsproxy-0.56.2/upstream/upstream.go --- old/dnsproxy-0.56.1/upstream/upstream.go 2023-10-05 14:59:02.000000000 +0200 +++ new/dnsproxy-0.56.2/upstream/upstream.go 2023-10-17 15:09:58.000000000 +0200 @@ -17,6 +17,7 @@ "time" "github.com/AdguardTeam/dnsproxy/internal/bootstrap" + "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/netutil" "github.com/ameshkov/dnscrypt/v2" @@ -24,6 +25,7 @@ "github.com/miekg/dns" "github.com/quic-go/quic-go" "github.com/quic-go/quic-go/logging" + "golang.org/x/exp/slices" ) // Upstream is an interface for a DNS resolver. @@ -76,10 +78,11 @@ // CipherSuites is a custom list of TLSv1.2 ciphers. CipherSuites []uint16 - // Bootstrap is a list of DNS servers to be used to resolve - // DNS-over-HTTPS/DNS-over-TLS hostnames. Plain DNS, DNSCrypt, or - // DNS-over-HTTPS/DNS-over-TLS with IP addresses (not hostnames) could be - // used. + // Bootstrap is a list of DNS servers to be used to resolve DoH/DoT/DoQ + // hostnames. Plain DNS, DNSCrypt, or DoH/DoT/DoQ with IP addresses (not + // hostnames) could be used. Those servers will be turned to upstream + // servers and will be closed as soon as the resolved upstream itself is + // closed. Bootstrap []string // List of IP addresses of the upstream DNS server. If not empty, bootstrap @@ -306,12 +309,26 @@ // resolving will be performed only once. type DialerInitializer func() (handler bootstrap.DialHandler, err error) +// closeFunc is the signature of a function that closes an upstream. +type closeFunc func() (err error) + +// nopClose is the [closeFunc] that does nothing. +func nopClose() (err error) { return nil } + // newDialerInitializer creates an initializer of the dialer that will dial the // addresses resolved from u using opts. -func newDialerInitializer(u *url.URL, opts *Options) (di DialerInitializer, err error) { +// +// TODO(e.burkov): Returning closeFunc is a temporary solution. It's needed +// to close the bootstrap upstreams, which may require closing. It should be +// gone when the [Options.Bootstrap] will be turned into [Resolver] and it's +// closing will be handled by the caller. +func newDialerInitializer( + u *url.URL, + opts *Options, +) (di DialerInitializer, closeBoot closeFunc, err error) { host, port, err := netutil.SplitHostPort(u.Host) if err != nil { - return nil, fmt.Errorf("invalid address: %s: %w", u.Host, err) + return nil, nopClose, fmt.Errorf("invalid address: %s: %w", u.Host, err) } if addrsLen := len(opts.ServerIPAddrs); addrsLen > 0 { @@ -324,58 +341,58 @@ handler := bootstrap.NewDialContext(opts.Timeout, addrs...) - return func() (bootstrap.DialHandler, error) { return handler, nil }, nil + return func() (h bootstrap.DialHandler, err error) { return handler, nil }, nopClose, nil } else if _, err = netip.ParseAddr(host); err == nil { // Don't resolve the address of the server since it's already an IP. handler := bootstrap.NewDialContext(opts.Timeout, u.Host) - return func() (bootstrap.DialHandler, error) { return handler, nil }, nil + return func() (h bootstrap.DialHandler, err error) { return handler, nil }, nopClose, nil } - resolvers, err := newResolvers(opts) + resolvers, closeBoot, err := newResolvers(opts) if err != nil { - // Don't wrap the error since it's informative enough as is. - return nil, err + return nil, nopClose, errors.Join(err, closeBoot()) } - var dialHandler atomic.Value + var dialHandler atomic.Pointer[bootstrap.DialHandler] di = func() (h bootstrap.DialHandler, resErr error) { // Check if the dial handler has already been created. - h, ok := dialHandler.Load().(bootstrap.DialHandler) - if ok { - return h, nil + if hPtr := dialHandler.Load(); hPtr != nil { + return *hPtr, nil } // TODO(e.burkov): It may appear that several exchanges will try to // resolve the upstream hostname at the same time. Currently, the last // successful value will be stored in dialHandler, but ideally we should - // resolve only once. + // resolve only once at a time. h, resolveErr := bootstrap.ResolveDialContext(u, opts.Timeout, resolvers, opts.PreferIPv6) if resolveErr != nil { return nil, fmt.Errorf("creating dial handler: %w", resolveErr) } - if !dialHandler.CompareAndSwap(nil, h) { - return dialHandler.Load().(bootstrap.DialHandler), nil + if !dialHandler.CompareAndSwap(nil, &h) { + // The dial handler has just been created by another exchange. + return *dialHandler.Load(), nil } return h, nil } - return di, nil + return di, closeBoot, nil } // newResolvers prepares resolvers for bootstrapping. If opts.Bootstrap is // empty, the only new [net.Resolver] will be returned. Otherwise, the it will // be added for each occurrence of an empty string in [Options.Bootstrap]. -func newResolvers(opts *Options) (resolvers []Resolver, err error) { +func newResolvers(opts *Options) (resolvers []Resolver, closeBoot closeFunc, err error) { bootstraps := opts.Bootstrap - if len(bootstraps) == 0 { - return []Resolver{&net.Resolver{}}, nil + l := len(bootstraps) + if l == 0 { + return []Resolver{&net.Resolver{}}, nopClose, nil } - resolvers = make([]Resolver, 0, len(bootstraps)) - for _, boot := range bootstraps { + resolvers, closeBoots := make([]Resolver, 0, l), make([]closeFunc, 0, l) + for i, boot := range bootstraps { if boot == "" { resolvers = append(resolvers, &net.Resolver{}) @@ -384,11 +401,24 @@ r, rErr := NewUpstreamResolver(boot, opts) if rErr != nil { - return nil, fmt.Errorf("preparing bootstrap resolver: %w", rErr) + resolvers = nil + err = fmt.Errorf("preparing bootstrap resolver at index %d: %w", i, rErr) + + break } resolvers = append(resolvers, r) + closeBoots = append(closeBoots, r.(upstreamResolver).Close) } - return resolvers, nil + closeBoots = slices.Clip(closeBoots) + + return resolvers, func() (closeErr error) { + var errs []error + for _, cb := range closeBoots { + errs = append(errs, cb()) + } + + return errors.Join(errs...) + }, err } ++++++ dnsproxy.obsinfo ++++++ --- /var/tmp/diff_new_pack.n8WZap/_old 2023-10-19 22:50:07.884551300 +0200 +++ /var/tmp/diff_new_pack.n8WZap/_new 2023-10-19 22:50:07.888551445 +0200 @@ -1,5 +1,5 @@ name: dnsproxy -version: 0.56.1 -mtime: 1696510742 -commit: 60d2174079eb8e920c7de87f7e4f7409d80aa9c3 +version: 0.56.2 +mtime: 1697548198 +commit: 46b2b1cb22104b4380f32986e783caac7a795223 ++++++ vendor.tar.zstd ++++++ Binary files /var/tmp/diff_new_pack.n8WZap/_old and /var/tmp/diff_new_pack.n8WZap/_new differ