gcontext

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: MIT Imports: 7 Imported by: 3

Documentation

Index

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 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 GetGrpcInCtx

func GetGrpcInCtx(ctx context.Context) (*GrpcInCtx, error)

GetGrpcInCtx todo

func NewGrpcInCtx

func NewGrpcInCtx() *GrpcInCtx

NewGrpcInCtx todo

func (*GrpcInCtx) Context

func (c *GrpcInCtx) Context() context.Context

Context todo

func (*GrpcInCtx) GetAccessToKen

func (c *GrpcInCtx) GetAccessToKen() string

GetAccessToKen todo

func (*GrpcInCtx) GetClientID

func (c *GrpcInCtx) GetClientID() string

GetClientID todo

func (*GrpcInCtx) GetClientSecret

func (c *GrpcInCtx) GetClientSecret() string

GetClientSecret todo

func (*GrpcInCtx) GetNamespace added in v0.8.3

func (c *GrpcInCtx) GetNamespace() string

GetNamespace todo

func (*GrpcInCtx) GetRequestID added in v0.8.8

func (c *GrpcInCtx) GetRequestID() string

GetRequestID 获取ID

func (*GrpcInCtx) SetAccessToKen added in v0.9.6

func (c *GrpcInCtx) SetAccessToKen(token string)

SetAccessToKen 设置ID

func (GrpcInCtx) SetAccessToken

func (c GrpcInCtx) SetAccessToken(ak string)

SetAccessToken todo

func (*GrpcInCtx) SetClientCredentials

func (c *GrpcInCtx) SetClientCredentials(clientID, clientSecret string)

SetClientCredentials todo

func (*GrpcInCtx) SetRequestID added in v0.8.8

func (c *GrpcInCtx) SetRequestID(requestID string)

SetRequestID 设置ID

type GrpcOutCtx

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

GrpcOutCtx todo

func NewGrpcOutCtx

func NewGrpcOutCtx() *GrpcOutCtx

NewGrpcOutCtx todo

func NewGrpcOutCtxFromHTTPRequest

func NewGrpcOutCtxFromHTTPRequest(r *http.Request) (*GrpcOutCtx, error)

NewGrpcOutCtxFromHTTPRequest 从上下文中获取Token

func NewGrpcOutCtxFromIn added in v0.8.4

func NewGrpcOutCtxFromIn(in *GrpcInCtx) *GrpcOutCtx

NewGrpcOutCtxFromIn todo

func (*GrpcOutCtx) Context

func (c *GrpcOutCtx) Context() context.Context

Context todo

func (GrpcOutCtx) SetAccessToken

func (c GrpcOutCtx) SetAccessToken(ak string)

SetAccessToken todo

func (*GrpcOutCtx) SetNamesapce added in v0.8.3

func (c *GrpcOutCtx) SetNamesapce(ns string)

SetNamesapce todo

func (*GrpcOutCtx) SetRemoteIP

func (c *GrpcOutCtx) SetRemoteIP(ip string)

SetRemoteIP todo

func (*GrpcOutCtx) SetUserAgent

func (c *GrpcOutCtx) SetUserAgent(ua string)

SetUserAgent todo

Jump to

Keyboard shortcuts

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