mirror of
https://github.com/restic/restic.git
synced 2026-11-21 13:02:42 +00:00
Resolve deprecations
This commit is contained in:
1 parent
29fecdbd40
commit
d991764a22
3 files changed
+18
-15
No files matched your search
@@ -36,7 +36,6 @@ require (
|
||||
github.com/spf13/pflag v1.0.10
|
||||
go.uber.org/automaxprocs v1.6.0
|
||||
golang.org/x/crypto v0.58.0
|
||||
golang.org/x/net v0.60.0
|
||||
golang.org/x/oauth2 v0.37.0
|
||||
golang.org/x/sync v0.24.0
|
||||
golang.org/x/sys v0.49.0
|
||||
@@ -106,6 +105,7 @@ require (
|
||||
go.opentelemetry.io/otel/trace v1.45.0 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.5 // indirect
|
||||
golang.org/x/exp v0.0.0-20260813180055-c1d0aacb2297 // indirect
|
||||
golang.org/x/net v0.60.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260724162435-b2f20204f0df // indirect
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/restic/restic/internal/debug"
|
||||
"github.com/restic/restic/internal/errors"
|
||||
"github.com/restic/restic/internal/feature"
|
||||
"golang.org/x/net/http2"
|
||||
)
|
||||
|
||||
// TransportOptions collects various options which can be set for an HTTP based
|
||||
@@ -86,15 +85,18 @@ func Transport(opts TransportOptions) (http.RoundTripper, error) {
|
||||
TLSClientConfig: &tls.Config{},
|
||||
}
|
||||
|
||||
// A custom TLSClientConfig disables automatic HTTP/2, so enable it explicitly.
|
||||
var protocols http.Protocols
|
||||
protocols.SetHTTP1(true)
|
||||
protocols.SetHTTP2(true)
|
||||
tr.Protocols = &protocols
|
||||
// ensure that http2 connections are closed if they are broken
|
||||
h2, err := http2.ConfigureTransports(tr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if feature.Flag.Enabled(feature.BackendErrorRedesign) {
|
||||
h2.WriteByteTimeout = 120 * time.Second
|
||||
h2.ReadIdleTimeout = 60 * time.Second
|
||||
h2.PingTimeout = 60 * time.Second
|
||||
tr.HTTP2 = &http.HTTP2Config{
|
||||
WriteByteTimeout: 120 * time.Second,
|
||||
SendPingTimeout: 60 * time.Second,
|
||||
PingTimeout: 60 * time.Second,
|
||||
}
|
||||
}
|
||||
|
||||
unixtransport.Register(tr)
|
||||
|
||||
@@ -3,7 +3,6 @@ package rclone
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
@@ -25,13 +24,12 @@ import (
|
||||
"github.com/restic/restic/internal/debug"
|
||||
"github.com/restic/restic/internal/errors"
|
||||
"github.com/restic/restic/internal/terminal"
|
||||
"golang.org/x/net/http2"
|
||||
)
|
||||
|
||||
// rclone is used to access data stored somewhere via rclone.
|
||||
type rclone struct {
|
||||
*rest.Backend
|
||||
tr *http2.Transport
|
||||
tr *http.Transport
|
||||
cmd *exec.Cmd
|
||||
waitCh <-chan struct{}
|
||||
waitResult error
|
||||
@@ -180,9 +178,12 @@ func newBackend(ctx context.Context, cfg Config, lim limiter.Limiter, errorLog f
|
||||
}
|
||||
|
||||
dialCount := 0
|
||||
tr := &http2.Transport{
|
||||
AllowHTTP: true, // this is not really HTTP, just stdin/stdout
|
||||
DialTLSContext: func(_ context.Context, network, address string, _ *tls.Config) (net.Conn, error) {
|
||||
// This is not really HTTP, just stdin/stdout.
|
||||
var protocols http.Protocols
|
||||
protocols.SetUnencryptedHTTP2(true)
|
||||
tr := &http.Transport{
|
||||
Protocols: &protocols,
|
||||
DialContext: func(_ context.Context, network, address string) (net.Conn, error) {
|
||||
debug.Log("new connection requested, %v %v", network, address)
|
||||
if dialCount > 0 {
|
||||
// the connection to the child process is already closed
|
||||
|
||||
Reference in new issue
Block a user