gcontext

package
v1.5.0 Latest Latest
Warning

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

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

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 GetClientCredentialsFromHTTPRequest

func GetClientCredentialsFromHTTPRequest(r *http.Request) (cid, cs string)

func GetTokenFromHeader

func GetTokenFromHeader(r *http.Request) string

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 NewGrpcInCtxFromHTTPRequest

func NewGrpcInCtxFromHTTPRequest(r *http.Request) (*GrpcInCtx, error)

NewGrpcOutCtxFromHTTPRequest 从上下文中获取Token

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

func (c *GrpcInCtx) GetNamespace() string

GetNamespace todo

func (*GrpcInCtx) GetRequestID

func (c *GrpcInCtx) GetRequestID() string

GetRequestID 获取ID

func (*GrpcInCtx) SetAccessToKen

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) SetRemoteIP

func (c GrpcInCtx) SetRemoteIP(ip string)

SetRemoteIP todo

func (GrpcInCtx) SetRequestID

func (c GrpcInCtx) SetRequestID(requestID string)

SetRequestID 设置ID

func (GrpcInCtx) SetUserAgent

func (c GrpcInCtx) SetUserAgent(ua string)

SetUserAgent todo

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

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

func (c *GrpcOutCtx) SetNamesapce(ns string)

SetNamesapce todo

func (GrpcOutCtx) SetRemoteIP

func (c GrpcOutCtx) SetRemoteIP(ip string)

SetRemoteIP todo

func (GrpcOutCtx) SetRequestID

func (c GrpcOutCtx) SetRequestID(requestID string)

SetRequestID 设置ID

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