Documentation ¶
Overview ¶
Package cloudserver provides primitives for gRPC and HTTP servers.
Index ¶
- func ChainHTTPMiddleware(next http.Handler, middlewares ...HTTPMiddleware) http.Handler
- type Config
- type HTTPMiddleware
- type Middleware
- func (i *Middleware) GRPCStreamServerInterceptor(srv interface{}, ss grpc.ServerStream, _ *grpc.StreamServerInfo, ...) (err error)
- func (i *Middleware) GRPCUnaryServerInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func (i *Middleware) HTTPServer(next http.Handler) http.Handler
- type SecurityHeadersMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChainHTTPMiddleware ¶
func ChainHTTPMiddleware(next http.Handler, middlewares ...HTTPMiddleware) http.Handler
ChainHTTPMiddleware chains the HTTP handler middleware to execute from left to right.
Types ¶
type Config ¶
type Config struct { // Timeout of all requests to the servers. // Defaults to 10 seconds below the default Cloud Run timeout for managed services. Timeout time.Duration `default:"290s"` }
Config provides config for gRPC and HTTP servers.
type HTTPMiddleware ¶
HTTPMiddleware is a HTTP middleware.
type Middleware ¶
type Middleware struct { // Config for the middleware. Config Config }
Middleware provides standard middleware for gRPC and HTTP servers.
func (*Middleware) GRPCStreamServerInterceptor ¶ added in v0.41.0
func (i *Middleware) GRPCStreamServerInterceptor( srv interface{}, ss grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler, ) (err error)
GRPCStreamServerInterceptor implements grpc.StreamServerInterceptor.
func (*Middleware) GRPCUnaryServerInterceptor ¶
func (i *Middleware) GRPCUnaryServerInterceptor( ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (resp interface{}, err error)
GRPCUnaryServerInterceptor implements grpc.UnaryServerInterceptor.
func (*Middleware) HTTPServer ¶
func (i *Middleware) HTTPServer(next http.Handler) http.Handler
HTTPServer provides HTTP server middleware.
type SecurityHeadersMiddleware ¶ added in v0.42.0
type SecurityHeadersMiddleware struct{}
SecurityHeadersMiddleware adds security headers to responses.
func (*SecurityHeadersMiddleware) HTTPServer ¶ added in v0.42.0
func (i *SecurityHeadersMiddleware) HTTPServer(next http.Handler) http.Handler
HTTPServer provides HTTP server middleware.
Click to show internal directories.
Click to hide internal directories.