grpc

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(address string) (conn *grpc.ClientConn, err error)

NewClient returns a new client of grpc.

func NewTLSClient

func NewTLSClient(address string, cert *tls.Certificate) (conn *grpc.ClientConn, err error)

NewTLSClient creates a new TLS client for grpc connection

Types

type GRPCServerInterface

type GRPCServerInterface interface {
	grpc.ServiceRegistrar

	GracefulStop()
	Serve(lis net.Listener) error
}

type Server

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

Server represents a gRPC server.

func NewServer

func NewServer(address string) *Server

NewServer returns a new instance of the Server.

func (*Server) RegisterService

func (server *Server) RegisterService(register func(s grpc.ServiceRegistrar)) *Server

RegisterService registers grpc service

func (*Server) Run

func (server *Server) Run(stop <-chan struct{})

Run start grpc listener

func (*Server) Shutdown

func (server *Server) Shutdown()

Shutdown shuts down the server.

func (*Server) WithChainUnaryInterceptor

func (server *Server) WithChainUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) *Server

WithChainUnaryInterceptor sets the interceptors.It must be called before RegisterService.

func (*Server) WithKeepAliveParams

func (server *Server) WithKeepAliveParams(kp keepalive.ServerParameters) *Server

WithKeepAliveParams sets the KeepAlive option.It must be called before RegisterService.

func (*Server) WithOptions

func (server *Server) WithOptions(opts ...grpc.ServerOption) *Server

WithOptions sets the options for the RPC server.It must be called before RegisterService.

func (*Server) WithTLSConfig

func (server *Server) WithTLSConfig(cert *tls.Certificate) *Server

WithTLSConfig set the TLS configuration

Jump to

Keyboard shortcuts

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