forked from TrueCloudLab/frostfs-sdk-go
[#276] Merge repo with frostfs-api-go
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
parent
5361f0eceb
commit
6ce73790ea
337 changed files with 66666 additions and 283 deletions
30
api/rpc/client/client.go
Normal file
30
api/rpc/client/client.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
)
|
||||
|
||||
// Client represents client for exchanging messages
|
||||
// with a remote server using Protobuf RPC.
|
||||
type Client struct {
|
||||
cfg
|
||||
}
|
||||
|
||||
// New creates, configures via options and returns new Client instance.
|
||||
func New(opts ...Option) *Client {
|
||||
var c Client
|
||||
c.initDefault()
|
||||
|
||||
for _, opt := range opts {
|
||||
opt(&c.cfg)
|
||||
}
|
||||
|
||||
c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithDefaultCallOptions(grpc.ForceCodec(encoding.ProtoCodec{})))
|
||||
if c.tlsCfg != nil {
|
||||
c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithTransportCredentials(credentials.NewTLS(c.tlsCfg)))
|
||||
}
|
||||
|
||||
return &c
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue