normalize

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 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 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

func UnaryServerInterceptor(defClientKind ClientKind) grpc.UnaryServerInterceptor

Types

type CallMeta

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

func MustCallMetaFromContext

func MustCallMetaFromContext(ctx context.Context) *CallMeta

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

func MustHTTPMetaFromContext(ctx context.Context) *HTTPMeta

Jump to

Keyboard shortcuts

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