Documentation
¶
Index ¶
- Constants
- func ClientIPFromContext(ctx context.Context) string
- func HTTPMiddleware(next http.Handler) http.Handler
- func MustLoad(ctx context.Context, key any) (value any, ok bool)
- func MustSetHeader(ctx context.Context, key, value string)
- func MustStore(ctx context.Context, key, value any)
- func UnaryConnectInterceptor[T any](svc T) connect.UnaryInterceptorFunc
- func UnaryServerInterceptor(defClientKind ClientKind) grpc.UnaryServerInterceptor
- type CallMeta
- type ClientKind
- type HTTPMeta
Constants ¶
View Source
const HeaderEnsureClientKind = "x-ensure-client-kind"
HeaderEnsureClientKind is just used for reverse proxy such as grpc-gateway
Variables ¶
This section is empty.
Functions ¶
func ClientIPFromContext ¶
func MustSetHeader ¶
func UnaryConnectInterceptor ¶
func UnaryConnectInterceptor[T any](svc T) connect.UnaryInterceptorFunc
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(defClientKind ClientKind) grpc.UnaryServerInterceptor
Types ¶
type CallMeta ¶
type CallMeta struct {
ClientKind ClientKind
Service any
FullMethod string
Req any
}
func MustCallMetaFromContext ¶
type ClientKind ¶
type ClientKind string
const ( ClientKindPublic ClientKind = "PUBLIC" ClientKindPrivate ClientKind = "PRIVATE" )
func (ClientKind) IsPrivate ¶
func (k ClientKind) IsPrivate() bool
type HTTPMeta ¶
type HTTPMeta struct {
ClientKind ClientKind
R *http.Request
W http.ResponseWriter
}
func MustHTTPMetaFromContext ¶
Click to show internal directories.
Click to hide internal directories.