grpc_helper

package
v1.1.24-beta Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToRecvMessage = errors.New("failed to recv message")
)
View Source
var (
	InvalidFullMethodName = errors.New("invalid full method name")
)

Functions

func AuthFromMD

func AuthFromMD(ctx context.Context, expectedScheme string, headerAuthorize ...string) (string, error)

github.com/grpc-ecosystem/go-grpc-middleware/auth/metadata.go:AuthFromMD

func ErrorWrapper added in v1.1.16

func ErrorWrapper(err error) error

func ExpectCodes added in v1.1.16

func ExpectCodes(err error, cds ...codes.Code) error

func ExpectCodesWithoutOK added in v1.1.16

func ExpectCodesWithoutOK(err error, cds ...codes.Code) error

func GetSessionFromContext added in v0.99.2

func GetSessionFromContext(ctx context.Context) int64

func GetSubjectTokenFromContext

func GetSubjectTokenFromContext(ctx context.Context) (string, error)

func GetTokenFromContext

func GetTokenFromContext(ctx context.Context) (string, error)

func HandleGRPCError

func HandleGRPCError(logger log.FieldLogger, err error, format string, args ...interface{}) error

func HttpStatusCode2GrpcStatusCode

func HttpStatusCode2GrpcStatusCode(code int) codes.Code

func NewDialOptionWithTransportCredentials added in v1.1.16

func NewDialOptionWithTransportCredentials(tcs credentials.TransportCredentials) []grpc.DialOption

func StreamServerInterceptor

func StreamServerInterceptor(logger log.FieldLogger) grpc.StreamServerInterceptor

func UnaryServerInterceptor

func UnaryServerInterceptor(logger log.FieldLogger) grpc.UnaryServerInterceptor

Types

type HijackStream added in v1.0.0

type HijackStream struct {
	deviced_pb.DevicedService_ConnectClient
	// contains filtered or unexported fields
}

func NewHijackStream added in v1.0.0

func (*HijackStream) Recv added in v1.0.0

func (self *HijackStream) Recv() (*deviced_pb.ConnectRequest, error)

func (*HijackStream) RecvChan added in v1.0.0

func (self *HijackStream) RecvChan() chan *deviced_pb.ConnectRequest

type MethodDescription

type MethodDescription struct {
	Package string
	Service string
	Method  string
}

func ParseMethodDescription

func ParseMethodDescription(fullMethodName string) (*MethodDescription, error)

Jump to

Keyboard shortcuts

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