choria

package
v0.29.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: Apache-2.0 Imports: 50 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentBroadcastTarget

func AgentBroadcastTarget(collective string, agent string) string

func BuildInfo added in v0.14.0

func BuildInfo() *build.Info

BuildInfo retrieves build information

func ECDHKeyPair added in v0.23.0

func ECDHKeyPair() (pri []byte, pub []byte, err error)

ECDHKeyPair create a keypair for key exchange using curve 25519

This can be used to do Diffie-Hellman key exchange using Curve 25519 keys

leftPri, leftPub, _ := ECDHKeyPair()

rightPri, rightPub, _ := ECDHKeyPair()

If left sends his pub to the remote end a shared secret can be calculated by the right side:

secret, err := ECDHSharedSecret(rightPri, leftPub)

Right now does whatever needs doing with the shared secret and sends back rightPub to the left hand

Left can now figure out the same shared secret:

secret, err := ECDHSharedSecret(leftPri, rightPub)

And decode any data encrypted using the shared secret, no shared keys ever traverse the network

func ECDHSharedSecret added in v0.23.0

func ECDHSharedSecret(localPrivate []byte, remotePub []byte) ([]byte, error)

ECDHSharedSecret calculates a shared secret based on a local private key and a remote public key

func ECDHSharedSecretString added in v0.23.0

func ECDHSharedSecretString(localPrivate string, remotePub string) (string, error)

ECDHSharedSecretString creates a shared secret in string form that can be decoded using hex.DecodeString

func Ed24419Verify added in v0.26.2

func Ed24419Verify(pk ed25519.PublicKey, msg []byte, sig []byte) (bool, error)

func Ed25519KeyPair added in v0.25.0

func Ed25519KeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)

func Ed25519KeyPairFromSeed added in v0.25.0

func Ed25519KeyPairFromSeed(seed []byte) (ed25519.PublicKey, ed25519.PrivateKey, error)

func Ed25519KeyPairFromSeedFile added in v0.25.0

func Ed25519KeyPairFromSeedFile(f string) (ed25519.PublicKey, ed25519.PrivateKey, error)

func Ed25519KeyPairToFile added in v0.25.0

func Ed25519KeyPairToFile(f string) (ed25519.PublicKey, ed25519.PrivateKey, error)

func Ed25519Sign added in v0.25.0

func Ed25519Sign(pk ed25519.PrivateKey, msg []byte) ([]byte, error)

func Ed25519SignWithSeedFile added in v0.25.0

func Ed25519SignWithSeedFile(f string, msg []byte) ([]byte, error)

func FileExist

func FileExist(path string) bool

FileExist checks if a file exist

func FileIsDir added in v0.15.0

func FileIsDir(path string) bool

FileIsDir tests if a file is a directory

func FileIsRegular added in v0.15.0

func FileIsRegular(path string) bool

FileIsRegular tests if a file is a regular file, no links, etc

func Inbox added in v0.23.0

func Inbox(collective string, caller string) string

func NewRequestID

func NewRequestID() (string, error)

NewRequestID Creates a new v1 RequestID like random string. Here for backwards compat with older clients

func NodeDirectedTarget

func NodeDirectedTarget(collective string, identity string) string

func ParseDuration added in v0.24.0

func ParseDuration(dstr string) (dur time.Duration, err error)

ParseDuration is an extended version of go duration parsing that also supports w,W,d,D,M,Y,y in addition to what go supports

func ReplyTarget

func ReplyTarget(msg inter.Message, requestid string) string

func ServiceBroadcastTarget added in v0.22.0

func ServiceBroadcastTarget(collective string, agent string) string

func TargetForMessage

func TargetForMessage(msg inter.Message, identity string) (string, error)

func UserConfig

func UserConfig() string

UserConfig determines what is the active config file for a user

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection is a actual NATS connection handler, it implements Connector

func (*Connection) AgentBroadcastTarget

func (conn *Connection) AgentBroadcastTarget(collective string, agent string) string

func (*Connection) ChanQueueSubscribe

func (conn *Connection) ChanQueueSubscribe(name string, subject string, group string, capacity int) (chan inter.ConnectorMessage, error)

ChanQueueSubscribe creates a channel of a certain size and subscribes to a queue group.

The given name would later be used should a unsubscribe be needed

func (*Connection) Close

func (conn *Connection) Close()

Close closes the NATS connection after flushing what needed to be sent

func (*Connection) Connect

func (conn *Connection) Connect(ctx context.Context) (err error)

