bootstrap

package
v0.11.19 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureBahamut

func ConfigureBahamut(
	ctx context.Context,
	cfg any,
	pubsub bahamut.PubSubClient,
	apiManager elemental.ModelManager,
	healthHandler bahamut.HealthServerFunc,
	requestAuthenticators []bahamut.RequestAuthenticator,
	sessionAuthenticators []bahamut.SessionAuthenticator,
	authorizers []bahamut.Authorizer,
) (opts []bahamut.Option)

ConfigureBahamut returns a list of bahamut.Option based on provided configuration.

func ConfigureMaxProc

func ConfigureMaxProc(overrideMax int)

ConfigureMaxProc configures the program's GOMAXPROCS to the given value if not 0. If 0, the default GOMAXPROCS will be used.

func ErrorTransformer

func ErrorTransformer(err error) error

ErrorTransformer transforms a disconnected error into an not acceptable. This avoid 500 errors due to clients being disconnected.

func MakeA3SManipulator

func MakeA3SManipulator(ctx context.Context, a3sConfig conf.A3SClientConf) (manipulate.Manipulator, error)

MakeA3SManipulator returns an HTTP manipulator for a3s communication.

func MakeA3SRemoteAuth added in v0.11.3

func MakeA3SRemoteAuth(
	ctx context.Context,
	m manipulate.Manipulator,
	requiredIssuer string,
	requiredAudience string,
) (*authenticator.Authenticator, authorizer.Authorizer, error)

MakeA3SRemoteAuth is a convenience function that will return ready to user Authenticator and Authorizers for a bahamut server. It uses the given manipulator to talk to the instance of a3s.

func MakeAuthorizerBypasser added in v0.11.3

func MakeAuthorizerBypasser(identities []elemental.Identity) bahamut.Authorizer

MakeAuthorizerBypasser returns a bahamut.Authorizer that returns bahamut.ActionOK if the request is on one of the given identities. Otherwise it returns bahamut.Continue.

func MakeBahamutGatewayNotifier

func MakeBahamutGatewayNotifier(
	ctx context.Context,
	pubsub bahamut.PubSubClient,
	serviceName string,
	gatewayTopic string,
	anouncedAddress string,
	nopts ...push.NotifierOption,
) []bahamut.Option

MakeBahamutGatewayNotifier returns the bahamut options needed to make A3S announce itself to a bahamut gateway.

func MakeCNExcluderFunc added in v0.11.3

func MakeCNExcluderFunc(cn string) mtls.VerifierFunc

MakeCNExcluderFunc returns an mtls.VerifierFunc that rejects mtls verification if the certificate has the given Common Name.

func MakeIdentifiableRetriever

func MakeIdentifiableRetriever(
	manipulator manipulate.Manipulator,
	apiManager elemental.ModelManager,
) bahamut.IdentifiableRetriever

MakeIdentifiableRetriever returns a bahamut.IdentifiableRetriever to handle patches as classic update.

func MakeMTLSAuthorizer added in v0.11.3

func MakeMTLSAuthorizer(caPool *x509.CertPool, verifier mtls.VerifierFunc, ignoredIdentities []elemental.Identity) bahamut.Authorizer

MakeMTLSAuthorizer returns a bahamut.Authorizer that will allow requests presenting a client certificate signed by a CA present in the given caPool unless the given mtls.VerifierFunc disagrees.

func MakeMTLSRequestAuthenticator added in v0.11.3

func MakeMTLSRequestAuthenticator(caPool *x509.CertPool, verifier mtls.VerifierFunc) bahamut.RequestAuthenticator

MakeMTLSRequestAuthenticator returns a bahamut.RequestAuthenticator that will allow requests presenting a client certificate signed by a CA present in the given caPool unless the given mtls.VerifierFunc disagrees.

func MakeMongoManipulator

func MakeMongoManipulator(cfg conf.MongoConf, hasher sharder.Hasher, model elemental.ModelManager, additionalOptions ...manipmongo.Option) manipulate.TransactionalManipulator

MakeMongoManipulator returns a configured mongo manipulator. This function is not meant to be used outside of the platform. It will fatal anytime it feels like it.

func MakeNATSClient

func MakeNATSClient(cfg conf.NATSConf) bahamut.PubSubClient

MakeNATSClient returns a connected pubsub server client. This function is not meant to be used outside of the platform. It will fatal anytime it feels like it.

func MakeNATSServer added in v0.4.0

func MakeNATSServer(cfg *conf.NATSConf) (*natsserver.Server, error)

MakeNATSServer returns an embded nats server. It uses the provide conf.NATSConf to configure everything needed. This function WILL change the provided NATSConf so it can be used with the generated NATS server. Basically, fields in NATSConf related to server connection will be either ignored or replaced.

func MakePublishHandler

func MakePublishHandler(excludedIdentities []elemental.Identity) bahamut.PushPublishHandler

MakePublishHandler returns a bahamut.PushPublishHandler that publishes all events but the ones related to the given identities.

func MakeRequestAuthenticatorBypasser added in v0.11.3

func MakeRequestAuthenticatorBypasser(identities []elemental.Identity) bahamut.RequestAuthenticator

MakeRequestAuthenticatorBypasser returns a bahamut.RequestAuthenticator that returns bahamut.ActionOK if the request is for one of the given identities. Otherwise it returns bahamut.Continue.

func MakeSessionAuthenticatorBypasser added in v0.11.3

func MakeSessionAuthenticatorBypasser(identities []elemental.Identity) bahamut.RequestAuthenticator

MakeSessionAuthenticatorBypasser returns a bahamut.SessionAuthenticator that returns bahamut.ActionOK if the request is for one of the given identities. Otherwise it returns bahamut.Continue.

Types

type CloseRecorderHandler

type CloseRecorderHandler func()

CloseRecorderHandler is the type of recorder closer handler

func ConfigureLogger

func ConfigureLogger(serviceName string, cfg conf.LoggingConf) CloseRecorderHandler

ConfigureLogger configures the logging subsystem.

func ConfigureTracerWithURL

func ConfigureTracerWithURL(tracerURL string, serviceName string) (CloseRecorderHandler, error)

ConfigureTracerWithURL returns a jaeger backed opentracing tracer from an URL.

Jump to

Keyboard shortcuts

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