server

package
v0.0.0-...-2898a4c Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCmTLSStreamServerInterceptor

func GRPCmTLSStreamServerInterceptor(allowUnauthenticatedReads bool) grpc.StreamServerInterceptor

Return a grpc.StreamServerInterceptor that checks for mTLS/client cert authentication, and optionally allows unauthenticated access to readonly RPCs.

func GRPCmTLSUnaryServerInterceptor

func GRPCmTLSUnaryServerInterceptor(allowUnauthenticatedReads bool) grpc.UnaryServerInterceptor

Return a grpc.UnaryServerInterceptor that checks for mTLS/client cert authentication, and optionally allows unauthenticated access to readonly RPCs, and allows all clients access to the health service.

func ListenAndServeGRPC

func ListenAndServeGRPC(
	network string, addr string, opts []grpc.ServerOption,
	validateACDeps bool,
	mangleACKeys bool,
	enableRemoteAssetAPI bool,
	c disk.Cache, a cache.Logger, e cache.Logger) error

ListenAndServeGRPC creates a new gRPC server and listens on the given address. This function either returns an error quickly, or triggers a blocking call to https://godoc.org/google.golang.org/grpc#Server.Serve

Types

type GrpcBasicAuth

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

GrpcBasicAuth wraps an auth.SecretProvider, and provides gRPC interceptors that verify that requests can be authenticated using HTTP basic auth.

func NewGrpcBasicAuth

func NewGrpcBasicAuth(secrets auth.SecretProvider, allowUnauthenticatedReadOnly bool) *GrpcBasicAuth

NewGrpcBasicAuth returns a GrpcBasicAuth that wraps the given auth.SecretProvider.

func (*GrpcBasicAuth) StreamServerInterceptor

func (b *GrpcBasicAuth) StreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

StreamServerInterceptor verifies that each request can be authenticated using HTTP basic auth, or is allowed without authentication.

func (*GrpcBasicAuth) UnaryServerInterceptor

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

UnaryServerInterceptor verifies that each request can be authenticated using HTTP basic auth, or is allowed without authenticated.

type GrpcIdleTimer

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

GrpcIdleTimer wraps an idle.Timer, and provides gRPC interceptors that reset the given idle.Timer at the start of each gRPC request.

func NewGrpcIdleTimer

func NewGrpcIdleTimer(idleTimer *idle.Timer) *GrpcIdleTimer

NewGrpcIdleTimer returns a GrpcIdleTimer that wraps the given idle.Timer.

func (*GrpcIdleTimer) StreamServerInterceptor

func (t *GrpcIdleTimer) StreamServerInterceptor(srv interface{},
	ss grpc.ServerStream, info *grpc.StreamServerInfo,
	handler grpc.StreamHandler) error

StreamServerInterceptor returns a streaming server interceptor that resets the idle.Timer at the start of each gRPC request.

func (*GrpcIdleTimer) UnaryServerInterceptor

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

UnaryServerInterceptor returns a unary server interceptor that resets the idle.Timer at the start of each gRPC request.

type HTTPCache

type HTTPCache interface {
	CacheHandler(w http.ResponseWriter, r *http.Request)
	StatusPageHandler(w http.ResponseWriter, r *http.Request)
}

HTTPCache ...

func NewHTTPCache

func NewHTTPCache(cache disk.Cache, accessLogger cache.Logger, errorLogger cache.Logger, validateAC bool, mangleACKeys bool, checkClientCertForWrites bool, commit string) HTTPCache

NewHTTPCache returns a new instance of the cache. accessLogger will print one line for each HTTP request to stdout. errorLogger will print unexpected server errors. Inexistent files and malformed URLs will not be reported.

Jump to

Keyboard shortcuts

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