diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-02-18 12:11:52 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-02-18 12:11:52 -0800 |
| commit | 77b9af531d18e10b04b49b069b5f26a329ed4902 (patch) | |
| tree | cae2524dfc445b352e5d6bab7a82f7af46b7a4c8 /weed/operation/grpc_client.go | |
| parent | 55761ae806bc7cc8ab34424508aee5481131b941 (diff) | |
| download | seaweedfs-77b9af531d18e10b04b49b069b5f26a329ed4902.tar.xz seaweedfs-77b9af531d18e10b04b49b069b5f26a329ed4902.zip | |
adding grpc mutual tls
Diffstat (limited to 'weed/operation/grpc_client.go')
| -rw-r--r-- | weed/operation/grpc_client.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/weed/operation/grpc_client.go b/weed/operation/grpc_client.go index d0931a8d3..a02844657 100644 --- a/weed/operation/grpc_client.go +++ b/weed/operation/grpc_client.go @@ -18,7 +18,7 @@ var ( grpcClientsLock sync.Mutex ) -func WithVolumeServerClient(volumeServer string, fn func(volume_server_pb.VolumeServerClient) error) error { +func WithVolumeServerClient(volumeServer string, grpcDialOption grpc.DialOption, fn func(volume_server_pb.VolumeServerClient) error) error { grpcAddress, err := toVolumeServerGrpcAddress(volumeServer) if err != nil { @@ -28,7 +28,7 @@ func WithVolumeServerClient(volumeServer string, fn func(volume_server_pb.Volume return util.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error { client := volume_server_pb.NewVolumeServerClient(grpcConnection) return fn(client) - }, grpcAddress) + }, grpcAddress, grpcDialOption) } @@ -42,7 +42,7 @@ func toVolumeServerGrpcAddress(volumeServer string) (grpcAddress string, err err return fmt.Sprintf("%s:%d", volumeServer[0:sepIndex], port+10000), nil } -func withMasterServerClient(masterServer string, fn func(masterClient master_pb.SeaweedClient) error) error { +func withMasterServerClient(masterServer string, grpcDialOption grpc.DialOption, fn func(masterClient master_pb.SeaweedClient) error) error { masterGrpcAddress, parseErr := util.ParseServerToGrpcAddress(masterServer, 0) if parseErr != nil { @@ -52,6 +52,6 @@ func withMasterServerClient(masterServer string, fn func(masterClient master_pb. return util.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error { client := master_pb.NewSeaweedClient(grpcConnection) return fn(client) - }, masterGrpcAddress) + }, masterGrpcAddress, grpcDialOption) } |
