connect

package
v0.0.0-...-f952efe Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Name       string
	Address    string
	TLS        bool
	TLSOptions *TLSOptions
	Conn       *grpc.ClientConn
}

func (*Connection) Close

func (c *Connection) Close() error

Close close the gRPC connection

func (*Connection) Connect

func (c *Connection) Connect() (*Connection, error)

Connect connect to gRPC server Remember to defer.Close() to avoid memory leak

type Connector

type Connector map[string]*Connection

func (Connector) Add

func (c Connector) Add(connections ...*Connection) Connector

Add add connection to connector

func (Connector) Connect

func (c Connector) Connect(name string) (*grpc.ClientConn, error)

Connect connect to the gRPC server Remember to defer Close() to avoid memory leak

func (Connector) Delete

func (c Connector) Delete(connections ...*Connection) Connector

Delete delete connection in the connector

func (Connector) Get

func (c Connector) Get(name string) (*Connection, error)

Get get connection in the connector by name

type TLSOptions

type TLSOptions struct {
	CACert     string
	ClientCert string
	ClientKey  string
}

Jump to

Keyboard shortcuts

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