Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServeGRPC

func ListenAndServeGRPC(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) *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 returns a streaming server interceptor that verifies that each request can be authenticated using HTTP basic auth.

func (*GrpcBasicAuth) UnaryServerInterceptor

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

UnaryServerInterceptor returns a unary server interceptor that verifies that each request can be authenticated using HTTP basic auth.

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