mirror of
https://github.com/garethgeorge/backrest.git
synced 2025-12-14 17:45:36 +00:00
Some checks failed
Release Please / release-please (push) Has been cancelled
Build Snapshot Release / build (push) Has been cancelled
Test / test-nix (push) Has been cancelled
Test / test-win (push) Has been cancelled
Update Restic / update-restic-version (push) Has been cancelled
28 lines
663 B
Go
28 lines
663 B
Go
package tunnel
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"net"
|
|
"net/http"
|
|
"time"
|
|
|
|
"go.uber.org/zap"
|
|
"golang.org/x/net/http2"
|
|
)
|
|
|
|
// NewInsecureHttpClient creates a new HTTP client that allows insecure connections (HTTP/2 over plain TCP).
|
|
// This is useful for testing or when you don't need TLS.
|
|
func NewInsecureHttpClient() *http.Client {
|
|
return &http.Client{
|
|
Transport: &http2.Transport{
|
|
AllowHTTP: true,
|
|
DialTLS: func(network, addr string, _ *tls.Config) (net.Conn, error) {
|
|
zap.L().Sugar().Debugf("Dialing %s on %s", network, addr)
|
|
return net.Dial(network, addr)
|
|
},
|
|
IdleConnTimeout: 300 * time.Second,
|
|
ReadIdleTimeout: 60 * time.Second,
|
|
},
|
|
}
|
|
}
|