server

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHKPEndpoints

func AddHKPEndpoints(log slog.Instance, dbHandler DatabaseHandler, r *mux.Router)

AddHKPEndpoints attach the HKP /lookup and /add endpoints to the specified router with the specified log wrapped into the calls

func CatchAllError

func CatchAllError(data interface{}, w http.ResponseWriter, r *http.Request, logI slog.Instance)

CatchAllError helper method to return an internal server error error to http client in case of non expected errors

func CatchAllRouter

func CatchAllRouter(w http.ResponseWriter, r *http.Request, logI slog.Instance)

CatchAllRouter helper method to return an not found error error to http client in case of non expected endpoints

func GenRemoteSignerServerMux

func GenRemoteSignerServerMux(slog slog.Instance, sm interfaces.SecretsManager, gpg interfaces.PGPManager, dbh DatabaseHandler) *mux.Router

GenRemoteSignerServerMux generates a remote signer HTTP Router

func InitHTTPTimer

func InitHTTPTimer(log slog.Instance, r *http.Request)

InitHTTPTimer initializes the HTTP Request timer and prints a log line representing a received HTTP Request

func InternalServerError

func InternalServerError(message string, data interface{}, w http.ResponseWriter, r *http.Request, logI slog.Instance)

InternalServerError helper method to return an internal server error to http client

func InvalidFieldData

func InvalidFieldData(field string, message string, w http.ResponseWriter, r *http.Request, logI slog.Instance)

InvalidFieldData helper method to return an invalid field data error to http client

func LogExit

func LogExit(slog slog.Instance, r *http.Request, statusCode int, bodyLength int)

LogExit does the logging of the exit call inside a HTTP Request

func LoggingMiddleware added in v1.5.0

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware is a HTTP middleware that logs the entry and exit requests

func NotFound

func NotFound(field string, message string, w http.ResponseWriter, r *http.Request, logI slog.Instance)

NotFound helper method to return an not found error to http client

func NotImplemented

func NotImplemented(w http.ResponseWriter, r *http.Request, logI slog.Instance)

NotImplemented helper method to return an not implemented error to http client

func PermissionDenied

func PermissionDenied(field string, message string, w http.ResponseWriter, r *http.Request, logI slog.Instance)

PermissionDenied helper method to return an permission denied error to http client

func RunRemoteSignerServer

func RunRemoteSignerServer(slog slog.Instance, sm interfaces.SecretsManager, gpg interfaces.PGPManager, dbh DatabaseHandler) chan bool

RunRemoteSignerServer runs a remote signer server asynchronously and returns a stop channel

func RunRemoteSignerServerSingleKey

func RunRemoteSignerServerSingleKey(slog slog.Instance, sm interfaces.SecretsManager, gpg interfaces.PGPManager, dbh DatabaseHandler) (chan bool, error)

RunRemoteSignerServerSingleKey runs a single key instance of remote signer server asynchronously and returns a stop channel

func UnmarshalBodyOrDie

func UnmarshalBodyOrDie(outData interface{}, w http.ResponseWriter, r *http.Request, logI slog.Instance) bool

UnmarshalBodyOrDie tries to unmarshal the request body into the specified interface and returns InvalidFieldData to the client if something is wrong

func WriteJSON

func WriteJSON(data interface{}, statusCode int, w http.ResponseWriter, r *http.Request, logI slog.Instance)

WriteJSON returns a JSON Object to the specified http.ResponseWriter

Types

type AgentAdmin

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

func MakeAgentAdmin

MakeAgentAdmin creates an instance of Agent Administration endpoint

func (*AgentAdmin) AddHandlers

func (admin *AgentAdmin) AddHandlers(r *mux.Router)

type AgentProxy

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

func MakeAgentProxy

func MakeAgentProxy(log slog.Instance, gpg interfaces.PGPManager, tm interfaces.TokenManager) *AgentProxy

MakeAgentProxy creates an instance of agent proxy endpoint

