grpc_client

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2020 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TLSConnExample

func TLSConnExample()

func TimeoutLogExample

func TimeoutLogExample()

Types

type GrpcClientConnBuilder

type GrpcClientConnBuilder interface {
	WithContext(ctx context.Context)
	WithOptions(opts ...grpc.DialOption)
	WithInsecure()
	WithUnaryInterceptors(interceptors []grpc.UnaryClientInterceptor)
	WithStreamInterceptors(interceptors []grpc.StreamClientInterceptor)
	WithKeepAliveParams(params keepalive.ClientParameters)
	GetConn(addr string) (*grpc.ClientConn, error)
}

GrpcClientConnBuilder is a builder to create GRPC connection to the GRPC Server

type GrpcConnBuilder added in v1.2.0

type GrpcConnBuilder struct {
	// contains filtered or unexported fields
}

GRPC client builder

func (*GrpcConnBuilder) GetConn added in v1.2.0

func (b *GrpcConnBuilder) GetConn(addr string) (*grpc.ClientConn, error)

GetConn returns the client connection to the server

func (*GrpcConnBuilder) GetTlsConn added in v1.2.0

func (b *GrpcConnBuilder) GetTlsConn(addr string) (*grpc.ClientConn, error)

GetTlsConn returns client connection to the server

func (*GrpcConnBuilder) WithBlock added in v1.2.0

func (b *GrpcConnBuilder) WithBlock()

WithBlock the dialing blocks until the underlying connection is up. Without this, Dial returns immediately and connecting the server happens in background.

func (*GrpcConnBuilder) WithClientTransportCredentials added in v1.2.0

func (b *GrpcConnBuilder) WithClientTransportCredentials(insecureSkipVerify bool, certPool *x509.CertPool)

ClientTransportCredentials builds transport credentials for a gRPC client using the given properties.

func (*GrpcConnBuilder) WithContext added in v1.2.0

func (b *GrpcConnBuilder) WithContext(ctx context.Context)

WithContext set the context to be used in the dial

func (*GrpcConnBuilder) WithInsecure added in v1.2.0

func (b *GrpcConnBuilder) WithInsecure()

WithInsecure set the connection as insecure

func (*GrpcConnBuilder) WithKeepAliveParams added in v1.2.0

func (b *GrpcConnBuilder) WithKeepAliveParams(params keepalive.ClientParameters)

WithKeepAliveParams set the keep alive params ClientParameters is used to set keepalive parameters on the client-side. These configure how the client will actively probe to notice when a connection is broken and send pings so intermediaries will be aware of the liveness of the connection. Make sure these parameters are set in coordination with the keepalive policy on the server, as incompatible settings can result in closing of connection.

func (*GrpcConnBuilder) WithOptions added in v1.2.0

func (b *GrpcConnBuilder) WithOptions(opts ...grpc.DialOption)

WithOptions set dial options

func (*GrpcConnBuilder) WithStreamInterceptors added in v1.2.0

func (b *GrpcConnBuilder) WithStreamInterceptors(interceptors []grpc.StreamClientInterceptor)

WithUnaryInterceptors set a list of interceptors to the Grpc client for stream connection By default, gRPC doesn't allow one to have more than one interceptor either on the client nor on the server side. By using `grpc_middleware` we are able to provides convenient method to add a list of interceptors

func (*GrpcConnBuilder) WithUnaryInterceptors added in v1.2.0

func (b *GrpcConnBuilder) WithUnaryInterceptors(interceptors []grpc.UnaryClientInterceptor)

WithUnaryInterceptors set a list of interceptors to the Grpc client for unary connection By default, gRPC doesn't allow one to have more than one interceptor either on the client nor on the server side. By using `grpc_middleware` we are able to provides convenient method to add a list of interceptors

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL