kitexutil

package
v0.11.3-genericstreaming Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package kitexutil provides some util methods to get RPC information

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCallee added in v0.11.0

func GetCallee(ctx context.Context) (string, bool)

GetCallee is used to get the Service Name of the callee. Return false if failed to get the information.

func GetCaller

func GetCaller(ctx context.Context) (string, bool)

GetCaller is used to get the Service Name of the caller. Return false if failed to get the information.

func GetCallerAddr

func GetCallerAddr(ctx context.Context) (net.Addr, bool)

GetCallerAddr is used for the server to get the Address of the caller. Return false if failed to get the information.

func GetCallerHandlerMethod

func GetCallerHandlerMethod(ctx context.Context) (string, bool)

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

func GetCallerIP(ctx context.Context) (string, bool)

GetCallerIP is used for the server to get the IP of the caller. Return false if failed to get the information.

func GetIDLServiceName

func GetIDLServiceName(ctx context.Context) (string, bool)

GetIDLServiceName gets the serviceName which defined in IDL. Return false if failed to get the information.

func GetMethod

func GetMethod(ctx context.Context) (string, bool)

GetMethod is used to get the current RPC Method name. Return false if failed to get the information.

func GetRPCInfo

func GetRPCInfo(ctx context.Context) (rpcinfo.RPCInfo, bool)

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.

func GetTransportProtocol

func GetTransportProtocol(ctx context.Context) (string, bool)

GetTransportProtocol gets the transport protocol of the request. Return false if failed to get the information.

Types

This section is empty.

Jump to

Keyboard shortcuts

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