grpc

package
v0.0.0-...-6c1bb8a Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProxyAuthorization used by signature, both gateway and grpc
	ProxyAuthorization = "proxy-authorization"
)
View Source
const (
	TraceID = "trace-id"
)

Variables

View Source
var ClientWithContextKey = clientWithContextKeyType{"_client_with_context"}

Functions

func ContextWithValueAndTimeout

func ContextWithValueAndTimeout(value interface{}, duration time.Duration) context.Context

func GenerateSign

func GenerateSign(secret string, message []byte) (auth string, err error)

func ProtoMessage2JSON

func ProtoMessage2JSON(message proto.Message) (string, error)

ProtoMessage2JSON marshal protobuf message to json string

func ProtoMessage2Map

func ProtoMessage2Map(message proto.Message) (map[string]interface{}, error)

ProtoMessage2Map marshal protobuf message to map[string]interface{}

Types

type ClientConn

type ClientConn interface {
	Conn() *grpc.ClientConn
	// contains filtered or unexported methods
}

func New

func New() (ClientConn, error)

type ClientInterceptor

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

ClientInterceptor the client's interceptor

func NewClientInterceptor

func NewClientInterceptor(sign Sign) *ClientInterceptor

NewClientInterceptor create a client interceptor

func (*ClientInterceptor) UnaryInterceptor

func (c *ClientInterceptor) UnaryInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

UnaryInterceptor a interceptor for client unary operations

type Sign

type Sign func(message []byte) (auth string, err error)

Jump to

Keyboard shortcuts

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