Documentation ¶
Index ¶
- Constants
- Variables
- func ClientAddr(ctx context.Context) string
- func ClientIp(ctx context.Context) string
- func RpcWithClientAddr(ctx context.Context, addr string) context.Context
- func RpcWithClientIp(ctx context.Context, ip string) context.Context
- func RpcWithSessId(ctx context.Context, sessId string) context.Context
- func RpcWithUid(ctx context.Context, uid uint64) context.Context
- func SessId(ctx context.Context) string
- func Uid(ctx context.Context) uint64
- func WithClientAddr(ctx context.Context, addr string) context.Context
- func WithClientIp(ctx context.Context, ip string) context.Context
- func WithSessId(ctx context.Context, sessId string) context.Context
- func WithUid(ctx context.Context, uid uint64) context.Context
- type ClientAddrInOut
- type ClientIpInOut
- type GrpcMdHolder
- type MdExtractor
- type MdInjector
- type UidMdInOut
Constants ¶
View Source
const ( CtxUidKey = "CtxUidKey" CtxSessIdKey = "CtxSessIdKey" CtxClientAddrKey = "CtxClientAddrKey" CtxClientIpKey = "CtxClientIpKey" )
Variables ¶
View Source
var ( RpcMdHolders = []GrpcMdHolder{ UidMdInOut{}, ClientIpInOut{}, ClientAddrInOut{}, } )
Functions ¶
func ClientAddr ¶
Types ¶
type ClientAddrInOut ¶
type ClientAddrInOut struct{}
func (ClientAddrInOut) Extract ¶
func (ij ClientAddrInOut) Extract(ctx context.Context, md grpcmetadata.MD) context.Context
type ClientIpInOut ¶
type ClientIpInOut struct{}
func (ClientIpInOut) Extract ¶
func (ij ClientIpInOut) Extract(ctx context.Context, md grpcmetadata.MD) context.Context
type GrpcMdHolder ¶
type GrpcMdHolder interface { MdInjector MdExtractor }
type MdExtractor ¶
type MdInjector ¶
type UidMdInOut ¶
type UidMdInOut struct{}
func (UidMdInOut) Extract ¶
func (ij UidMdInOut) Extract(ctx context.Context, md grpcmetadata.MD) context.Context
Click to show internal directories.
Click to hide internal directories.