kmipserver

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOperationNotSupported = Errorf(kmip.ResultReasonOperationNotSupported, "Operation not supported")
	ErrFeatureNotSupported   = Errorf(kmip.ResultReasonFeatureNotSupported, "Feature not supported")
	ErrMissingData           = Errorf(kmip.ResultReasonMissingData, "Missing data")
	ErrItemNotFound          = Errorf(kmip.ResultReasonItemNotFound, "Item not found")
	ErrPermissionDenied      = Errorf(kmip.ResultReasonPermissionDenied, "Permission denied")
	ErrInvalidMessage        = Errorf(kmip.ResultReasonInvalidMessage, "Invalid message")
	ErrInvalidField          = Errorf(kmip.ResultReasonInvalidField, "Invalid field")
)
View Source
var ErrShutdown = errors.New("Server is shutting down")

Functions

func ClearIdPlaceholder

func ClearIdPlaceholder(ctx context.Context)

func Errorf

func Errorf(reason kmip.ResultReason, format string, args ...any) error

func GetIdOrPlaceholder

func GetIdOrPlaceholder(ctx context.Context, reqId string) (string, error)

func GetProtocolVersion

func GetProtocolVersion(ctx context.Context) kmip.ProtocolVersion

func IdPlaceholder

func IdPlaceholder(ctx context.Context) string

func NewHTTPHandler

func NewHTTPHandler(hdl RequestHandler) http.Handler

func PeerCertificates

func PeerCertificates(ctx context.Context) []*x509.Certificate

func RemoteAddr

func RemoteAddr(ctx context.Context) string

func SetIdPlaceholder

func SetIdPlaceholder(ctx context.Context, id string)

Types

type BatchExecutor

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

func NewBatchExecutor

func NewBatchExecutor() *BatchExecutor

func (*BatchExecutor) HandleRequest

func (exec *BatchExecutor) HandleRequest(ctx context.Context, req *kmip.RequestMessage) *kmip.ResponseMessage

func (*BatchExecutor) Route

func (exec *BatchExecutor) Route(op kmip.Operation, hdl OperationHandler)

func (*BatchExecutor) SetSupportedProtocolVersions

func (exec *BatchExecutor) SetSupportedProtocolVersions(versions ...kmip.ProtocolVersion)

func (*BatchExecutor) Use

func (exec *BatchExecutor) Use(m ...Middleware)

type Error

type Error struct {
	Reason  kmip.ResultReason
	Message string
}

func (Error) Error

func (e Error) Error() string

type Middleware

type Middleware func(next Next, ctx context.Context, msg *kmip.RequestMessage) (*kmip.ResponseMessage, error)

func DebugMiddleware

func DebugMiddleware(out io.Writer, marshal func(data any) []byte) Middleware

type Next

type Next func(context.Context, *kmip.RequestMessage) (*kmip.ResponseMessage, error)

type OperationHandler

type OperationHandler interface {
	HandleOperation(ctx context.Context, req kmip.OperationPayload) (kmip.OperationPayload, error)
}

func HandleFunc

func HandleFunc[Req, Resp kmip.OperationPayload](h func(ctx context.Context, req Req) (Resp, error)) OperationHandler

type RequestHandler

type RequestHandler interface {
	HandleRequest(ctx context.Context, req *kmip.RequestMessage) *kmip.ResponseMessage
}

type Server

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

func NewServer

func NewServer(listener net.Listener, handler RequestHandler) *Server

func (*Server) Serve

func (srv *Server) Serve() error

func (*Server) Shutdown

func (srv *Server) Shutdown() error

Jump to

Keyboard shortcuts

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