Documentation ¶
Overview ¶
Package kitexutil provides some util methods to get RPC information
Index ¶
- func GetCaller(ctx context.Context) (string, bool)
- func GetCallerAddr(ctx context.Context) (net.Addr, bool)
- func GetCallerHandlerMethod(ctx context.Context) (string, bool)
- func GetCallerIP(ctx context.Context) (string, bool)
- func GetIDLServiceName(ctx context.Context) (string, bool)
- func GetMethod(ctx context.Context) (string, bool)
- func GetRPCInfo(ctx context.Context) (rpcinfo.RPCInfo, bool)
- func GetRealReqFromKitexArgs(req interface{}) interface{}
- func GetRealRespFromKitexResult(resp interface{}) interface{}
- func GetTransportProtocol(ctx context.Context) (string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCaller ¶
GetCaller is used to get the Service Name of the caller. Return false if failed to get the information.
func GetCallerAddr ¶
GetCallerAddr is used for the server to get the Address of the caller. Return false if failed to get the information.
func GetCallerHandlerMethod ¶
GetCallerHandlerMethod is used to get the method name of caller. Only the caller is a Kitex server will have this method information by default, or you can set K_METHOD into context.Context then kitex will get it. Return false if failed to get the information.
func GetCallerIP ¶ added in v0.9.0
GetCallerIP is used for the server to get the IP of the caller. Return false if failed to get the information.
func GetIDLServiceName ¶
GetIDLServiceName gets the serviceName which defined in IDL. Return false if failed to get the information.
func GetMethod ¶
GetMethod is used to get the current RPC Method name. Return false if failed to get the information.
func GetRPCInfo ¶
GetRPCInfo gets the RPCInfo in ctx. Return false if failed to get the information.
func GetRealReqFromKitexArgs ¶ added in v0.9.0
func GetRealReqFromKitexArgs(req interface{}) interface{}
GetRealReqFromKitexArgs assert the req to be KitexArgs and return the real request if succeeded, otherwise return nil. This method should be used in the middleware.
func GetRealRespFromKitexResult ¶ added in v0.9.0
func GetRealRespFromKitexResult(resp interface{}) interface{}
GetRealRespFromKitexResult assert the req to be KitexResult and return the real response if succeeded, otherwise return nil. This method should be used in the middleware.
Types ¶
This section is empty.