grpc

package
v0.0.0-...-a7b145a Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientOptions = []grpc.DialOption{
	grpc.WithInsecure(),
	grpc.WithKeepaliveParams(keepalive.ClientParameters{
		Time:                30 * time.Second,
		Timeout:             10 * time.Second,
		PermitWithoutStream: true,
	}),
}

Functions

func NewClient

func NewClient(host string, port int) (*grpc.ClientConn, error)

Types

type GrpcServer

type GrpcServer struct {
	ServiceName string
	Port        int
	Opts        []grpc.ServerOption
}

GrpcServer is a grpc server.

func NewGrpcServer

func NewGrpcServer(serviceName string, port int, opts ...grpc.ServerOption) *GrpcServer

NewGrpcServer creates a new grpc server with serviceName, port and opts.

func (*GrpcServer) Serve

func (g *GrpcServer) Serve(ctx context.Context, callback RegisterCallBack)

Serve start a grpc server and panic when failed.

type RegisterCallBack

type RegisterCallBack func(*grpc.Server)

RegisterCallBack registers service for grpc server.

Jump to

Keyboard shortcuts

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