Documentation ¶
Index ¶
- func ClientIP(ctx context.Context) string
- func ClientIPFromGRPC(ctx context.Context) (clientIP string)
- func ClientIPFromHTTP(ctx context.Context, r *http.Request) (clientIP string)
- func FromClientContext(ctx context.Context) (tr transport.Transporter, ok bool)
- func FromServerContext(ctx context.Context) (tr transport.Transporter, ok bool)
- func GetClientIpFromContext(ctx context.Context) (clientIp string, ok bool)
- func MatchGRPCClientContext(ctx context.Context) (tr *grpc.Transport, ok bool)
- func MatchGRPCServerContext(ctx context.Context) (tr *grpc.Transport, ok bool)
- func MatchHTTPClientContext(ctx context.Context) (tr http.Transporter, ok bool)
- func MatchHTTPContext(ctx context.Context) (http.Context, bool)
- func MatchHTTPServerContext(ctx context.Context) (tr http.Transporter, ok bool)
- func SetClientIpToContext(ctx context.Context, clientIp string) context.Context
- func SetTrustedPlatform(platformHeader string)
- func ToGRPCTransporter(kratosTr transport.Transporter) (grpcTr *grpc.Transport, ok bool)
- func ToHTTPTransporter(kratosTr transport.Transporter) (httpTr http.Transporter, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientIPFromGRPC ¶
ClientIPFromGRPC ...
func ClientIPFromHTTP ¶
ClientIPFromHTTP ...
func FromClientContext ¶
func FromClientContext(ctx context.Context) (tr transport.Transporter, ok bool)
FromClientContext 等于 transport.FromClientContext
func FromServerContext ¶
func FromServerContext(ctx context.Context) (tr transport.Transporter, ok bool)
FromServerContext 等于 transport.FromServerContext
func GetClientIpFromContext ¶
GetClientIpFromContext extract client ip from context
func MatchGRPCClientContext ¶
MatchGRPCClientContext ...
func MatchGRPCServerContext ¶
MatchGRPCServerContext ...
func MatchHTTPClientContext ¶
func MatchHTTPClientContext(ctx context.Context) (tr http.Transporter, ok bool)
MatchHTTPClientContext ...
func MatchHTTPContext ¶
MatchHTTPContext 匹配 Deprecated: 不建议使用此方法 建议使用: contextpkg.MatchHTTPServerContext or contextpkg.MatchGRPCServerContext
func MatchHTTPServerContext ¶
func MatchHTTPServerContext(ctx context.Context) (tr http.Transporter, ok bool)
MatchHTTPServerContext ...
func SetClientIpToContext ¶
SetClientIpToContext put client ip into context
func ToGRPCTransporter ¶
func ToGRPCTransporter(kratosTr transport.Transporter) (grpcTr *grpc.Transport, ok bool)
ToGRPCTransporter ...
func ToHTTPTransporter ¶
func ToHTTPTransporter(kratosTr transport.Transporter) (httpTr http.Transporter, ok bool)
ToHTTPTransporter ...
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.