normalize

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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 ClientIPFromContext(ctx context.Context) string

func GRPCUnaryServerInterceptor added in v3.3.0

func GRPCUnaryServerInterceptor() grpc.UnaryServerInterceptor

GRPCUnaryServerInterceptor is a unary server interceptor for gRPC

func HTTPMiddleware

func HTTPMiddleware(next http.Handler) http.Handler

func MustLoad

func MustLoad(ctx context.Context, key any) (value any, ok bool)

func MustSetHeader

func MustSetHeader(ctx context.Context, key, value string)

func MustStore

func MustStore(ctx context.Context, key, value any)

func UnaryConnectInterceptor

func UnaryConnectInterceptor[T any](svc T) connect.UnaryInterceptorFunc

func UnaryServerInterceptor deprecated

func UnaryServerInterceptor(defClientKind ClientKind) grpc.UnaryServerInterceptor

Deprecated: use GRPCUnaryServerInterceptor instead

Types

type CallMeta

type CallMeta struct {
	ClientKind ClientKind
	Service    any
	FullMethod string
	Req        any
}

func CallMetaFromContext added in v3.3.0

func CallMetaFromContext(ctx context.Context) (*CallMeta, error)

func MustCallMetaFromContext

func MustCallMetaFromContext(ctx context.Context) *CallMeta

type ClientKind deprecated

type ClientKind string

Deprecated: use ClientKindUndefined instead

const (
	ClientKindPublic    ClientKind = "PUBLIC"
	ClientKindPrivate   ClientKind = "PRIVATE"
	ClientKindUndefined ClientKind = "UNDEFINED"
)

func (ClientKind) IsPrivate

func (k ClientKind) IsPrivate() bool

type HTTPMeta

type HTTPMeta struct {
	ClientKind ClientKind
	R          *http.Request
	W          http.ResponseWriter
}

func HTTPMetaFromContext added in v3.3.0

func HTTPMetaFromContext(ctx context.Context) (*HTTPMeta, error)

func MustHTTPMetaFromContext

func MustHTTPMetaFromContext(ctx context.Context) *HTTPMeta

Jump to

Keyboard shortcuts

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