Documentation ¶
Overview ¶
Package rkgrpcmid provides common utility functions for middleware of grpc framework
Index ¶
- Variables
- func AddToServerContextPayload(ctx context.Context, key interface{}, value interface{})
- func ContainsServerPayload(ctx context.Context) bool
- func GetGrpcInfo(fullMethod string) (grpcService, grpcMethod string)
- func GetGwInfo(md metadata.MD) (gwMethod, gwPath, gwScheme, gwUserAgent string)
- func GetRemoteAddressSet(ctx context.Context) (ip, port, netType string)
- func GetRemoteAddressSetFromMeta(md metadata.MD) (ip, port string)
- func GetServerContextPayload(ctx context.Context) map[interface{}]interface{}
- func GetServerPayloadKey() interface{}
- func MergeAndDeduplicateSlice(src []string, target []string) []string
- func MergeToOutgoingMD(ctx context.Context, md metadata.MD) context.Context
- func ToOptionsKey(entryName, rpcType string) string
- func WrapContextForServer(ctx context.Context) context.Context
Constants ¶
This section is empty.
Variables ¶
var ( LocalIp = zap.String("localIp", rkmid.LocalIp.String) // LocalHostname read hostname from localhost LocalHostname = zap.String("localHostname", rkmid.LocalHostname.String) )
var RpcPayloadAppended = rpcPayloadAppended{}
RpcPayloadAppended a flag used in inner middleware
Functions ¶
func AddToServerContextPayload ¶
AddToServerContextPayload add k/v into payload injected into server side context
func ContainsServerPayload ¶
ContainsServerPayload is payload injected into server side context?
func GetGrpcInfo ¶
GetGrpcInfo Extract grpc related information from fullMethod.
func GetRemoteAddressSet ¶
GetRemoteAddressSet Read remote Ip and port from metadata first.
func GetRemoteAddressSetFromMeta ¶
GetRemoteAddressSetFromMeta Read remote Ip and port from metadata. If user enabled RK style gateway server mux option, then there would be bellow headers forwarded to grpc metadata 1: x-forwarded-method 2: x-forwarded-path 3: x-forwarded-scheme 4: x-forwarded-user-agent 5: x-forwarded-remote-addr
func GetServerContextPayload ¶
GetServerContextPayload get context payload injected into server side context
func GetServerPayloadKey ¶
func GetServerPayloadKey() interface{}
GetServerPayloadKey get server payload key used in context.Context
func MergeAndDeduplicateSlice ¶
MergeAndDeduplicateSlice Merge src and targets and deduplicate
func MergeToOutgoingMD ¶
MergeToOutgoingMD Merge md to context outgoing metadata.
func ToOptionsKey ¶
ToOptionsKey Convert to optionsMap key with entry name and rpcType.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package rkgrpcauth is auth interceptor for grpc framework
|
Package rkgrpcauth is auth interceptor for grpc framework |
Package rkgrpcctx provides utility functions deal with metadata in RPC context
|
Package rkgrpcctx provides utility functions deal with metadata in RPC context |
Package rkgrpccsrf is a CSRF interceptor for grpc framework
|
Package rkgrpccsrf is a CSRF interceptor for grpc framework |