grpc

package
v0.0.0-...-4b256d5 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionPool

type ConnectionPool interface {
	io.Closer
	Client() (*Transport, error)
	Detect(ctx context.Context, req *protocol.Request) (*protocol.Response, error)
}

ConnectionPool provides function to work with client connections

func NewLazyTransportPool

func NewLazyTransportPool(ctx context.Context, poolSize int, grpcAddress string,
	connTimeout time.Duration, options ...Option) ConnectionPool

NewLazyTransportPool provides connection pool to the service

type DetectorClient

type DetectorClient = protocol.DetectorClient

APIClient alias

type Option

type Option func(*Options)

Option configuration type

func WithSecure

func WithSecure(secure bool) Option

WithSecure connection

func WithTransportCredentials

func WithTransportCredentials(crt, key, ca, serverName string) Option

WithTransportCredentials inits secure certificates

type Options

type Options struct {
	// Secure connections
	Secure bool

	// GRPCAddress contains HOST:PORT or IP:PORT to connecto to Pagecache GRPC server
	GRPCAddress string

	// Connect Certificates .pem, .crt
	CrtFile     string
	KeyFile     string
	RootCrtFile string
	ServerName  string
}

Options of the client connect

func (*Options) TransportCredentials

func (opt *Options) TransportCredentials() (credentials.TransportCredentials, error)

TransportCredentials init GRPC transport credentionals

type Transport

type Transport struct {
	protocol.DetectorClient
	// contains filtered or unexported fields
}

func NewTransport

func NewTransport(ctx context.Context, grpcAddress string, options ...Option) (*Transport, error)

NewTransport connector pool

func (*Transport) Close

func (tr *Transport) Close() error

Close GRPC connection to API

func (*Transport) Detect

func (tr *Transport) Detect(ctx context.Context, req *protocol.Request) (*protocol.Response, error)

Detect user information

Jump to

Keyboard shortcuts

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