Connect creates a new connection to NATS.

This will block until connected - basically forever should it never work. Due to shortcomings in the NATS library logging about failures is not optimal

func (*Connection) ConnectedServer

func (conn *Connection) ConnectedServer() string

ConnectedServer returns the URL of the current server that the library is connected to, passwords in the URL will be redacted, "unknown" when not initialized

func (*Connection) ConnectionOptions

func (conn *Connection) ConnectionOptions() nats.Options

func (*Connection) ConnectionStats

func (conn *Connection) ConnectionStats() nats.Statistics

func (*Connection) Flush

func (conn *Connection) Flush()

Flush sends any unpublished data to the network

func (*Connection) InboxPrefix added in v0.26.2

func (conn *Connection) InboxPrefix() string

InboxPrefix is the subject prefix used for replies

func (*Connection) IsConnected added in v0.13.0

func (conn *Connection) IsConnected() bool

IsConnected determines if we are connected to the network

func (*Connection) Nats

func (conn *Connection) Nats() *nats.Conn

func (*Connection) NodeDirectedTarget

func (conn *Connection) NodeDirectedTarget(collective string, identity string) string

func (*Connection) Publish

func (conn *Connection) Publish(msg inter.Message) error

Publish inspects a Message and publish it according to its Type

func (*Connection) PublishRaw

func (conn *Connection) PublishRaw(target string, data []byte) error

PublishRaw allows any data to be published to any target

func (*Connection) PublishRawMsg added in v0.23.0

func (conn *Connection) PublishRawMsg(msg *nats.Msg) error

PublishRawMsg allows any nats message to be published to any target

func (*Connection) QueueSubscribe

func (conn *Connection) QueueSubscribe(ctx context.Context, name string, subject string, group string, output chan inter.ConnectorMessage) error

QueueSubscribe is a lot like ChanQueueSubscribe but you provide it the queue to dump messages in, it also takes a context and will unsubscribe when the context is canceled

func (*Connection) ReplyTarget

func (conn *Connection) ReplyTarget(msg inter.Message) (string, error)

func (*Connection) RequestRawMsgWithContext added in v0.23.0

func (conn *Connection) RequestRawMsgWithContext(ctx context.Context, msg *nats.Msg) (*nats.Msg, error)

RequestRawMsgWithContext allows any nats message to be published as a request

func (*Connection) ServiceBroadcastTarget added in v0.22.0

func (conn *Connection) ServiceBroadcastTarget(collective string, agent string) string

func (*Connection) TargetForMessage

func (conn *Connection) TargetForMessage(msg inter.Message, identity string) (string, error)

func (*Connection) Unsubscribe

func (conn *Connection) Unsubscribe(name string) error

type ConnectorMessage

type ConnectorMessage struct {
	// contains filtered or unexported fields
}

func NewConnectorMessage added in v0.24.0

func NewConnectorMessage(subject string, reply string, data []byte, msg any) *ConnectorMessage

func (*ConnectorMessage) Data

func (m *ConnectorMessage) Data() []byte

func (*ConnectorMessage) Msg added in v0.19.0

func (m *ConnectorMessage) Msg() any

func (*ConnectorMessage) Reply

func (m *ConnectorMessage) Reply() string

func (*ConnectorMessage) Subject

func (m *ConnectorMessage) Subject() string

type Framework

type Framework struct {
	Config *config.Config
	// contains filtered or unexported fields
}

Framework is a utility encompassing choria config and various utilities

func New

func New(path string, opts ...Option) (*Framework, error)

New sets up a Choria with all its config loaded and so forth

func NewWithConfig

func NewWithConfig(cfg *config.Config, opts ...Option) (*Framework, error)

NewWithConfig creates a new instance of the framework with the supplied config instance

func (*Framework) BuildInfo

func (fw *Framework) BuildInfo() *build.Info

BuildInfo retrieves build information

func (*Framework) CallerID

func (fw *Framework) CallerID() string

CallerID determines the cert based callerid

func (*Framework) Certname

func (fw *Framework) Certname() string

Certname determines the choria certname

func (*Framework) ClientTLSConfig added in v0.21.0

func (fw *Framework) ClientTLSConfig() (*tls.Config, error)

ClientTLSConfig creates a TLS configuration for use by NATS, HTTPS, specifically configured for clients

func (*Framework) Colorize added in v0.19.0

func (fw *Framework) Colorize(c string, format string, a ...any) string

Colorize returns a string of either 'red', 'green' or 'yellow'. If the 'color' configuration is set to false then the string will have no color hints

