Documentation
¶
Overview ¶
Package core is a generated GoMock package.
Package core is a generated GoMock package.
Index ¶
- Constants
- Variables
- func BuildInfo() string
- func ClientConfigFlags() *pflag.FlagSet
- func CreateHTTPErrorHandler() echo.HTTPErrorHandler
- func Error(statusCode int, errStr string, args ...interface{}) error
- func FlagSet() *pflag.FlagSet
- func GetHTTPStatusCode(err error, ctx echo.Context) int
- func InvalidInputError(errStr string, args ...interface{}) error
- func JoinURLPaths(parts ...string) string
- func NewCertPool(certificates []*x509.Certificate) *x509.CertPool
- func NotFoundError(errStr string, args ...interface{}) error
- func OSArch() string
- func ParseCertificates(data []byte) (certificates []*x509.Certificate, _ error)
- func ParsePublicURL(input string, strictmode bool) (*url.URL, error)
- func ParsePublicURLWithScheme(input string, allowReserved bool, allowedSchemes ...string) (*url.URL, error)
- func PreconditionFailedError(errStr string, args ...interface{}) error
- func ResolveStatusCode(err error, mapping map[error]int) int
- func TestResponseCode(expectedStatusCode int, response *http.Response) error
- func TestResponseCodeWithLog(expectedStatusCode int, response *http.Response, log *logrus.Entry) error
- func TruncateHTTPBody(body []byte) string
- func UserAgent() string
- func UserAgentRequestEditor(_ context.Context, req *http.Request) error
- func Version() string
- type AuthorizationTokenGenerator
- type ClientConfig
- type Configurable
- type Diagnosable
- type DiagnosticResult
- type DiagnosticResultMap
- type EchoRouter
- type Engine
- type ErrorStatusCodeResolver
- type ErrorWriter
- type GenericDiagnosticResult
- type HTTPClientConfig
- type HTTPConfig
- type HTTPRequestDoer
- type HTTPStatusCodeError
- type Health
- type HealthCheckable
- type HealthStatus
- type HttpError
- type Injectable
- type LandingPage
- type Migratable
- type MockConfigurable
- type MockConfigurableMockRecorder
- type MockDiagnosable
- type MockDiagnosableMockRecorder
- type MockEchoRouter
- func (m *MockEchoRouter) Add(method, path string, handler echo.HandlerFunc, ...) *echo.Route
- func (m_2 *MockEchoRouter) CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoRouter) DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m *MockEchoRouter) EXPECT() *MockEchoRouterMockRecorder
- func (m_2 *MockEchoRouter) GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoRouter) HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoRouter) OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoRouter) PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoRouter) POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoRouter) PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoRouter) TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m *MockEchoRouter) Use(middleware ...echo.MiddlewareFunc)
- type MockEchoRouterMockRecorder
- func (mr *MockEchoRouterMockRecorder) Add(method, path, handler any, middleware ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) CONNECT(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) DELETE(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) GET(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) HEAD(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) OPTIONS(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) PATCH(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) POST(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) PUT(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) TRACE(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoRouterMockRecorder) Use(middleware ...any) *gomock.Call
- type MockEngine
- type MockEngineMockRecorder
- type MockHealthCheckable
- type MockHealthCheckableMockRecorder
- type MockInjectable
- type MockInjectableMockRecorder
- type MockMigratable
- type MockMigratableMockRecorder
- type MockNamed
- type MockNamedMockRecorder
- type MockRoutable
- type MockRoutableMockRecorder
- type MockRunnable
- type MockRunnableMockRecorder
- type MockViewableDiagnostics
- type MockViewableDiagnosticsMockRecorder
- type Named
- type Period
- type RFC3339Time
- type Routable
- type Runnable
- type ServerConfig
- type System
- func (system *System) Configure() error
- func (system *System) FindEngineByName(target string) Engine
- func (system *System) Load(flags *pflag.FlagSet) error
- func (system *System) Migrate() error
- func (system *System) RegisterEngine(engine Engine)
- func (system *System) RegisterRoutes(router Routable)
- func (system *System) Shutdown() error
- func (system *System) Start() error
- func (system *System) VisitEngines(visitor func(engine Engine))
- func (system *System) VisitEnginesE(visitor func(engine Engine) error) error
- type TLSConfig
- type TLSOffloadingMode
- type TestEngine
- type TestEngineConfig
- type TestEngineSubConfig
- type TrustStore
- type ViewableDiagnostics
Constants ¶
const ( // LogFieldModule is the log field for the module name. LogFieldModule = "module" // LogFieldEventType is the log field key for event types from the events module. LogFieldEventType = "eventType" // LogFieldEventSubject is the log field key for event subjects from the events module. LogFieldEventSubject = "eventSubject" // LogFieldEventSubscriber is the log field key for event subscribers from the events module. LogFieldEventSubscriber = "eventSubscriber" // LogFieldCredentialID is the log field key for the ID of a Verifiable Credential from the VCR module. LogFieldCredentialID = "credentialID" // LogFieldCredentialType is the log field key for the type of a Verifiable Credential from the VCR module. LogFieldCredentialType = "credentialType" // LogFieldCredentialIssuer is the log field key for the issuer of a Verifiable Credential from the VCR module. LogFieldCredentialIssuer = "credentialIssuer" // LogFieldCredentialSubject is the log field key for the subject of a Verifiable Credential from the VCR module. LogFieldCredentialSubject = "credentialSubject" // LogFieldStore is the log field key for the name of a store managed by the storage module. LogFieldStore = "store" // LogFieldStoreShelf is the log field key for the name of a shelf, in a store managed by the storage module. LogFieldStoreShelf = "storeShelf" // LogFieldKeyID is the log field key for the unique ID of a key from the VDR or crypto module. LogFieldKeyID = "keyID" // LogFieldDID is the log field key for the ID of a DID document from the VDR module. LogFieldDID = "did" // LogFieldDIDSubject is the log field key for the DID subject. LogFieldDIDSubject = "didSubject" // LogFieldServiceID is the log field key for the ID of a DID document service from the VDR module. LogFieldServiceID = "serviceID" // LogFieldServiceType is the log field key for the type of a DID document service from the VDR module. LogFieldServiceType = "serviceType" // LogFieldServiceEndpoint is the log field key of the ID of the endpoint of a DID document service from the VDR module. LogFieldServiceEndpoint = "serviceEndpoint" // LogFieldAuthorizerDID is the log field key for the DID of the authorizer when creating an access token in the auth module. LogFieldAuthorizerDID = "authorizerDID" // LogFieldRequesterDID is the log field key for the DID of the requester when creating an access token in the auth module. LogFieldRequesterDID = "requesterDID" // LogFieldNodeAddress is the log field key for node's (gRPC) address from the network module. LogFieldNodeAddress = "nodeAddr" // LogFieldProtocolVersion is the log field key for the protocol version from the network module. LogFieldProtocolVersion = "protocolVersion" // LogFieldMessageType is the log field key for the type, of a received/sent message from the network module. LogFieldMessageType = "messageType" // LogFieldConversationID is the log field key for the conversation ID of messages from the network module. LogFieldConversationID = "conversationID" // LogFieldPeerID is the log field key for peer IDs from the network module. LogFieldPeerID = "peerID" // LogFieldPeerAddr is the log field key for peer addresses from the network module. LogFieldPeerAddr = "peerAddr" // LogFieldPeerNodeDID is the log field key for a peer's node DID from the network module. LogFieldPeerNodeDID = "peerDID" // LogFieldPeerAuthenticated is the log field key for that indicates if the peer's node DID is authenticated. LogFieldPeerAuthenticated = "peerAuthenticated" // LogFieldTransactionRef is the log field key for a transaction reference from the network module. LogFieldTransactionRef = "txRef" // LogFieldTransactionType is the log field key for the payload type, of a transaction from the network module. LogFieldTransactionType = "txType" // LogFieldTransactionIsPrivate is the log field key for marker whether a transaction is private, from the network module. LogFieldTransactionIsPrivate = "txIsPrivate" // LogFieldTransactionPayloadHash is the log field key for the payload (hash) of a transaction from the network module. LogFieldTransactionPayloadHash = "txPayloadHash" // LogFieldTransactionPayloadLength is the log field key for the payload (length in bytes) of a transaction from the network module. LogFieldTransactionPayloadLength = "txPayloadLen" // LogFieldAuditSubject is the log field of the subject (e.g. DID, DID document service, etc) of an audit event. LogFieldAuditSubject = "subject" // LogFieldWalletDID is the log field of the DID of a wallet. LogFieldWalletDID = "walletDID" )
const ErrorWriterContextKey = "!!ErrorWriter"
ErrorWriterContextKey contains the key for the Echo context parameter that specifies a error writer.
const HttpResponseBodyLogTruncateAt = 200
HttpResponseBodyLogTruncateAt is the maximum length of a response body to log. If the response body is longer than this, it will be truncated.
const MinTLSVersion uint16 = tls.VersionTLS12
MinTLSVersion defines the minimal TLS version used by all components that use TLS
const ModuleNameContextKey = "!!ModuleName"
ModuleNameContextKey contains the key for the Echo context parameter that specifies the module that contains the OpenAPI operation being called, for logging/error returning.
const OperationIDContextKey = "!!OperationId"
OperationIDContextKey contains the key for the Echo context parameter that specifies the name of the OpenAPI operation being called, for logging/error returning.
const StatusCodeResolverContextKey = "!!StatusCodeResolver"
StatusCodeResolverContextKey contains the key for the Echo context parameter that specifies a custom HTTP status code resolver.
const UserContextKey = "user"
UserContextKey is the key used to store the user in HTTP contexts.
Variables ¶
var GitBranch = "development"
GitBranch holds the branch from where the binary is built.
var GitCommit = "0"
GitCommit holds the latest git commit hash for this build.
var GitVersion string
GitVersion holds the tagged version belonging to the git commit.
var TracingHTTPTransport func(http.RoundTripper) http.RoundTripper
TracingHTTPTransport wraps an http.RoundTripper with OpenTelemetry tracing instrumentation. It is set by the tracing package when tracing is enabled, and nil when disabled. This callback pattern avoids circular imports between core and tracing packages.
Functions ¶
func BuildInfo ¶
func BuildInfo() string
BuildInfo returns a formatted version of the current branch/tag/version/os/arch
func ClientConfigFlags ¶
ClientConfigFlags returns the flags for configuring the client config.
func CreateHTTPErrorHandler ¶
func CreateHTTPErrorHandler() echo.HTTPErrorHandler
CreateHTTPErrorHandler returns an Echo HTTPErrorHandler that logs the error with extra fields and returns it as an HTTP response.
func GetHTTPStatusCode ¶
GetHTTPStatusCode resolves the HTTP Status Code to be returned from the given error, in this order: - errors with a predefined status code (HTTPStatusCodeError, echo.HTTPError) - from handler - if none of the above criteria match, HTTP 500 Internal Server Error is returned.
func InvalidInputError ¶
InvalidInputError returns an error that maps to a HTTP 400 Bad Request.
func JoinURLPaths ¶
JoinURLPaths works like path.Join but for URLs; it won't remove double slashes. It makes sures there is only one slash between the parts.
func NewCertPool ¶
func NewCertPool(certificates []*x509.Certificate) *x509.CertPool
NewCertPool creates a new x509.CertPool and adds all given certificates to it.
func NotFoundError ¶
NotFoundError returns an error that maps to a HTTP 404 Status Not Found.
func ParseCertificates ¶
func ParseCertificates(data []byte) (certificates []*x509.Certificate, _ error)
ParseCertificates reads PEM encoded X.509 certificates from the given input.
func ParsePublicURL ¶
ParsePublicURL parses the input URL using ParsePublicURLWithScheme. If strictmode is true, no reserved addresses are allowed and the scheme MUST be 'https'
func ParsePublicURLWithScheme ¶
func ParsePublicURLWithScheme(input string, allowReserved bool, allowedSchemes ...string) (*url.URL, error)
ParsePublicURLWithScheme parses the given input string as URL and asserts that it has a scheme and that it is in the allowedSchemes if provided, it is not an IP address, and it is not (depending on allowReserved) a reserved address or TLD as described in RFC2606 or https://www.ietf.org/archive/id/draft-chapin-rfc2606bis-00.html.
func PreconditionFailedError ¶
PreconditionFailedError returns an error that maps to a HTTP 412 Status Precondition Failed.
func ResolveStatusCode ¶
ResolveStatusCode looks tries to find the first error in the given map that satisfies errors.Is() for the given error, and returns the associated integer as HTTP status code. If no match is found it returns 0.
func TestResponseCode ¶
TestResponseCode checks whether the returned HTTP status response code matches the expected code. If it doesn't match it returns an error, containing the received and expected status code, and the response body.
func TestResponseCodeWithLog ¶
func TestResponseCodeWithLog(expectedStatusCode int, response *http.Response, log *logrus.Entry) error
TestResponseCodeWithLog acts like TestResponseCode, but logs the response body if the status code is not as expected. It logs using the given logger, unless nil is passed.
func TruncateHTTPBody ¶
TruncateHTTPBody returns the response body truncated to at most HttpResponseBodyLogTruncateAt bytes, safe to write to a (debug) log. It exists so an unexpected response can be logged for diagnostics without ever placing the full, possibly attacker-influenced, body into an error message that could be reflected back to a caller.
func UserAgent ¶
func UserAgent() string
UserAgent returns a string that can be used as HTTP user agent, containing the version of the node (e.g. nuts-node-refimpl/5.0.0)
func UserAgentRequestEditor ¶
UserAgentRequestEditor can be used as request editor function for generated OpenAPI clients, to set the HTTP User-Agent header to identify the Nuts node.
Types ¶
type AuthorizationTokenGenerator ¶
AuthorizationTokenGenerator is a function type definition for creating authorization tokens
type ClientConfig ¶
type ClientConfig struct {
Address string `koanf:"address"`
Strictmode bool `koanf:"strictmode"`
Timeout time.Duration `koanf:"timeout"`
Token string `koanf:"token"`
TokenFile string `koanf:"token-file"`
Verbosity string `koanf:"verbosity"`
}
ClientConfig has CLI client settings.
func NewClientConfigForCommand ¶
func NewClientConfigForCommand(cmd *cobra.Command) ClientConfig
NewClientConfigForCommand loads all the values for a given command into the provided configMap. defaults < ENV < CLI. Does not load config from file.
func (ClientConfig) GetAddress ¶
func (cfg ClientConfig) GetAddress() string
GetAddress normalizes and gets the address of the server
func (ClientConfig) GetAuthToken ¶
func (cfg ClientConfig) GetAuthToken() (string, error)
GetAuthToken returns the configured auth token. If not set, it tries to read it from the filesystem. If the client config file does not exist, it returns an empty string.
type Configurable ¶
type Configurable interface {
Configure(config ServerConfig) error
}
Configurable is the interface that contains the Configure method. When an engine implements the Configurable interface, it will be called before startup. Configure should only be called once per engine instance
type Diagnosable ¶
type Diagnosable interface {
Diagnostics() []DiagnosticResult
}
Diagnosable allows the implementer, mostly engines, to return diagnostics.
type DiagnosticResult ¶
type DiagnosticResult interface {
// Name returns a simple and understandable name of the check
Name() string
// Result returns the outcome of the check in its original format. This may be any type that can be marshalled by the JSON package.
Result() interface{}
// String returns the outcome of the check formatted as string
String() string
}
DiagnosticResult are the result of different checks giving information on how well the system is doing
type DiagnosticResultMap ¶
type DiagnosticResultMap struct {
Title string
Items []DiagnosticResult
}
DiagnosticResultMap is a DiagnosticResult that presents the given Items as a map, rather than a list.
func (DiagnosticResultMap) Name ¶
func (g DiagnosticResultMap) Name() string
Name returns the of the diagnostic, which is used as key.
func (DiagnosticResultMap) Result ¶
func (g DiagnosticResultMap) Result() interface{}
Result returns the result of the diagnostic, which is Items converted to a map.
func (DiagnosticResultMap) String ¶
func (g DiagnosticResultMap) String() string
String returns the string representation of Result()
type EchoRouter ¶
type EchoRouter interface {
Add(method, path string, handler echo.HandlerFunc, middleware ...echo.MiddlewareFunc) *echo.Route
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
Use(middleware ...echo.MiddlewareFunc)
}
EchoRouter is the interface the generated server API's will require as the Routes func argument
type Engine ¶
type Engine interface {
}
Engine is the base interface for a modular design
func NewMetricsEngine ¶
func NewMetricsEngine() Engine
NewMetricsEngine creates a new Engine for exposing prometheus metrics via http. Metrics are exposed on /metrics, by default the GoCollector and ProcessCollector are enabled.
type ErrorStatusCodeResolver ¶
ErrorStatusCodeResolver defines the API of a type that resolves an HTTP status code from a Go error.
type ErrorWriter ¶
type ErrorWriter interface {
// Write writes the error to the context. The statusCode is a hint of the status code that should be used.
// The description is a short description of what failed (typically the operation name).
Write(echoContext echo.Context, statusCode int, description string, err error) error
}
ErrorWriter writes an error as response to the given context.
type GenericDiagnosticResult ¶
type GenericDiagnosticResult struct {
Title string
Outcome interface{}
}
GenericDiagnosticResult is a simple implementation of the DiagnosticResult interface
func (GenericDiagnosticResult) Name ¶
func (gdr GenericDiagnosticResult) Name() string
Name returns the name of the GenericDiagnosticResult
func (GenericDiagnosticResult) Result ¶
func (gdr GenericDiagnosticResult) Result() interface{}
Result returns the raw outcome of the GenericDiagnosticResult
func (GenericDiagnosticResult) String ¶
func (gdr GenericDiagnosticResult) String() string
String returns the outcome of the GenericDiagnosticResult
type HTTPClientConfig ¶
type HTTPClientConfig struct {
// Timeout specifies the timeout for HTTP requests.
Timeout time.Duration `koanf:"timeout"`
}
HTTPClientConfig contains settings for HTTP clients.
type HTTPConfig ¶
type HTTPConfig struct {
ClientIPHeaderName string `koanf:"clientipheader"`
}
Config is the top-level config struct for HTTP interfaces.
type HTTPRequestDoer ¶
HTTPRequestDoer defines the Do method of the http.Client interface.
func CreateHTTPInternalClient ¶
func CreateHTTPInternalClient(cfg ClientConfig, generator AuthorizationTokenGenerator) (HTTPRequestDoer, error)
CreateHTTPInternalClient creates a new HTTP client with the given client configuration. This client is to be used for internal API calls (CMDs and such) The result HTTPRequestDoer can be supplied to OpenAPI generated clients for executing requests. This does not use the generated client options for e.g. authentication, because each generated OpenAPI client reimplements the client options using structs, which makes them incompatible with each other, making it impossible to use write generic client code for common traits like authorization. If the given authorization token builder is non-nil, it calls it and passes the resulting token as bearer token with requests.
func MustCreateInternalHTTPClient ¶
func MustCreateInternalHTTPClient(cfg ClientConfig, generator AuthorizationTokenGenerator) HTTPRequestDoer
MustCreateInternalHTTPClient is like CreateHTTPInternalClient but panics if it returns an error.
type HTTPStatusCodeError ¶
HTTPStatusCodeError defines an interface for HTTP errors that includes a HTTP statuscode
type Health ¶
type Health struct {
// Status contains the status of the health check.
Status HealthStatus `json:"status"`
// Details contains optional details of the health check, can be nil.
Details interface{} `json:"details,omitempty"`
}
Health is the result of a health check.
type HealthCheckable ¶
type HealthCheckable interface {
Named
// CheckHealth performs health checks and returns the result. The function should not perform expensive or slow operations
// and should return as fast as possible.
CheckHealth() map[string]Health
}
HealthCheckable is the interface for engines that can perform health checks, which result can be reported to monitoring tooling.
type HealthStatus ¶
type HealthStatus string
HealthStatus defines the result status of a health check.
const ( // HealthStatusUp indicates the health check succeeded HealthStatusUp HealthStatus = "UP" // HealthStatusDown indicates the health check failed HealthStatusDown HealthStatus = "DOWN" // HealthStatusUnknown indicates the status of the health check is unknown HealthStatusUnknown HealthStatus = "UNKNOWN" )
func (HealthStatus) Severity ¶
func (h HealthStatus) Severity() int
Severity returns an integer indicating the seriousness of a startup. 0 means all is OK, higher is worse.
type HttpError ¶
type HttpError struct {
StatusCode int
ResponseBody []byte
// contains filtered or unexported fields
}
HttpError describes an error returned when invoking a remote server.
type Injectable ¶
type Injectable interface {
Named
// Config returns a pointer to the struct that holds the Config.
Config() interface{}
}
Injectable marks an engine capable of Config injection
type LandingPage ¶
type LandingPage struct{}
LandingPage is a Routable that exposes a landing page at the node's HTTP root (`/`).
func (LandingPage) Routes ¶
func (l LandingPage) Routes(router EchoRouter)
Routes registers the landing page on the given EchoRouter.
type Migratable ¶
type Migratable interface {
Migrate() error
}
Migratable is the interface that defines if an engine is migratable. If an engine is migratable, Migrate is called between Configure() and Start(). Migrations may require their own DB connection, they are closed before Start() is called.
type MockConfigurable ¶
type MockConfigurable struct {
// contains filtered or unexported fields
}
MockConfigurable is a mock of Configurable interface.
func NewMockConfigurable ¶
func NewMockConfigurable(ctrl *gomock.Controller) *MockConfigurable
NewMockConfigurable creates a new mock instance.
func (*MockConfigurable) Configure ¶
func (m *MockConfigurable) Configure(config ServerConfig) error
Configure mocks base method.
func (*MockConfigurable) EXPECT ¶
func (m *MockConfigurable) EXPECT() *MockConfigurableMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockConfigurableMockRecorder ¶
type MockConfigurableMockRecorder struct {
// contains filtered or unexported fields
}
MockConfigurableMockRecorder is the mock recorder for MockConfigurable.
type MockDiagnosable ¶
type MockDiagnosable struct {
// contains filtered or unexported fields
}
MockDiagnosable is a mock of Diagnosable interface.
func NewMockDiagnosable ¶
func NewMockDiagnosable(ctrl *gomock.Controller) *MockDiagnosable
NewMockDiagnosable creates a new mock instance.
func (*MockDiagnosable) Diagnostics ¶
func (m *MockDiagnosable) Diagnostics() []DiagnosticResult
Diagnostics mocks base method.
func (*MockDiagnosable) EXPECT ¶
func (m *MockDiagnosable) EXPECT() *MockDiagnosableMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockDiagnosableMockRecorder ¶
type MockDiagnosableMockRecorder struct {
// contains filtered or unexported fields
}
MockDiagnosableMockRecorder is the mock recorder for MockDiagnosable.
func (*MockDiagnosableMockRecorder) Diagnostics ¶
func (mr *MockDiagnosableMockRecorder) Diagnostics() *gomock.Call
Diagnostics indicates an expected call of Diagnostics.
type MockEchoRouter ¶
type MockEchoRouter struct {
// contains filtered or unexported fields
}
MockEchoRouter is a mock of EchoRouter interface.
func NewMockEchoRouter ¶
func NewMockEchoRouter(ctrl *gomock.Controller) *MockEchoRouter
NewMockEchoRouter creates a new mock instance.
func (*MockEchoRouter) Add ¶
func (m *MockEchoRouter) Add(method, path string, handler echo.HandlerFunc, middleware ...echo.MiddlewareFunc) *echo.Route
Add mocks base method.
func (*MockEchoRouter) CONNECT ¶
func (m_2 *MockEchoRouter) CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
CONNECT mocks base method.
func (*MockEchoRouter) DELETE ¶
func (m_2 *MockEchoRouter) DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE mocks base method.
func (*MockEchoRouter) EXPECT ¶
func (m *MockEchoRouter) EXPECT() *MockEchoRouterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockEchoRouter) GET ¶
func (m_2 *MockEchoRouter) GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET mocks base method.
func (*MockEchoRouter) HEAD ¶
func (m_2 *MockEchoRouter) HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD mocks base method.
func (*MockEchoRouter) OPTIONS ¶
func (m_2 *MockEchoRouter) OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS mocks base method.
func (*MockEchoRouter) PATCH ¶
func (m_2 *MockEchoRouter) PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH mocks base method.
func (*MockEchoRouter) POST ¶
func (m_2 *MockEchoRouter) POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST mocks base method.
func (*MockEchoRouter) PUT ¶
func (m_2 *MockEchoRouter) PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT mocks base method.
func (*MockEchoRouter) TRACE ¶
func (m_2 *MockEchoRouter) TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE mocks base method.
func (*MockEchoRouter) Use ¶
func (m *MockEchoRouter) Use(middleware ...echo.MiddlewareFunc)
Use mocks base method.
type MockEchoRouterMockRecorder ¶
type MockEchoRouterMockRecorder struct {
// contains filtered or unexported fields
}
MockEchoRouterMockRecorder is the mock recorder for MockEchoRouter.
func (*MockEchoRouterMockRecorder) Add ¶
func (mr *MockEchoRouterMockRecorder) Add(method, path, handler any, middleware ...any) *gomock.Call
Add indicates an expected call of Add.
func (*MockEchoRouterMockRecorder) CONNECT ¶
func (mr *MockEchoRouterMockRecorder) CONNECT(path, h any, m ...any) *gomock.Call
CONNECT indicates an expected call of CONNECT.
func (*MockEchoRouterMockRecorder) DELETE ¶
func (mr *MockEchoRouterMockRecorder) DELETE(path, h any, m ...any) *gomock.Call
DELETE indicates an expected call of DELETE.
func (*MockEchoRouterMockRecorder) GET ¶
func (mr *MockEchoRouterMockRecorder) GET(path, h any, m ...any) *gomock.Call
GET indicates an expected call of GET.
func (*MockEchoRouterMockRecorder) HEAD ¶
func (mr *MockEchoRouterMockRecorder) HEAD(path, h any, m ...any) *gomock.Call
HEAD indicates an expected call of HEAD.
func (*MockEchoRouterMockRecorder) OPTIONS ¶
func (mr *MockEchoRouterMockRecorder) OPTIONS(path, h any, m ...any) *gomock.Call
OPTIONS indicates an expected call of OPTIONS.
func (*MockEchoRouterMockRecorder) PATCH ¶
func (mr *MockEchoRouterMockRecorder) PATCH(path, h any, m ...any) *gomock.Call
PATCH indicates an expected call of PATCH.
func (*MockEchoRouterMockRecorder) POST ¶
func (mr *MockEchoRouterMockRecorder) POST(path, h any, m ...any) *gomock.Call
POST indicates an expected call of POST.
func (*MockEchoRouterMockRecorder) PUT ¶
func (mr *MockEchoRouterMockRecorder) PUT(path, h any, m ...any) *gomock.Call
PUT indicates an expected call of PUT.
type MockEngine ¶
type MockEngine struct {
// contains filtered or unexported fields
}
MockEngine is a mock of Engine interface.
func NewMockEngine ¶
func NewMockEngine(ctrl *gomock.Controller) *MockEngine
NewMockEngine creates a new mock instance.
func (*MockEngine) EXPECT ¶
func (m *MockEngine) EXPECT() *MockEngineMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockEngineMockRecorder ¶
type MockEngineMockRecorder struct {
// contains filtered or unexported fields
}
MockEngineMockRecorder is the mock recorder for MockEngine.
type MockHealthCheckable ¶
type MockHealthCheckable struct {
// contains filtered or unexported fields
}
MockHealthCheckable is a mock of HealthCheckable interface.
func NewMockHealthCheckable ¶
func NewMockHealthCheckable(ctrl *gomock.Controller) *MockHealthCheckable
NewMockHealthCheckable creates a new mock instance.
func (*MockHealthCheckable) CheckHealth ¶
func (m *MockHealthCheckable) CheckHealth() map[string]Health
CheckHealth mocks base method.
func (*MockHealthCheckable) EXPECT ¶
func (m *MockHealthCheckable) EXPECT() *MockHealthCheckableMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockHealthCheckable) Name ¶
func (m *MockHealthCheckable) Name() string
Name mocks base method.
type MockHealthCheckableMockRecorder ¶
type MockHealthCheckableMockRecorder struct {
// contains filtered or unexported fields
}
MockHealthCheckableMockRecorder is the mock recorder for MockHealthCheckable.
func (*MockHealthCheckableMockRecorder) CheckHealth ¶
func (mr *MockHealthCheckableMockRecorder) CheckHealth() *gomock.Call
CheckHealth indicates an expected call of CheckHealth.
func (*MockHealthCheckableMockRecorder) Name ¶
func (mr *MockHealthCheckableMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
type MockInjectable ¶
type MockInjectable struct {
// contains filtered or unexported fields
}
MockInjectable is a mock of Injectable interface.
func NewMockInjectable ¶
func NewMockInjectable(ctrl *gomock.Controller) *MockInjectable
NewMockInjectable creates a new mock instance.
func (*MockInjectable) EXPECT ¶
func (m *MockInjectable) EXPECT() *MockInjectableMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockInjectableMockRecorder ¶
type MockInjectableMockRecorder struct {
// contains filtered or unexported fields
}
MockInjectableMockRecorder is the mock recorder for MockInjectable.
func (*MockInjectableMockRecorder) Config ¶
func (mr *MockInjectableMockRecorder) Config() *gomock.Call
Config indicates an expected call of Config.
func (*MockInjectableMockRecorder) Name ¶
func (mr *MockInjectableMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
type MockMigratable ¶
type MockMigratable struct {
// contains filtered or unexported fields
}
MockMigratable is a mock of Migratable interface.
func NewMockMigratable ¶
func NewMockMigratable(ctrl *gomock.Controller) *MockMigratable
NewMockMigratable creates a new mock instance.
func (*MockMigratable) EXPECT ¶
func (m *MockMigratable) EXPECT() *MockMigratableMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMigratable) Migrate ¶
func (m *MockMigratable) Migrate() error
Migrate mocks base method.
type MockMigratableMockRecorder ¶
type MockMigratableMockRecorder struct {
// contains filtered or unexported fields
}
MockMigratableMockRecorder is the mock recorder for MockMigratable.
func (*MockMigratableMockRecorder) Migrate ¶
func (mr *MockMigratableMockRecorder) Migrate() *gomock.Call
Migrate indicates an expected call of Migrate.
type MockNamed ¶
type MockNamed struct {
// contains filtered or unexported fields
}
MockNamed is a mock of Named interface.
func NewMockNamed ¶
func NewMockNamed(ctrl *gomock.Controller) *MockNamed
NewMockNamed creates a new mock instance.
func (*MockNamed) EXPECT ¶
func (m *MockNamed) EXPECT() *MockNamedMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockNamedMockRecorder ¶
type MockNamedMockRecorder struct {
// contains filtered or unexported fields
}
MockNamedMockRecorder is the mock recorder for MockNamed.
func (*MockNamedMockRecorder) Name ¶
func (mr *MockNamedMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
type MockRoutable ¶
type MockRoutable struct {
// contains filtered or unexported fields
}
MockRoutable is a mock of Routable interface.
func NewMockRoutable ¶
func NewMockRoutable(ctrl *gomock.Controller) *MockRoutable
NewMockRoutable creates a new mock instance.
func (*MockRoutable) EXPECT ¶
func (m *MockRoutable) EXPECT() *MockRoutableMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRoutable) Routes ¶
func (m *MockRoutable) Routes(router EchoRouter)
Routes mocks base method.
type MockRoutableMockRecorder ¶
type MockRoutableMockRecorder struct {
// contains filtered or unexported fields
}
MockRoutableMockRecorder is the mock recorder for MockRoutable.
type MockRunnable ¶
type MockRunnable struct {
// contains filtered or unexported fields
}
MockRunnable is a mock of Runnable interface.
func NewMockRunnable ¶
func NewMockRunnable(ctrl *gomock.Controller) *MockRunnable
NewMockRunnable creates a new mock instance.
func (*MockRunnable) EXPECT ¶
func (m *MockRunnable) EXPECT() *MockRunnableMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockRunnableMockRecorder ¶
type MockRunnableMockRecorder struct {
// contains filtered or unexported fields
}
MockRunnableMockRecorder is the mock recorder for MockRunnable.
func (*MockRunnableMockRecorder) Shutdown ¶
func (mr *MockRunnableMockRecorder) Shutdown() *gomock.Call
Shutdown indicates an expected call of Shutdown.
func (*MockRunnableMockRecorder) Start ¶
func (mr *MockRunnableMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
type MockViewableDiagnostics ¶
type MockViewableDiagnostics struct {
// contains filtered or unexported fields
}
MockViewableDiagnostics is a mock of ViewableDiagnostics interface.
func NewMockViewableDiagnostics ¶
func NewMockViewableDiagnostics(ctrl *gomock.Controller) *MockViewableDiagnostics
NewMockViewableDiagnostics creates a new mock instance.
func (*MockViewableDiagnostics) Diagnostics ¶
func (m *MockViewableDiagnostics) Diagnostics() []DiagnosticResult
Diagnostics mocks base method.
func (*MockViewableDiagnostics) EXPECT ¶
func (m *MockViewableDiagnostics) EXPECT() *MockViewableDiagnosticsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockViewableDiagnostics) Name ¶
func (m *MockViewableDiagnostics) Name() string
Name mocks base method.
type MockViewableDiagnosticsMockRecorder ¶
type MockViewableDiagnosticsMockRecorder struct {
// contains filtered or unexported fields
}
MockViewableDiagnosticsMockRecorder is the mock recorder for MockViewableDiagnostics.
func (*MockViewableDiagnosticsMockRecorder) Diagnostics ¶
func (mr *MockViewableDiagnosticsMockRecorder) Diagnostics() *gomock.Call
Diagnostics indicates an expected call of Diagnostics.
func (*MockViewableDiagnosticsMockRecorder) Name ¶
func (mr *MockViewableDiagnosticsMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
type Named ¶
type Named interface {
// Name returns the name of the engine
Name() string
}
Named is the interface for all engines that have a name
type RFC3339Time ¶
RFC3339Time is a time that marshals as RFC3339
func (RFC3339Time) MarshalText ¶
func (j RFC3339Time) MarshalText() ([]byte, error)
MarshalText marshals the time in RFC3339 format
func (*RFC3339Time) UnmarshalJSON ¶
func (j *RFC3339Time) UnmarshalJSON(bytes []byte) error
UnmarshalJSON parses the time string using RFC3339 format
type Routable ¶
type Routable interface {
// Routes configures the HTTP routes on the given router
Routes(router EchoRouter)
}
Routable enables connecting a REST API to the echo server. The API wrappers should implement this interface
type Runnable ¶
Runnable is the interface that groups the Start and Shutdown methods. When an engine implements these they will be called on startup and shutdown. Start and Shutdown should not be called more than once
type ServerConfig ¶
type ServerConfig struct {
// URL contains the base URL for public-facing HTTP services.
URL string `koanf:"url"`
DIDMethods []string `koanf:"didmethods"`
Verbosity string `koanf:"verbosity"`
LoggerFormat string `koanf:"loggerformat"`
CPUProfile string `koanf:"cpuprofile"`
Strictmode bool `koanf:"strictmode"`
InternalRateLimiter bool `koanf:"internalratelimiter"`
Datadir string `koanf:"datadir"`
HTTPClient HTTPClientConfig `koanf:"httpclient"`
TLS TLSConfig `koanf:"tls"`
// LegacyTLS exists to detect usage of deprecated network.{truststorefile,certkeyfile,certfile} parameters.
// This can be removed in v6.1+ (can't skip minors in migration). See https://github.com/nuts-foundation/nuts-node/issues/2909
LegacyTLS TLSConfig `koanf:"network"`
// HTTP exists to expose http.clientipheader to the nuts-network layer.
// This header should contaisn the client IP address for logging. Can be removed together with the nuts-network
HTTP HTTPConfig `koanf:"http"`
// contains filtered or unexported fields
}
ServerConfig has global server settings.
func NewServerConfig ¶
func NewServerConfig() *ServerConfig
NewServerConfig creates an initialized empty server config
func TestServerConfig ¶
func TestServerConfig(visitors ...func(*ServerConfig)) ServerConfig
TestServerConfig returns a new ServerConfig with the given template applied.
func (*ServerConfig) InjectIntoEngine ¶
func (ngc *ServerConfig) InjectIntoEngine(e Injectable) error
InjectIntoEngine takes the loaded config and sets the engine's config struct
func (*ServerConfig) Load ¶
func (ngc *ServerConfig) Load(flags *pflag.FlagSet) (err error)
Load loads the server config follows the load order of configfile, env vars and then commandline param
func (*ServerConfig) PrintConfig ¶
func (ngc *ServerConfig) PrintConfig() string
PrintConfig return the current config in string form
type System ¶
type System struct {
// Config holds the global and raw config
Config *ServerConfig
// Routers is used to connect API handlers to the echo server
Routers []Routable
// Context is cancelled when the system shuts down.
Context context.Context
// ContextCancel is a function to signal the system should shut down.
ContextCancel context.CancelFunc
// contains filtered or unexported fields
}
System is the control structure where engines are registered.
func (*System) Configure ¶
Configure configures all engines in the system. Engines are configured in order of registration (tracing engine should be first).
func (*System) FindEngineByName ¶
FindEngineByName looks up given target engine by name, or nil if not found.
func (*System) RegisterEngine ¶
RegisterEngine is a helper func to add an engine to the list of engines from a different lib/pkg
func (*System) RegisterRoutes ¶
RegisterRoutes is a helper func to register API routers so they can be linked to the echo server
func (*System) Shutdown ¶
Shutdown shuts down all engines in the system. Engines are shut down in reverse order of registration.
func (*System) VisitEngines ¶
VisitEngines applies the given function on all engines in the system. It visits the engines in order they were registered.
type TLSConfig ¶
type TLSConfig struct {
// Offload specifies the TLS offloading mode for incoming/outgoing traffic.
Offload TLSOffloadingMode `koanf:"offload"`
// ClientCertHeaderName specifies the name of the HTTP header in which the TLS offloader puts the client certificate in.
// It is required when TLS offloading for incoming traffic is enabled. The client certificate must be in PEM format.
ClientCertHeaderName string `koanf:"certheader"`
CertFile string `koanf:"certfile"`
CertKeyFile string `koanf:"certkeyfile"`
TrustStoreFile string `koanf:"truststorefile"`
}
TLSConfig specifies how TLS should be configured for connections.
func (TLSConfig) Enabled ¶
Enabled returns whether TLS should be enabled, according to the global config.
func (TLSConfig) Load ¶
func (t TLSConfig) Load() (*tls.Config, *TrustStore, error)
Load creates tls.Config from the given configuration. If TLS is disabled it returns nil.
func (TLSConfig) LoadCertificate ¶
func (t TLSConfig) LoadCertificate() (tls.Certificate, error)
LoadCertificate loads the TLS certificate from the configured location.
func (TLSConfig) LoadTrustStore ¶
func (t TLSConfig) LoadTrustStore() (*TrustStore, error)
LoadTrustStore loads the TLS trust store from the configured location.
type TLSOffloadingMode ¶
type TLSOffloadingMode string
TLSOffloadingMode defines configurable modes for TLS offloading.
const ( // NoOffloading specifies that TLS is not offloaded, // meaning incoming and outgoing TLS traffic is terminated at the local node, and not by a proxy inbetween. NoOffloading TLSOffloadingMode = "" // OffloadIncomingTLS specifies that incoming TLS traffic should be offloaded. // It will assume there is a reverse proxy at which TLS is terminated, // and which puts the client certificate in PEM format in a configured header. OffloadIncomingTLS = "incoming" )
type TestEngine ¶
type TestEngine struct {
TestConfig TestEngineConfig
ShutdownError bool
// contains filtered or unexported fields
}
func (*TestEngine) Config ¶
func (i *TestEngine) Config() interface{}
func (*TestEngine) FlagSet ¶
func (i *TestEngine) FlagSet() *pflag.FlagSet
func (*TestEngine) Name ¶
func (i *TestEngine) Name() string
type TestEngineConfig ¶
type TestEngineConfig struct {
Key string `koanf:"key"`
Sub TestEngineSubConfig `koanf:"sub"`
SubPtr *TestEngineSubConfig `koanf:"subptr"`
List []string `koanf:"list"`
}
TestEngineConfig defines the configuration for the test engine
type TestEngineSubConfig ¶
type TestEngineSubConfig struct {
Test string `koanf:"test"`
}
TestEngineSubConfig defines the `sub` configuration for the test engine
type TrustStore ¶
type TrustStore struct {
CertPool *x509.CertPool
RootCAs []*x509.Certificate
IntermediateCAs []*x509.Certificate
// contains filtered or unexported fields
}
TrustStore contains both a CertPool and the actual certificates
func BuildTrustStore ¶
func BuildTrustStore(certificates []*x509.Certificate) *TrustStore
BuildTrustStore creates a TrustStore from the given certificates, separating them into root and intermediate CAs
func LoadTrustStore ¶
func LoadTrustStore(trustStoreFile string) (*TrustStore, error)
LoadTrustStore creates a x509 certificate pool based on a truststore file
func ParseTrustStore ¶
func ParseTrustStore(data []byte) (*TrustStore, error)
ParseTrustStore creates a x509 certificate pool from the raw data
func (*TrustStore) Certificates ¶
func (store *TrustStore) Certificates() []*x509.Certificate
Certificates returns a copy of the certificates within the CertPool
type ViewableDiagnostics ¶
type ViewableDiagnostics interface {
Named
Diagnosable
}
ViewableDiagnostics is used for engines that display diagnostics in an interface