cloudserver

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package cloudserver provides primitives for gRPC and HTTP servers.

Index

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

type HTTPMiddleware = func(http.Handler) http.Handler

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) 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.

Jump to

Keyboard shortcuts

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