func (*Framework) Configuration

func (fw *Framework) Configuration() *config.Config

Configuration returns the active configuration

func (*Framework) ConfigureProvisioning

func (fw *Framework) ConfigureProvisioning(ctx context.Context)

ConfigureProvisioning adjusts the active configuration to match the provisioning profile

func (*Framework) DDLResolvers added in v0.25.0

func (fw *Framework) DDLResolvers() ([]inter.DDLResolver, error)

func (*Framework) DisableTLSVerify

func (fw *Framework) DisableTLSVerify() bool

DisableTLSVerify indicates if the user whish to disable TLS verification

func (*Framework) Enroll

func (fw *Framework) Enroll(ctx context.Context, wait time.Duration, cb func(digest string, try int)) error

Enroll performs the tasks needed to join the security system, like create a new certificate, csr etc

func (*Framework) FacterCmd

func (fw *Framework) FacterCmd() string

FacterCmd finds the path to facter using first AIO path then a `which` like command

func (*Framework) FacterDomain

func (fw *Framework) FacterDomain() (string, error)

FacterDomain determines the machines domain by querying facter. Returns "" when unknown

func (*Framework) FacterFQDN

func (fw *Framework) FacterFQDN() (string, error)

FacterFQDN determines the machines fqdn by querying facter. Returns "" when unknown

func (*Framework) FacterStringFact

func (fw *Framework) FacterStringFact(fact string) (string, error)

FacterStringFact looks up a facter fact, returns "" when unknown

func (*Framework) FederationCollectives

func (fw *Framework) FederationCollectives() (collectives []string)

FederationCollectives determines the known Federation Member Collectives based on the CHORIA_FED_COLLECTIVE environment variable or the choria.federation.collectives config item

func (*Framework) FederationMiddlewareServers

func (fw *Framework) FederationMiddlewareServers() (servers srvcache.Servers, err error)

FederationMiddlewareServers determines the correct Federation Middleware Servers

It does this by:

  • looking for choria.federation_middleware_hosts configuration
  • Doing SRV lookups of _mcollective-federation_server._tcp and _x-puppet-mcollective_federation._tcp

func (*Framework) Getuid

func (fw *Framework) Getuid() int

Getuid returns the numeric user id of the caller

func (*Framework) GovernorSubject added in v0.23.0

func (fw *Framework) GovernorSubject(name string) string

GovernorSubject the subject to use for choria managed Governors

func (*Framework) HTTPClient added in v0.19.0

func (fw *Framework) HTTPClient(secure bool) (*http.Client, error)

HTTPClient creates a *http.Client prepared by the security provider with certificates and more set

func (*Framework) HasCollective

func (fw *Framework) HasCollective(collective string) bool

HasCollective determines if a collective is known in the configuration

func (*Framework) InProcessConnProvider added in v0.28.0

func (fw *Framework) InProcessConnProvider() nats.InProcessConnProvider

InProcessConnProvider provides an in-process connection for nats if configured using SetInProcessConnProvider(), nil when not set

func (*Framework) IsFederated

func (fw *Framework) IsFederated() (result bool)

IsFederated determines if the configuration is setting up any Federation collectives

func (*Framework) KV added in v0.23.0

func (fw *Framework) KV(ctx context.Context, conn inter.Connector, bucket string, create bool, opts ...kv.Option) (nats.KeyValue, error)

KV creates a connection to a key-value store and gives access to the connector

func (*Framework) KVWithConn added in v0.23.0

func (fw *Framework) KVWithConn(ctx context.Context, conn inter.Connector, bucket string, create bool, opts ...kv.Option) (nats.KeyValue, inter.Connector, error)

KVWithConn creates a connection to a key-value store and gives access to the connector

func (*Framework) Logger

func (fw *Framework) Logger(component string) *log.Entry

Logger creates a new logrus entry

func (*Framework) MiddlewareServers

func (fw *Framework) MiddlewareServers() (servers srvcache.Servers, err error)

MiddlewareServers determines the correct Middleware Servers

It does this by:

  • if ngs is configured and credentials are set and middleware_hosts are empty, use ngs
  • looking for choria.federation_middleware_hosts configuration
  • Doing SRV lookups of _mcollective-server._tcp and __x-puppet-mcollective._tcp
  • Defaulting to puppet:4222

func (*Framework) NetworkBrokerPeers

func (fw *Framework) NetworkBrokerPeers() (servers srvcache.Servers, err error)

