Files
threshold/internal/daemon/cluster/handlers/options.go
T
Jim b9cc441227 feature (handlers): add UpstreamMessageService and its oss impl.
Define OSS protos for UpstreamMessageService rpc which defines a way
to send an upstream message to a controller (across multi-hops if
needed).

Implement OSS versions of both workers and controllers for the
UpstreamMessageService. The upstream requests/responses are encrypted
using the originating worker's NodeCredential's key.

The worker always forwards the request upstream.

The controller attends to find a registered UpstreamMessageHandler to
handle the msg; if none if found, then an Unimplemented status error
is returned.
2023-05-31 12:18:09 +00:00

37 lines
740 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package handlers
import (
"github.com/hashicorp/nodeenrollment/types"
)
// getOpts - iterate the inbound Options and return a struct
func getOpts(opt ...Option) options {
opts := getDefaultOptions()
for _, o := range opt {
o(&opts)
}
return opts
}
// Option - how Options are passed as arguments
type Option func(*options)
// options = how options are represented
type options struct {
withNodeInfo *types.NodeInformation
}
func getDefaultOptions() options {
return options{}
}
// WithNodeInfo provides an option types.NodeInformation
func WithNodeInfo(nodeInfo *types.NodeInformation) Option {
return func(o *options) {
o.withNodeInfo = nodeInfo
}
}