* Move the server daemons into their own package With this change the internal/server package now is dedicated to the server domain (workers and controllers) and not to the server daemons. The hope is that this will make it easier to keep the daemons decoupled from the representation of the servers in the database.
36 lines
801 B
Go
36 lines
801 B
Go
package proxy
|
|
|
|
import (
|
|
serverpb "github.com/hashicorp/boundary/internal/gen/controller/servers/services"
|
|
)
|
|
|
|
// Option - how Options are passed as arguments.
|
|
type Option func(*Options)
|
|
|
|
// GetOpts - iterate the inbound Options and return a struct.
|
|
func GetOpts(opt ...Option) Options {
|
|
opts := getDefaultOptions()
|
|
for _, o := range opt {
|
|
o(&opts)
|
|
}
|
|
return opts
|
|
}
|
|
|
|
// Options = how options are represented
|
|
type Options struct {
|
|
WithEgressCredentials []*serverpb.Credential
|
|
}
|
|
|
|
func getDefaultOptions() Options {
|
|
return Options{
|
|
WithEgressCredentials: nil,
|
|
}
|
|
}
|
|
|
|
// WithEgressCredentials provides an optional egress credentials to use when establishing a proxy
|
|
func WithEgressCredentials(creds []*serverpb.Credential) Option {
|
|
return func(o *Options) {
|
|
o.WithEgressCredentials = creds
|
|
}
|
|
}
|