Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithValueAndTimeout(value interface{}, duration time.Duration) context.Context
- func GenerateSign(secret string, message []byte) (auth string, err error)
- func ProtoMessage2JSON(message proto.Message) (string, error)
- func ProtoMessage2Map(message proto.Message) (map[string]interface{}, error)
- type ClientConn
- type ClientInterceptor
- type Sign
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 ProtoMessage2JSON ¶
ProtoMessage2JSON marshal protobuf message to json string
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
Click to show internal directories.
Click to hide internal directories.