Documentation ¶
Index ¶
- Variables
- func TLSConfig(serverName string) *tls.Config
- type Pool
- func (p *Pool) AddDialOption(opts ...grpc.DialOption)
- func (p *Pool) Close(target ...string)
- func (p *Pool) CloseConn(conn *grpc.ClientConn)
- func (p *Pool) DialInsecure(target string) (*grpc.ClientConn, error)
- func (p *Pool) DialSecure(target string, creds credentials.TransportCredentials) (*grpc.ClientConn, error)
- func (p *Pool) SetContext(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultDialOptions = []grpc.DialOption{ grpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient( grpc_prometheus.UnaryClientInterceptor, rpcerror.UnaryClientInterceptor(errors.FromGRPCError), rpclog.UnaryClientInterceptor(nil), )), grpc.WithStreamInterceptor(grpc_middleware.ChainStreamClient( grpc_prometheus.StreamClientInterceptor, rpcerror.StreamClientInterceptor(errors.FromGRPCError), restartstream.Interceptor(restartstream.DefaultSettings), rpclog.StreamClientInterceptor(nil), )), grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: 5 * time.Minute, Timeout: 10 * time.Second, PermitWithoutStream: false, }), }
DefaultDialOptions for connecting with servers
View Source
var Global = NewPool(context.Background(), DefaultDialOptions...)
Global pool with connections
View Source
var RootCAs *x509.CertPool
RootCAs to use in API connections
Functions ¶
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool with connections
func NewPool ¶
func NewPool(ctx context.Context, dialOptions ...grpc.DialOption) *Pool
NewPool returns a new connection pool that uses the given DialOptions
func (*Pool) AddDialOption ¶
func (p *Pool) AddDialOption(opts ...grpc.DialOption)
AddDialOption adds DialOption for the pool. Only new connections will use these new DialOptions
func (*Pool) CloseConn ¶
func (p *Pool) CloseConn(conn *grpc.ClientConn)
CloseConn closes a connection.
func (*Pool) DialInsecure ¶
func (p *Pool) DialInsecure(target string) (*grpc.ClientConn, error)
DialInsecure gets a connection from the pool or creates a new one This function is blocking if grpc.WithBlock() is used
func (*Pool) DialSecure ¶
func (p *Pool) DialSecure(target string, creds credentials.TransportCredentials) (*grpc.ClientConn, error)
DialSecure gets a connection from the pool or creates a new one This function is blocking if grpc.WithBlock() is used
func (*Pool) SetContext ¶
SetContext sets a new background context for the pool. Only new connections will use this new context
Click to show internal directories.
Click to hide internal directories.