bootstrap

package
v0.0.0-...-895fdff Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 37 Imported by: 1

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 GetPublicEndpoint

func GetPublicEndpoint(listenAddress string) (string, error)

GetPublicEndpoint will get the general endpoint based on the listen address. It will get the port, then use system construct to get the public IP and append the port.

func MakeA3SManipulator

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

MakeA3SManipulator returns an HTTP manipulator for a3s communication.

func MakeA3SRemoteAuth deprecated

func MakeA3SRemoteAuth(
	ctx context.Context,
	m manipulate.Manipulator,
	requiredIssuer string,
	requiredAudience string,
	publicResources ...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.

Deprecated: Please use MakeA3SRemoteAuthX.

func MakeA3SRemoteAuthX

func MakeA3SRemoteAuthX(
	ctx context.Context,
	m manipulate.Manipulator,
	requiredIssuer string,
	requiredAudience string,
	publicResources []string,
	trustedRemoteIssuers []authenticator.RemoteIssuer,
) (*authenticator.Authenticator, authorizer.Authorizer, error)

MakeA3SRemoteAuthX 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

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,
	apiManager elemental.ModelManager,
	cfg any,
	nopts ...push.NotifierOption,
) []bahamut.Option

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

func MakeCNExcluderFunc

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

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

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

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 MakeRedisClient

func MakeRedisClient(cfg conf.RedisConf) (redis.UniversalClient, error)

MakeRedisClient returns a redis client based on the provided configuration.

func MakeRequestAuthenticatorBypasser

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

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.

func TLSConfig

func TLSConfig(autocfg conf.TLSAutoConf, manualcfg conf.TLSConf) (*tls.Config, error)

TLSConfig returns a *tls.Config given an TLSAutoConf and and manual TLSConfig

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
⌂ 换网址