func (*AgentProxy) AddHandlers

func (proxy *AgentProxy) AddHandlers(r *mux.Router)

type DatabaseHandler added in v1.4.0

type DatabaseHandler agent.DatabaseHandler

type GPGEndpoint

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

func MakeGPGEndpoint

MakeGPGEndpoint Creates an instance of an endpoint that handles GPG Calls

func (*GPGEndpoint) AttachHandlers

func (ge *GPGEndpoint) AttachHandlers(r *mux.Router)

type HTTPHandleFunc

type HTTPHandleFunc = func(w http.ResponseWriter, r *http.Request)

HTTPHandleFunc is a type for a HTTP Handler Function

type HTTPHandleFuncWithLog

type HTTPHandleFuncWithLog = func(log slog.Instance, w http.ResponseWriter, r *http.Request)

HTTPHandleFuncWithLog is a type for a HTTP Handler Function with an slog instance argument

type HealthCheckHandler added in v1.4.0

type HealthCheckHandler interface {
	HealthCheck() error
}

type InternalEndpoint

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

func MakeInternalEndpoint

func MakeInternalEndpoint(log slog.Instance, sm interfaces.SecretsManager, gpg interfaces.PGPManager) *InternalEndpoint

MakeInternalEndpoint creates an instance to handle internal control endpoints such as key password data

func (*InternalEndpoint) AttachHandlers

func (ie *InternalEndpoint) AttachHandlers(r *mux.Router)

type JFCEndpoint

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

func MakeJFCEndpoint

MakeJFCEndpoint creates a handler for Json Field Cipher Endpoints

func (*JFCEndpoint) AttachHandlers

func (jfc *JFCEndpoint) AttachHandlers(r *mux.Router)

type KeyRingEndpoint

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

func MakeKeyRingEndpoint

func MakeKeyRingEndpoint(log slog.Instance, sm interfaces.SecretsManager, gpg interfaces.PGPManager, dbHandler DatabaseHandler) *KeyRingEndpoint

MakeKeyRingEndpoint creates an instance of key ring management endpoints

func (*KeyRingEndpoint) AttachHandlers

func (kre *KeyRingEndpoint) AttachHandlers(r *mux.Router)

type ResponseWriter added in v1.5.0

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriter is a http.ResponseWriter wrapper that provides the status code and content length info.

func (*ResponseWriter) Write added in v1.5.0

func (rw *ResponseWriter) Write(b []byte) (int, error)

Write implements the http.ResponseWriter.Write function. It makes enable to store the response content length.

func (*ResponseWriter) WriteHeader added in v1.5.0

func (rw *ResponseWriter) WriteHeader(code int)

WriteHeader implements the http.ResponseWriter.WriteHeader function. It makes enable to store the response status code.

type SKSEndpoint

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

func MakeSKSEndpoint

func MakeSKSEndpoint(log slog.Instance, sm interfaces.SecretsManager, gpg interfaces.PGPManager, dbHandler DatabaseHandler) *SKSEndpoint

MakeSKSEndpoint creates a handler for SKS Server Endpoint

func (*SKSEndpoint) AttachHandlers

func (sks *SKSEndpoint) AttachHandlers(r *mux.Router)

type StaticGraphiQL

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

func MakeStaticGraphiQL

func MakeStaticGraphiQL(log slog.Instance) *StaticGraphiQL

func (*StaticGraphiQL) AttachHandlers

func (gql *StaticGraphiQL) AttachHandlers(r *mux.Router)

type TestsEndpoint

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

func MakeTestsEndpoint

func MakeTestsEndpoint(log slog.Instance, vm *vaultManager.VaultManager, dbHandler HealthCheckHandler) *TestsEndpoint

MakeTestsEndpoint creates an instance of healthcheck tests endpoint

func (*TestsEndpoint) AttachHandlers

func (ge *TestsEndpoint) AttachHandlers(r *mux.Router)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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