feat:support custom callopts on client side

Signed-off-by: haoyun <yun.hao@daocloud.io>
This commit is contained in:
haoyun
2021-11-16 11:31:33 +08:00
parent 7020719646
commit 547040cd5b
2 changed files with 16 additions and 4 deletions

View File

@@ -34,6 +34,7 @@ type clientOpts struct {
defaultPlatform platforms.MatchComparer
services *services
dialOptions []grpc.DialOption
callOptions []grpc.CallOption
timeout time.Duration
}
@@ -75,6 +76,14 @@ func WithDialOpts(opts []grpc.DialOption) ClientOpt {
}
}
// WithCallOpts allows grpc.CallOptions to be set on the connection
func WithCallOpts(opts []grpc.CallOption) ClientOpt {
return func(c *clientOpts) error {
c.callOptions = opts
return nil
}
}
// WithServices sets services used by the client.
func WithServices(opts ...ServicesOpt) ClientOpt {
return func(c *clientOpts) error {