mirror of
https://github.com/linka-cloud/grpc.git
synced 2025-06-22 09:12:28 +00:00
service: replace cmd with NewFlagSet, add internal service version metadata interceptors
client: add NewFlagSet, add missing Options interface methods Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
@ -12,9 +12,13 @@ import (
|
||||
type Options interface {
|
||||
Name() string
|
||||
Version() string
|
||||
Address() string
|
||||
Secure() bool
|
||||
Registry() registry.Registry
|
||||
TLSConfig() *tls.Config
|
||||
DialOptions() []grpc.DialOption
|
||||
UnaryInterceptors() []grpc.UnaryClientInterceptor
|
||||
StreamInterceptors() []grpc.StreamClientInterceptor
|
||||
}
|
||||
|
||||
type Option func(*options)
|
||||
@ -91,7 +95,7 @@ type options struct {
|
||||
secure bool
|
||||
dialOptions []grpc.DialOption
|
||||
|
||||
unaryInterceptors []grpc.UnaryClientInterceptor
|
||||
unaryInterceptors []grpc.UnaryClientInterceptor
|
||||
streamInterceptors []grpc.StreamClientInterceptor
|
||||
}
|
||||
|
||||
@ -103,6 +107,10 @@ func (o *options) Version() string {
|
||||
return o.version
|
||||
}
|
||||
|
||||
func (o *options) Address() string {
|
||||
return o.addr
|
||||
}
|
||||
|
||||
func (o *options) Registry() registry.Registry {
|
||||
return o.registry
|
||||
}
|
||||
@ -118,3 +126,11 @@ func (o *options) Secure() bool {
|
||||
func (o *options) DialOptions() []grpc.DialOption {
|
||||
return o.dialOptions
|
||||
}
|
||||
|
||||
func (o *options) UnaryInterceptors() []grpc.UnaryClientInterceptor {
|
||||
return o.unaryInterceptors
|
||||
}
|
||||
|
||||
func (o *options) StreamInterceptors() []grpc.StreamClientInterceptor {
|
||||
return o.streamInterceptors
|
||||
}
|
||||
|
Reference in New Issue
Block a user