Documentation ¶
Index ¶
- Constants
- Variables
- func GetClientCredentialsFromHTTPRequest(r *http.Request) (cid, cs string)
- func GetTokenFromHeader(r *http.Request) string
- func NewExceptionFromTrailer(md metadata.MD, err error) *exception.APIException
- type GrpcInCtx
- func (c *GrpcInCtx) Context() context.Context
- func (c *GrpcInCtx) GetAccessToKen() string
- func (c *GrpcInCtx) GetClientID() string
- func (c *GrpcInCtx) GetClientSecret() string
- func (c *GrpcInCtx) GetNamespace() string
- func (c *GrpcInCtx) GetRequestID() string
- func (c *GrpcInCtx) SetAccessToKen(token string)
- func (c GrpcInCtx) SetAccessToken(ak string)
- func (c *GrpcInCtx) SetClientCredentials(clientID, clientSecret string)
- func (c GrpcInCtx) SetRemoteIP(ip string)
- func (c GrpcInCtx) SetRequestID(requestID string)
- func (c GrpcInCtx) SetUserAgent(ua string)
- type GrpcOutCtx
Constants ¶
View Source
const ( // NamespaceHeader 空间 NamespaceHeader = "x-rpc-namespace" // InternalCallTokenHeader todo InternalCallTokenHeader = "internal-call-token" // ClientIDHeader tood ClientIDHeader = "client-id" // ClientSecretHeader todo ClientSecretHeader = "client-secret" // OauthTokenHeader todo OauthTokenHeader = "x-oauth-token" // RealIPHeader todo RealIPHeader = "x-real-ip" // UserAgentHeader todo UserAgentHeader = "user-agent" // RequestID todo RequestID = "x-request-id" )
View Source
const ( // ResponseCodeHeader todo ResponseCodeHeader = "x-rpc-code" // ResponseReasonHeader todo ResponseReasonHeader = "x-rpc-reason" // ResponseDescHeader todo ResponseDescHeader = "x-rpc-desc" // ResponseMetaHeader todo ResponseMetaHeader = "x-rpc-meta" // ResponseDataHeader todo ResponseDataHeader = "x-rpc-data" )
Variables ¶
View Source
var (
// Namespace todo
Namespace = "default"
)
Functions ¶
func GetTokenFromHeader ¶
func NewExceptionFromTrailer ¶
func NewExceptionFromTrailer(md metadata.MD, err error) *exception.APIException
NewExceptionFromTrailer todo
Types ¶
type GrpcInCtx ¶
type GrpcInCtx struct {
// contains filtered or unexported fields
}
GrpcInCtx todo
func NewGrpcInCtxFromHTTPRequest ¶
NewGrpcOutCtxFromHTTPRequest 从上下文中获取Token
func (*GrpcInCtx) GetClientSecret ¶
GetClientSecret todo
func (*GrpcInCtx) SetAccessToKen ¶
SetAccessToKen 设置ID
func (*GrpcInCtx) SetClientCredentials ¶
SetClientCredentials todo
type GrpcOutCtx ¶
type GrpcOutCtx struct {
// contains filtered or unexported fields
}
GrpcOutCtx todo
func NewGrpcOutCtxFromHTTPRequest ¶
func NewGrpcOutCtxFromHTTPRequest(r *http.Request) (*GrpcOutCtx, error)
NewGrpcOutCtxFromHTTPRequest 从上下文中获取Token
func NewGrpcOutCtxFromIn ¶
func NewGrpcOutCtxFromIn(in *GrpcInCtx) *GrpcOutCtx
NewGrpcOutCtxFromIn todo
func (GrpcOutCtx) SetAccessToken ¶
func (c GrpcOutCtx) SetAccessToken(ak string)
SetAccessToken todo
func (GrpcOutCtx) SetRequestID ¶
func (c GrpcOutCtx) SetRequestID(requestID string)
SetRequestID 设置ID
Click to show internal directories.
Click to hide internal directories.