NetworkBrokerPeers are peers in the broker cluster resolved from _mcollective-broker._tcp or from the plugin config

func (*Framework) NewConnector

func (fw *Framework) NewConnector(ctx context.Context, servers func() (srvcache.Servers, error), name string, logger *log.Entry) (inter.Connector, error)

NewConnector creates a new NATS connector

It will attempt to connect to the given servers and will keep trying till it manages to do so

func (*Framework) NewElection added in v0.25.0

func (fw *Framework) NewElection(ctx context.Context, conn inter.Connector, name string, imported bool, opts ...election.Option) (inter.Election, error)

NewElection establishes a new, named, leader election requiring a Choria Streams bucket called CHORIA_LEADER_ELECTION. This will create a new network connection per election, see NewElectionWithConn() to re-use an existing connection

func (*Framework) NewElectionWithConn added in v0.25.0

func (fw *Framework) NewElectionWithConn(ctx context.Context, conn inter.Connector, name string, imported bool, opts ...election.Option) (inter.Election, inter.Connector, error)

NewElectionWithConn establish a new, named, leader election requiring a Choria Streams bucket called CHORIA_LEADER_ELECTION.

func (*Framework) NewGovernor added in v0.26.2

func (fw *Framework) NewGovernor(ctx context.Context, name string, conn inter.Connector, opts ...governor.Option) (governor.Governor, inter.Connector, error)

NewGovernor creates a new governor client with its own connection when none is given

func (*Framework) NewGovernorManager added in v0.26.2

func (fw *Framework) NewGovernorManager(ctx context.Context, name string, limit uint64, maxAge time.Duration, replicas uint, update bool, conn inter.Connector, opts ...governor.Option) (governor.Manager, inter.Connector, error)

NewGovernorManager creates a new governor manager with its own connection when none is given

func (*Framework) NewMessage

func (fw *Framework) NewMessage(payload []byte, agent string, collective string, msgType string, request inter.Message) (msg inter.Message, err error)

NewMessage creates a new Message associated with this Choria instance

func (*Framework) NewMessageFromRequest added in v0.24.0

func (fw *Framework) NewMessageFromRequest(req protocol.Request, replyto string) (inter.Message, error)

func (*Framework) NewReply

func (fw *Framework) NewReply(request protocol.Request) (reply protocol.Reply, err error)

NewReply creates a new Reply, the version will match that of the given request

func (*Framework) NewReplyFromMessage

func (fw *Framework) NewReplyFromMessage(version protocol.ProtocolVersion, msg inter.Message) (rep protocol.Reply, err error)

NewReplyFromMessage creates a new Reply with the Message settings preloaded complying with a specific protocol version like protocol.ReplyV1

func (*Framework) NewReplyFromSecureReply

func (fw *Framework) NewReplyFromSecureReply(sr protocol.SecureReply) (reply protocol.Reply, err error)

NewReplyFromSecureReply creates a new Reply from the JSON payload of SecureReply, the version will match what is in the JSON payload

func (*Framework) NewReplyFromTransportJSON

func (fw *Framework) NewReplyFromTransportJSON(payload []byte, skipvalidate bool) (msg protocol.Reply, err error)

NewReplyFromTransportJSON creates a new Reply from a transport JSON

func (*Framework) NewReplyTransportForMessage

func (fw *Framework) NewReplyTransportForMessage(msg inter.Message, request protocol.Request) (protocol.TransportMessage, error)

NewReplyTransportForMessage creates a new Transport message based on a Message and the request its a reply to

The new transport message will have the same version as the request its based on

func (*Framework) NewRequest

func (fw *Framework) NewRequest(version protocol.ProtocolVersion, agent string, senderid string, callerid string, ttl int, requestid string, collective string) (request protocol.Request, err error)

NewRequest creates a new Request complying with a specific protocol version like protocol.RequestV1

func (*Framework) NewRequestFromMessage

func (fw *Framework) NewRequestFromMessage(version protocol.ProtocolVersion, msg inter.Message) (req protocol.Request, err error)

NewRequestFromMessage creates a new Request with the Message settings preloaded complying with a specific protocol version like protocol.RequestV1

func (*Framework) NewRequestFromSecureRequest

func (fw *Framework) NewRequestFromSecureRequest(sr protocol.SecureRequest) (request protocol.Request, err error)

NewRequestFromSecureRequest creates a new Request from a SecureRequest, the version will match what is in the JSON payload

func (*Framework) NewRequestFromTransportJSON

