Documentation ¶
Index ¶
- func AgentBroadcastTarget(collective string, agent string) string
- func BuildInfo() *build.Info
- func ECDHKeyPair() (pri []byte, pub []byte, err error)
- func ECDHSharedSecret(localPrivate []byte, remotePub []byte) ([]byte, error)
- func ECDHSharedSecretString(localPrivate string, remotePub string) (string, error)
- func Ed24419Verify(pk ed25519.PublicKey, msg []byte, sig []byte) (bool, error)
- func Ed25519KeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)
- func Ed25519KeyPairFromSeed(seed []byte) (ed25519.PublicKey, ed25519.PrivateKey, error)
- func Ed25519KeyPairFromSeedFile(f string) (ed25519.PublicKey, ed25519.PrivateKey, error)
- func Ed25519KeyPairToFile(f string) (ed25519.PublicKey, ed25519.PrivateKey, error)
- func Ed25519Sign(pk ed25519.PrivateKey, msg []byte) ([]byte, error)
- func Ed25519SignWithSeedFile(f string, msg []byte) ([]byte, error)
- func FileExist(path string) bool
- func FileIsDir(path string) bool
- func FileIsRegular(path string) bool
- func Inbox(collective string, caller string) string
- func NewRequestID() (string, error)
- func NodeDirectedTarget(collective string, identity string) string
- func ParseDuration(dstr string) (dur time.Duration, err error)
- func ReplyTarget(msg inter.Message, requestid string) string
- func ServiceBroadcastTarget(collective string, agent string) string
- func TargetForMessage(msg inter.Message, identity string) (string, error)
- func UserConfig() string
- type Connection
- func (conn *Connection) AgentBroadcastTarget(collective string, agent string) string
- func (conn *Connection) ChanQueueSubscribe(name string, subject string, group string, capacity int) (chan inter.ConnectorMessage, error)
- func (conn *Connection) Close()
- func (conn *Connection) Connect(ctx context.Context) (err error)
- func (conn *Connection) ConnectedServer() string
- func (conn *Connection) ConnectionOptions() nats.Options
- func (conn *Connection) ConnectionStats() nats.Statistics
- func (conn *Connection) Flush()
- func (conn *Connection) InboxPrefix() string
- func (conn *Connection) IsConnected() bool
- func (conn *Connection) Nats() *nats.Conn
- func (conn *Connection) NodeDirectedTarget(collective string, identity string) string
- func (conn *Connection) Publish(msg inter.Message) error
- func (conn *Connection) PublishRaw(target string, data []byte) error
- func (conn *Connection) PublishRawMsg(msg *nats.Msg) error
- func (conn *Connection) QueueSubscribe(ctx context.Context, name string, subject string, group string, ...) error
- func (conn *Connection) ReplyTarget(msg inter.Message) (string, error)
- func (conn *Connection) RequestRawMsgWithContext(ctx context.Context, msg *nats.Msg) (*nats.Msg, error)
- func (conn *Connection) ServiceBroadcastTarget(collective string, agent string) string
- func (conn *Connection) TargetForMessage(msg inter.Message, identity string) (string, error)
- func (conn *Connection) Unsubscribe(name string) error
- type ConnectorMessage
- type Framework
- func (fw *Framework) BuildInfo() *build.Info
- func (fw *Framework) CallerID() string
- func (fw *Framework) Certname() string
- func (fw *Framework) ClientTLSConfig() (*tls.Config, error)
- func (fw *Framework) Colorize(c string, format string, a ...any) string
- func (fw *Framework) Configuration() *config.Config
- func (fw *Framework) ConfigureProvisioning(ctx context.Context)
- func (fw *Framework) DDLResolvers() ([]inter.DDLResolver, error)
- func (fw *Framework) DisableTLSVerify() bool
- func (fw *Framework) Enroll(ctx context.Context, wait time.Duration, cb func(digest string, try int)) error
- func (fw *Framework) FacterCmd() string
- func (fw *Framework) FacterDomain() (string, error)
- func (fw *Framework) FacterFQDN() (string, error)
- func (fw *Framework) FacterStringFact(fact string) (string, error)
- func (fw *Framework) FederationCollectives() (collectives []string)
- func (fw *Framework) FederationMiddlewareServers() (servers srvcache.Servers, err error)
- func (fw *Framework) Getuid() int
- func (fw *Framework) GovernorSubject(name string) string
- func (fw *Framework) HTTPClient(secure bool) (*http.Client, error)
- func (fw *Framework) HasCollective(collective string) bool
- func (fw *Framework) InProcessConnProvider() nats.InProcessConnProvider
- func (fw *Framework) IsFederated() (result bool)
- func (fw *Framework) KV(ctx context.Context, conn inter.Connector, bucket string, create bool, ...) (nats.KeyValue, error)
- func (fw *Framework) KVWithConn(ctx context.Context, conn inter.Connector, bucket string, create bool, ...) (nats.KeyValue, inter.Connector, error)
- func (fw *Framework) Logger(component string) *log.Entry
- func (fw *Framework) MiddlewareServers() (servers srvcache.Servers, err error)
- func (fw *Framework) NetworkBrokerPeers() (servers srvcache.Servers, err error)
- func (fw *Framework) NewConnector(ctx context.Context, servers func() (srvcache.Servers, error), name string, ...) (inter.Connector, error)
- func (fw *Framework) NewElection(ctx context.Context, conn inter.Connector, name string, imported bool, ...) (inter.Election, error)
- func (fw *Framework) NewElectionWithConn(ctx context.Context, conn inter.Connector, name string, imported bool, ...) (inter.Election, inter.Connector, error)
- func (fw *Framework) NewGovernor(ctx context.Context, name string, conn inter.Connector, ...) (governor.Governor, inter.Connector, error)
- func (fw *Framework) NewGovernorManager(ctx context.Context, name string, limit uint64, maxAge time.Duration, ...) (governor.Manager, inter.Connector, error)
- func (fw *Framework) NewMessage(payload []byte, agent string, collective string, msgType string, ...) (msg inter.Message, err error)
- func (fw *Framework) NewMessageFromRequest(req protocol.Request, replyto string) (inter.Message, error)
- func (fw *Framework) NewReply(request protocol.Request) (reply protocol.Reply, err error)
- func (fw *Framework) NewReplyFromMessage(version protocol.ProtocolVersion, msg inter.Message) (rep protocol.Reply, err error)
- func (fw *Framework) NewReplyFromSecureReply(sr protocol.SecureReply) (reply protocol.Reply, err error)
- func (fw *Framework) NewReplyFromTransportJSON(payload []byte, skipvalidate bool) (msg protocol.Reply, err error)
- func (fw *Framework) NewReplyTransportForMessage(msg inter.Message, request protocol.Request) (protocol.TransportMessage, error)
- func (fw *Framework) NewRequest(version protocol.ProtocolVersion, agent string, senderid string, ...) (request protocol.Request, err error)
- func (fw *Framework) NewRequestFromMessage(version protocol.ProtocolVersion, msg inter.Message) (req protocol.Request, err error)
- func (fw *Framework) NewRequestFromSecureRequest(sr protocol.SecureRequest) (request protocol.Request, err error)
- func (fw *Framework) NewRequestFromTransportJSON(payload []byte, skipvalidate bool) (msg protocol.Request, err error)
- func (fw *Framework) NewRequestID() (string, error)
- func (fw *Framework) NewRequestMessageFromTransportJSON(payload []byte) (inter.Message, error)
- func (fw *Framework) NewRequestTransportForMessage(ctx context.Context, msg inter.Message, version protocol.ProtocolVersion) (protocol.TransportMessage, error)
- func (fw *Framework) NewSecureReply(reply protocol.Reply) (secure protocol.SecureReply, err error)
- func (fw *Framework) NewSecureReplyFromTransport(message protocol.TransportMessage, skipvalidate bool) (secure protocol.SecureReply, err error)
- func (fw *Framework) NewSecureRequest(ctx context.Context, request protocol.Request) (secure protocol.SecureRequest, err error)
- func (fw *Framework) NewSecureRequestFromTransport(message protocol.TransportMessage, skipvalidate bool) (secure protocol.SecureRequest, err error)
- func (fw *Framework) NewTransportForSecureReply(reply protocol.SecureReply) (message protocol.TransportMessage, err error)
- func (fw *Framework) NewTransportForSecureRequest(request protocol.SecureRequest) (message protocol.TransportMessage, err error)
- func (fw *Framework) NewTransportFromJSON(data []byte) (message protocol.TransportMessage, err error)
- func (fw *Framework) NewTransportMessage(version protocol.ProtocolVersion) (message protocol.TransportMessage, err error)
- func (fw *Framework) OverrideCertname() string
- func (fw *Framework) PQLQuery(query string) ([]byte, error)
- func (fw *Framework) PQLQueryCertNames(query string) ([]string, error)
- func (fw *Framework) ProgressWidth() int
- func (fw *Framework) PrometheusTextFileDir() string
- func (fw *Framework) ProvisionMode() bool
- func (fw *Framework) ProvisioningServers(ctx context.Context) (srvcache.Servers, error)
- func (fw *Framework) PublicCert() (*x509.Certificate, error)
- func (fw *Framework) PuppetAIOCmd(command string, def string) string
- func (fw *Framework) PuppetDBServers() (servers srvcache.Servers, err error)
- func (fw *Framework) PuppetSetting(setting string) (string, error)
- func (fw *Framework) QuerySrvRecords(records []string) (srvcache.Servers, error)
- func (fw *Framework) RequestProtocol() protocol.ProtocolVersion
- func (fw *Framework) SecurityProvider() string
- func (fw *Framework) SetInProcessConnProvider(p nats.InProcessConnProvider)
- func (fw *Framework) SetLogWriter(out io.Writer)
- func (fw *Framework) SetLogger(logger *log.Logger)
- func (fw *Framework) SetupLogging(debug bool) (err error)
- func (fw *Framework) SignerSeedFile() (f string, err error)
- func (fw *Framework) SignerToken() (token string, expiry time.Time, err error)
- func (fw *Framework) SignerTokenFile() (f string, err error)
- func (fw *Framework) SupportsProvisioning() bool
- func (fw *Framework) TLSConfig() (*tls.Config, error)
- func (fw *Framework) TrySrvLookup(names []string, defaultSrv srvcache.Server) (srvcache.Server, error)
- func (fw *Framework) UniqueID() string
- func (fw *Framework) UniqueIDFromUnverifiedToken() (id string, uid string, exp time.Time, token string, err error)
- func (fw *Framework) ValidateSecurity() (errors []string, ok bool)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentBroadcastTarget ¶
func ECDHKeyPair ¶ added in v0.23.0
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
ECDHSharedSecret calculates a shared secret based on a local private key and a remote public key
func ECDHSharedSecretString ¶ added in v0.23.0
ECDHSharedSecretString creates a shared secret in string form that can be decoded using hex.DecodeString
func Ed24419Verify ¶ added in v0.26.2
func Ed25519KeyPair ¶ added in v0.25.0
func Ed25519KeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)
func Ed25519KeyPairFromSeed ¶ added in v0.25.0
func Ed25519KeyPairFromSeedFile ¶ added in v0.25.0
func Ed25519KeyPairToFile ¶ added in v0.25.0
func Ed25519Sign ¶ added in v0.25.0
func Ed25519Sign(pk ed25519.PrivateKey, msg []byte) ([]byte, error)
func Ed25519SignWithSeedFile ¶ added in v0.25.0
func FileIsRegular ¶ added in v0.15.0
FileIsRegular tests if a file is a regular file, no links, etc
func NewRequestID ¶
NewRequestID Creates a new v1 RequestID like random string. Here for backwards compat with older clients
func NodeDirectedTarget ¶
func ParseDuration ¶ added in v0.24.0
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 ServiceBroadcastTarget ¶ added in v0.22.0
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 (*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 ¶
Framework is a utility encompassing choria config and various utilities
func NewWithConfig ¶
NewWithConfig creates a new instance of the framework with the supplied config instance
func (*Framework) ClientTLSConfig ¶ added in v0.21.0
ClientTLSConfig creates a TLS configuration for use by NATS, HTTPS, specifically configured for clients
func (*Framework) Colorize ¶ added in v0.19.0
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 ¶
Configuration returns the active configuration
func (*Framework) ConfigureProvisioning ¶
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 ¶
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 ¶
FacterCmd finds the path to facter using first AIO path then a `which` like command
func (*Framework) FacterDomain ¶
FacterDomain determines the machines domain by querying facter. Returns "" when unknown
func (*Framework) FacterFQDN ¶
FacterFQDN determines the machines fqdn by querying facter. Returns "" when unknown
func (*Framework) FacterStringFact ¶
FacterStringFact looks up a facter fact, returns "" when unknown
func (*Framework) FederationCollectives ¶
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 ¶
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) GovernorSubject ¶ added in v0.23.0
GovernorSubject the subject to use for choria managed Governors
func (*Framework) HTTPClient ¶ added in v0.19.0
HTTPClient creates a *http.Client prepared by the security provider with certificates and more set
func (*Framework) HasCollective ¶
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 ¶
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) MiddlewareServers ¶
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 ¶
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 (*Framework) NewReply ¶
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 ¶
NewRequestID Creates a new RequestID
func (*Framework) NewRequestMessageFromTransportJSON ¶
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 ¶
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 ¶
OverrideCertname indicates if the user wish to force a specific certname, empty when not
func (*Framework) PQLQueryCertNames ¶ added in v0.19.0
func (*Framework) ProgressWidth ¶ added in v0.20.0
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
PrometheusTextFileDir is the configured directory where to write prometheus text file stats
func (*Framework) ProvisionMode ¶
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 ¶
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 ¶
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
PuppetDBServers resolves the PuppetDB server based on configuration of _x-puppet-db._tcp
func (*Framework) PuppetSetting ¶
PuppetSetting retrieves a config setting by shelling out to puppet apply --configprint
func (*Framework) QuerySrvRecords ¶
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
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 (*Framework) SetupLogging ¶
SetupLogging configures logging based on choria config directives currently only file and console behaviors are supported
func (*Framework) SignerSeedFile ¶ added in v0.25.0
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
SignerToken retrieves the token used for signing requests or connecting to the broker
func (*Framework) SignerTokenFile ¶ added in v0.25.0
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
SupportsProvisioning determines if a node can auto provision
func (*Framework) TLSConfig ¶
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 ¶
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 ¶
ValidateSecurity calls the security provider validation method and indicates if all dependencies are met for secure operation
type Option ¶ added in v0.27.0
func WithCustomRequestSigner ¶ added in v0.27.0
func WithCustomRequestSigner(s inter.RequestSigner) Option
WithCustomRequestSigner sets a custom request signer, generally only used in tests