Documentation ¶
Overview ¶
Package grpccli is grpc client with support for service discovery, logging, load balancing, trace, metrics, retries, circuit breaker.
Index ¶
- func Dial(ctx context.Context, endpoint string, opts ...Option) (*grpc.ClientConn, error)
- type Option
- func WithDialOptions(dialOptions ...grpc.DialOption) Option
- func WithDiscovery(discovery registry.Discovery) Option
- func WithDiscoveryInsecure(b bool) Option
- func WithEnableCircuitBreaker() Option
- func WithEnableLoadBalance() Option
- func WithEnableLog(log *zap.Logger) Option
- func WithEnableMetrics() Option
- func WithEnableRequestID() Option
- func WithEnableRetry() Option
- func WithEnableTrace() Option
- func WithOneWaySecure(serverName string, certFile string) Option
- func WithSecure(t string, serverName string, caFile string, certFile string, keyFile string) Option
- func WithStreamInterceptors(streamInterceptors ...grpc.StreamClientInterceptor) Option
- func WithTimeout(d time.Duration) Option
- func WithToken(enable bool, appID string, appKey string) Option
- func WithTwoWaySecure(serverName string, caFile string, certFile string, keyFile string) Option
- func WithUnaryInterceptors(unaryInterceptors ...grpc.UnaryClientInterceptor) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*options)
Option grpc dial options
func WithDialOptions ¶
func WithDialOptions(dialOptions ...grpc.DialOption) Option
WithDialOptions set dial options
func WithDiscovery ¶
WithDiscovery set dial discovery
func WithDiscoveryInsecure ¶ added in v1.8.0
WithDiscoveryInsecure setting discovery insecure
func WithEnableCircuitBreaker ¶
func WithEnableCircuitBreaker() Option
WithEnableCircuitBreaker enable circuit breaker
func WithEnableLoadBalance ¶
func WithEnableLoadBalance() Option
WithEnableLoadBalance enable load balance
func WithEnableRequestID ¶ added in v1.3.2
func WithEnableRequestID() Option
WithEnableRequestID enable request id
func WithOneWaySecure ¶ added in v1.3.20
WithOneWaySecure set one-way secure
func WithSecure ¶ added in v1.3.20
WithSecure support setting one-way or two-way secure
func WithStreamInterceptors ¶
func WithStreamInterceptors(streamInterceptors ...grpc.StreamClientInterceptor) Option
WithStreamInterceptors set dial streamInterceptors
func WithTwoWaySecure ¶ added in v1.3.20
WithTwoWaySecure set two-way secure
func WithUnaryInterceptors ¶
func WithUnaryInterceptors(unaryInterceptors ...grpc.UnaryClientInterceptor) Option
WithUnaryInterceptors set dial unaryInterceptors
Click to show internal directories.
Click to hide internal directories.