Grpc

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggingInterceptor

func LoggingInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

func NewClient

func NewClient(fs ...GrpcAttrFunc) *grpc.ClientConn

func NewServer

func NewServer(fs ...GrpcAttrFunc) *grpc.Server

func RecoveryInterceptor

func RecoveryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

func StreamLoggingInterceptor

func StreamLoggingInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

Types

type Grpc

type Grpc struct {
	KeyPath           string
	ChainStreamServer []grpc.StreamServerInterceptor
	ChainServer       []grpc.UnaryServerInterceptor
	Ip                string
	Host              string
}

func (*Grpc) GetClientcert

func (this *Grpc) GetClientcert(path string, host string) credentials.TransportCredentials

func (*Grpc) GetServercert

func (this *Grpc) GetServercert(path string) credentials.TransportCredentials

type GrpcAttrFunc

type GrpcAttrFunc func(grpc *Grpc) //设置User属性的 函数类型

func Host

func Host(host string) GrpcAttrFunc

func Ip

func Ip(ip string) GrpcAttrFunc

func KeyPath

func KeyPath(path string) GrpcAttrFunc

func StreamServerInterceptor

func StreamServerInterceptor(fn grpc.UnaryServerInterceptor) GrpcAttrFunc

type GrpcAttrFuncs

type GrpcAttrFuncs []GrpcAttrFunc

Jump to

Keyboard shortcuts

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