func (fw *Framework) NewRequestFromTransportJSON(payload []byte, skipvalidate bool) (msg protocol.Request, err error)

NewRequestFromTransportJSON creates a new Request from transport JSON

func (*Framework) NewRequestID

func (fw *Framework) NewRequestID() (string, error)

NewRequestID Creates a new RequestID

func (*Framework) NewRequestMessageFromTransportJSON

func (fw *Framework) NewRequestMessageFromTransportJSON(payload []byte) (inter.Message, error)

NewRequestMessageFromTransportJSON creates a Message from a Transport JSON that holds a Request

func (*Framework) NewRequestTransportForMessage

func (fw *Framework) NewRequestTransportForMessage(ctx context.Context, msg inter.Message, version protocol.ProtocolVersion) (protocol.TransportMessage, error)

NewRequestTransportForMessage creates a new versioned Transport message based on a Message

func (*Framework) NewSecureReply

func (fw *Framework) NewSecureReply(reply protocol.Reply) (secure protocol.SecureReply, err error)

NewSecureReply creates a new SecureReply with the given Reply message as payload

func (*Framework) NewSecureReplyFromTransport

func (fw *Framework) NewSecureReplyFromTransport(message protocol.TransportMessage, skipvalidate bool) (secure protocol.SecureReply, err error)

NewSecureReplyFromTransport creates a new SecureReply from the JSON payload of TransportMessage, the version SecureReply will be the same as the TransportMessage

func (*Framework) NewSecureRequest

func (fw *Framework) NewSecureRequest(ctx context.Context, request protocol.Request) (secure protocol.SecureRequest, err error)

NewSecureRequest creates a new SecureRequest with the given Request message as payload

func (*Framework) NewSecureRequestFromTransport

func (fw *Framework) NewSecureRequestFromTransport(message protocol.TransportMessage, skipvalidate bool) (secure protocol.SecureRequest, err error)

NewSecureRequestFromTransport creates a new SecureRequest from the JSON payload of TransportMessage, the version SecureRequest will be the same as the TransportMessage

func (*Framework) NewTransportForSecureReply

func (fw *Framework) NewTransportForSecureReply(reply protocol.SecureReply) (message protocol.TransportMessage, err error)

NewTransportForSecureReply creates a new TransportMessage with a SecureReply as payload. The Transport will be the same version as the SecureRequest

func (*Framework) NewTransportForSecureRequest

func (fw *Framework) NewTransportForSecureRequest(request protocol.SecureRequest) (message protocol.TransportMessage, err error)

NewTransportForSecureRequest creates a new TransportMessage with a SecureRequest as payload. The Transport will be the same version as the SecureRequest

func (*Framework) NewTransportFromJSON

func (fw *Framework) NewTransportFromJSON(data []byte) (message protocol.TransportMessage, err error)

NewTransportFromJSON creates a new TransportMessage from a JSON payload. The version will match what is in the payload

func (*Framework) NewTransportMessage

func (fw *Framework) NewTransportMessage(version protocol.ProtocolVersion) (message protocol.TransportMessage, err error)

NewTransportMessage creates a new TransportMessage complying with a specific protocol version like protocol.TransportV1

func (*Framework) OverrideCertname

func (fw *Framework) OverrideCertname() string

OverrideCertname indicates if the user wish to force a specific certname, empty when not

func (*Framework) PQLQuery added in v0.19.0

func (fw *Framework) PQLQuery(query string) ([]byte, error)

func (*Framework) PQLQueryCertNames added in v0.19.0

func (fw *Framework) PQLQueryCertNames(query string) ([]string, error)

func (*Framework) ProgressWidth added in v0.20.0

func (fw *Framework) ProgressWidth() int

ProgressWidth determines the width of the progress bar, when -1 there is not enough space for a progress bar

func (*Framework) PrometheusTextFileDir added in v0.15.0

func (fw *Framework) PrometheusTextFileDir() string

PrometheusTextFileDir is the configured directory where to write prometheus text file stats

func (*Framework) ProvisionMode

func (fw *Framework) ProvisionMode() bool

ProvisionMode determines if this instance is in provisioning mode if the setting `plugin.choria.server.provision` is set at all then the value of that is returned, else it the build time property ProvisionDefault is consulted

func (*Framework) ProvisioningServers

func (fw *Framework) ProvisioningServers(ctx context.Context) (srvcache.Servers, error)

ProvisioningServers determines the build time provisioning servers when it's unset or results in an empty server list this will return an error

