server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HealthzPath = "/healthz"
	HealthzPort = 10004
)
View Source
const EnvoyXRequestID = "x-request-id"

EnvoyXRequestID is the header name for the request id

Variables

This section is empty.

Functions

func NewHealthServer

func NewHealthServer(config *configv1.Config) run.Unit

NewHealthServer creates a new health server.

func PropagateRequestID

func PropagateRequestID(
	ctx context.Context,
	req interface{},
	_ *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (interface{}, error)

PropagateRequestID is a gRPC middleware that propagates the request id from an Envoy CheckRequest to the logging context.

Types

type ExtAuthZFilter

type ExtAuthZFilter struct {
	// contains filtered or unexported fields
}

ExtAuthZFilter is an implementation of the Envoy AuthZ filter.

func NewExtAuthZFilter

func NewExtAuthZFilter(cfg *configv1.Config, tlsPool internal.TLSConfigPool, jwks oidc.JWKSProvider, sessions oidc.SessionStoreFactory) *ExtAuthZFilter

NewExtAuthZFilter creates a new ExtAuthZFilter.

func (*ExtAuthZFilter) Check

func (e *ExtAuthZFilter) Check(ctx context.Context, req *envoy.CheckRequest) (response *envoy.CheckResponse, err error)

Check is the implementation of the Envoy AuthorizationServer interface.

func (*ExtAuthZFilter) Register

func (e *ExtAuthZFilter) Register(server *grpc.Server)

Register the ExtAuthZFilter with the given gRPC server.

type LogMiddleware

type LogMiddleware struct {
	// contains filtered or unexported fields
}

LogMiddleware is a gRPC middleware that logs all the requests and responses.

func NewLogMiddleware

func NewLogMiddleware() LogMiddleware

NewLogMiddleware creates a new LogMiddleware that logs all gRPC requests and responses.

func (LogMiddleware) UnaryServerInterceptor

func (l LogMiddleware) UnaryServerInterceptor(
	ctx context.Context,
	req interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (interface{}, error)

UnaryServerInterceptor is a grpc.UnaryServerInterceptor that logs all the server requests and responses.

type RegisterGrpc

type RegisterGrpc interface {
	// Register a gRPC handler in the given server.
	Register(s *grpc.Server)
}

RegisterGrpc is an interface for registering gRPC registerHandlers.

type Server

type Server struct {

	// Listen allows overriding the default listener. It is meant to
	// be used in tests.
	Listen func() (net.Listener, error)
	// contains filtered or unexported fields
}

Server that runs as a unit in a run.Group.

func New

func New(cfg *configv1.Config, registerHandlers ...func(s *grpc.Server)) *Server

New creates a new dual gRPC server.

func (*Server) GracefulStop

func (s *Server) GracefulStop()

GracefulStop stops the server.

func (*Server) Name

func (s *Server) Name() string

Name returns the name of the unit in the run.Group.

func (*Server) PreRun

func (s *Server) PreRun() error

PreRun registers the server registerHandlers

func (*Server) Serve

func (s *Server) Serve() error

Serve starts the gRPC server.

Jump to

Keyboard shortcuts

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