Skip to content
Snippets Groups Projects

client: add sidechannel support

Merged Jacob Vosmaer requested to merge jv-sidechannel-client into master
5 unresolved threads
Files
6
+ 10
0
@@ -4,6 +4,7 @@ import (
"context"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/client"
"gitlab.com/gitlab-org/gitaly/v14/internal/sidechannel"
"google.golang.org/grpc"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
)
@@ -30,6 +31,15 @@ func Dial(rawAddress string, connOpts []grpc.DialOption) (*grpc.ClientConn, erro
return DialContext(context.Background(), rawAddress, connOpts)
}
// DialSidechannel configures the dialer to establish a Gitaly
// backchannel connection instead of a regular gRPC connection. It also
// injects sr as a sidechannel registry, so that Gitaly can establish
// sidechannels back to the client.
func DialSidechannel(ctx context.Context, rawAddress string, sr *SidechannelRegistry, connOpts []grpc.DialOption) (*grpc.ClientConn, error) {
clientHandshaker := sidechannel.NewClientHandshaker(sr.logger, sr.registry)
return client.Dial(ctx, rawAddress, connOpts, clientHandshaker)
}
// FailOnNonTempDialError helps to identify if remote listener is ready to accept new connections.
func FailOnNonTempDialError() []grpc.DialOption {
return []grpc.DialOption{
Loading