func (*Framework) PublicCert added in v0.23.0

func (fw *Framework) PublicCert() (*x509.Certificate, error)

PublicCert is the parsed public certificate

func (*Framework) PuppetAIOCmd

func (fw *Framework) PuppetAIOCmd(command string, def string) string

PuppetAIOCmd looks up a command in the AIO paths, if it's not there it will try PATH and finally return a default if not in PATH

func (*Framework) PuppetDBServers added in v0.19.0

func (fw *Framework) PuppetDBServers() (servers srvcache.Servers, err error)

PuppetDBServers resolves the PuppetDB server based on configuration of _x-puppet-db._tcp

func (*Framework) PuppetSetting

func (fw *Framework) PuppetSetting(setting string) (string, error)

PuppetSetting retrieves a config setting by shelling out to puppet apply --configprint

func (*Framework) QuerySrvRecords

func (fw *Framework) QuerySrvRecords(records []string) (srvcache.Servers, error)

QuerySrvRecords looks for SRV records within the right domain either thanks to facter domain or the configured domain.

If the config disables SRV then a error is returned.

func (*Framework) RequestProtocol added in v0.26.2

func (fw *Framework) RequestProtocol() protocol.ProtocolVersion

RequestProtocol determines the protocol version to use based on security provider technology

func (*Framework) SecurityProvider added in v0.25.0

func (fw *Framework) SecurityProvider() string

SecurityProvider is the name of the active security provider

func (*Framework) SetInProcessConnProvider added in v0.28.0

func (fw *Framework) SetInProcessConnProvider(p nats.InProcessConnProvider)

SetInProcessConnProvider sets a nats.InProcessConnProvider to use, connector will make connections using that if set

func (*Framework) SetLogWriter added in v0.13.1

func (fw *Framework) SetLogWriter(out io.Writer)

func (*Framework) SetLogger added in v0.16.0

func (fw *Framework) SetLogger(logger *log.Logger)

SetLogger sets the logger to use

func (*Framework) SetupLogging

func (fw *Framework) SetupLogging(debug bool) (err error)

SetupLogging configures logging based on choria config directives currently only file and console behaviors are supported

func (*Framework) SignerSeedFile added in v0.25.0

func (fw *Framework) SignerSeedFile() (f string, err error)

SignerSeedFile is the path to the seed file for JWT auth TODO: we need to revisit the many ways to set a seed file here and try to come up with fewer options (1740)

func (*Framework) SignerToken added in v0.17.0

func (fw *Framework) SignerToken() (token string, expiry time.Time, err error)

SignerToken retrieves the token used for signing requests or connecting to the broker

func (*Framework) SignerTokenFile added in v0.25.0

func (fw *Framework) SignerTokenFile() (f string, err error)

SignerTokenFile is the path to the token file, supports clients and servers TODO: we need to revisit the many ways to set a token file here and try to come up with fewer options (1740)

func (*Framework) SupportsProvisioning added in v0.23.0

func (fw *Framework) SupportsProvisioning() bool

SupportsProvisioning determines if a node can auto provision

func (*Framework) TLSConfig

func (fw *Framework) TLSConfig() (*tls.Config, error)

TLSConfig creates a generic TLS configuration for use by NATS, HTTPS etc

func (*Framework) TrySrvLookup

func (fw *Framework) TrySrvLookup(names []string, defaultSrv srvcache.Server) (srvcache.Server, error)

TrySrvLookup will attempt to look up a series of names returning the first found if SRV lookups are disabled or nothing is found the default will be returned

func (*Framework) UniqueID

func (fw *Framework) UniqueID() string

UniqueID creates a new unique ID, usually a v4 uuid, if that fails a random string based ID is made

func (*Framework) UniqueIDFromUnverifiedToken added in v0.17.0

func (fw *Framework) UniqueIDFromUnverifiedToken() (id string, uid string, exp time.Time, token string, err error)

UniqueIDFromUnverifiedToken extracts the caller id or identity from a token, the token is not verified as we do not have the certificate

func (*Framework) ValidateSecurity

func (fw *Framework) ValidateSecurity() (errors []string, ok bool)

ValidateSecurity calls the security provider validation method and indicates if all dependencies are met for secure operation

type Option added in v0.27.0

type Option func(fw *Framework) error

func WithCustomRequestSigner added in v0.27.0

func WithCustomRequestSigner(s inter.RequestSigner) Option

WithCustomRequestSigner sets a custom request signer, generally only used in tests

Jump to

Keyboard shortcuts

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