server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GRPCPort     = flag.Int("grpc_port", 2020, "Port of a gRPC listener.")
	GatewayPort  = flag.Int("grpc_gateway_port", 8080, "Port of a gRPC gateway instance.")
	HTTPPort     = flag.Int("http_port", 8888, "Port of a HTTP listener.")
	ShutdownWait = flag.Duration("shutdown_wait", 15*time.Second, "How long to wait for server connections to drain.")
	CORSAllowAll = flag.Bool("cors_allow_all", true, "Set CORS headers to allow all requests?")
	SlowReplies  = flag.Bool("slow_replies", false, "Make all requests take an extra second.")
	StaticDir    = flag.String("static_dir", "./frontend/build", "Directory to serve static files from.")
)

Functions

func ServerValidationUnaryInterceptor

func ServerValidationUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

ServerValidationUnaryInterceptor returns a new unary server interceptor that validates incoming requests.

Types

type ApoxyServer

type ApoxyServer struct {
	Mux     *http.ServeMux
	Srv     *http.Server
	Context context.Context

	GRPC *grpc.Server

	Gateway *runtime.ServeMux
	GwSrv   *http.Server
	// contains filtered or unexported fields
}

func NewApoxyServer

func NewApoxyServer(opts ...ServerOption) *ApoxyServer

NewApoxyServer returns a new gRPC server.

func (*ApoxyServer) Run

func (s *ApoxyServer) Run()

func (*ApoxyServer) Shutdown

func (s *ApoxyServer) Shutdown()

type GatewayHandlerFn

type GatewayHandlerFn func(context.Context, *runtime.ServeMux, string, []grpc.DialOption) error

type ServerOption

type ServerOption func(*serverOptions)

ServerOption sets Apoxy server options.

func WithHandlers

func WithHandlers(handlers ...GatewayHandlerFn) ServerOption

WithHandlers appends handlers to the list of gRPC handlers of the server.

func WithPassedHeader

func WithPassedHeader(key string) ServerOption

WithPassedHeader enables passing of HTTP header to the corresponding gRPC handler via context. The header will be prefixed with grpcserver-.

type Validator

type Validator interface {
	Validate() error
}

Validator contains methods generated by the validator plugin.

Jump to

Keyboard shortcuts

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