Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFederationData(from Federable, to Federable)
- func IsRemoteSignerAgent(agent string) bool
- func IsSecure() bool
- type FactFilter
- type Federable
- type Filter
- func (f *Filter) AddAgentFilter(agent string)
- func (f *Filter) AddClassFilter(class string)
- func (f *Filter) AddCompoundFilter(query string) error
- func (f *Filter) AddFactFilter(fact string, operator string, value string) (err error)
- func (f *Filter) AddIdentityFilter(id string)
- func (f *Filter) AgentFilters() []string
- func (f *Filter) ClassFilters() []string
- func (f *Filter) CompoundFilters() [][]map[string]string
- func (f *Filter) Empty() bool
- func (f *Filter) FactFilters() [][3]string
- func (f *Filter) IdentityFilters() []string
- func (f *Filter) MatchAgents(knownAgents []string) bool
- func (f *Filter) MatchClasses(knownClasses []string, _ Logger) bool
- func (f *Filter) MatchClassesFile(file string, log Logger) bool
- func (f *Filter) MatchCompound(facts json.RawMessage, knownClasses []string, knownAgents []string, ...) bool
- func (f *Filter) MatchCompoundFiles(factsFile string, classesFile string, knownAgents []string, log Logger) bool
- func (f *Filter) MatchFacts(factsj json.RawMessage, log Logger) bool
- func (f *Filter) MatchFactsFile(file string, log Logger) bool
- func (f *Filter) MatchIdentity(ident string) bool
- func (f *Filter) MatchServerRequest(request Request, si ServerInfoSource, log Logger) bool
- type Logger
- type Reply
- type Request
- type SecureReply
- type SecureRequest
- type ServerInfoSource
- type TransportMessage
Constants ¶
const ( RequestV1 = "choria:request:1" ReplyV1 = "choria:reply:1" SecureRequestV1 = "choria:secure:request:1" SecureReplyV1 = "choria:secure:reply:1" TransportV1 = "choria:transport:1" )
Variables ¶
var ClientStrictValidation = false
ClientStrictValidation gives hints to the protocol implementations that a client does not wish to be fully validated, this is because validation can often be very slow so clients can elect to disable that.
It's not mandatory for a specific version of implementation of the protocol to do anything with this, so it's merely a hint
var Secure = "true"
Secure controls the signing and validations of certificates in the protocol
Functions ¶
func CopyFederationData ¶
CopyFederationData copies the Federation related data from one message to another
func IsRemoteSignerAgent ¶ added in v0.24.0
IsRemoteSignerAgent determines if agent is the standard remote signer
Types ¶
type FactFilter ¶
type FactFilter struct { Fact string `json:"fact"` Operator string `json:"operator"` Value string `json:"value"` }
FactFilter is how a fact match is represented to the Filter
type Federable ¶
type Federable interface { SetFederationRequestID(id string) SetFederationReplyTo(reply string) SetFederationTargets(targets []string) SetUnfederated() FederationRequestID() (string, bool) FederationReplyTo() (string, bool) FederationTargets() ([]string, bool) RecordNetworkHop(in string, processor string, out string) NetworkHops() [][3]string IsFederated() bool }
Federable is any kind of message that can carry federation headers
type Filter ¶
type Filter struct { Fact []FactFilter `json:"fact"` Class []string `json:"cf_class"` Agent []string `json:"agent"` Identity []string `json:"identity"` Compound [][]map[string]string `json:"compound"` // contains filtered or unexported fields }
Filter is a Choria filter
func (*Filter) AddAgentFilter ¶
AddAgentFilter appends a filter to the agent filters
func (*Filter) AddClassFilter ¶
AddClassFilter appends a filter to the class filters
func (*Filter) AddCompoundFilter ¶
AddCompoundFilter appends a filter to the compound filters, the filter should be a expr string representing a valid choria filter
func (*Filter) AddFactFilter ¶
AddFactFilter appends a filter to the fact filters
func (*Filter) AddIdentityFilter ¶
AddIdentityFilter appends a filter to the identity filters
func (*Filter) AgentFilters ¶
AgentFilters retrieve the list of agent filters
func (*Filter) ClassFilters ¶
ClassFilters retrieve the list of class filters
func (*Filter) CompoundFilters ¶
CompoundFilters retrieve the list of compound filters
func (*Filter) Empty ¶
Empty determines if a filter is empty - that is all its contained filter arrays are empty
func (*Filter) FactFilters ¶
FactFilters retrieve the list of fact filters
func (*Filter) IdentityFilters ¶
IdentityFilters retrieve the list of identity filters
func (*Filter) MatchAgents ¶
MatchAgents determines if the filter would match a list of agents
func (*Filter) MatchClasses ¶
MatchClasses determines if the filter would match against the list of classes
func (*Filter) MatchClassesFile ¶
MatchClassesFile determines if the filter would match a list of classes
func (*Filter) MatchCompound ¶ added in v0.19.0
func (f *Filter) MatchCompound(facts json.RawMessage, knownClasses []string, knownAgents []string, fm ddl.FuncMap, log Logger) bool
MatchCompound determines if the filter would match against classes, facts and agents using a expr expression
func (*Filter) MatchCompoundFiles ¶ added in v0.20.0
func (f *Filter) MatchCompoundFiles(factsFile string, classesFile string, knownAgents []string, log Logger) bool
MatchCompoundFiles determines if the filter would match against classes, facts and agents using a expr expression
func (*Filter) MatchFacts ¶
func (f *Filter) MatchFacts(factsj json.RawMessage, log Logger) bool
MatchFacts determines if the filter would match a given set of facts found in given JSON data
func (*Filter) MatchFactsFile ¶
MatchFactsFile determines if the filter would match a given set of facts found in a file
func (*Filter) MatchIdentity ¶
MatchIdentity determines if the filter would match a given identity
func (*Filter) MatchServerRequest ¶ added in v0.20.0
func (f *Filter) MatchServerRequest(request Request, si ServerInfoSource, log Logger) bool
type Logger ¶
type Logger interface { Warnf(format string, args ...interface{}) Debugf(format string, args ...interface{}) Errorf(format string, args ...interface{}) }
Logger provides logging facilities
type Reply ¶
type Reply interface { Federable SetMessage(message string) Message() string RequestID() string SenderID() string Agent() string Time() time.Time JSON() (string, error) Version() string IsValidJSON(data string) error }
Reply is a core MCollective Reply containing JSON serialized agent payload
type Request ¶
type Request interface { Federable SetMessage(message string) SetCallerID(id string) SetCollective(collective string) SetAgent(agent string) NewFilter() *Filter SetFilter(*Filter) SetRequestID(id string) SetTTL(ttl int) Message() string RequestID() string SenderID() string CallerID() string Collective() string Agent() string TTL() int Time() time.Time Filter() (*Filter, bool) JSON() (string, error) Version() string IsValidJSON(data string) error }
Request is a core MCollective Request containing JSON serialized agent payload
type SecureReply ¶
type SecureReply interface { SetMessage(reply Reply) error Valid() bool JSON() (string, error) Message() string Version() string IsValidJSON(data string) error }
SecureReply is a container for a Reply. It's the reply counter part of a SecureRequest but replies are not signed using cryptographic keys it's only hashed in transport
type SecureRequest ¶
type SecureRequest interface { SetMessage(request Request) error Valid() bool JSON() (string, error) Version() string IsValidJSON(data string) error Message() string }
SecureRequest is a container for the Request. It serializes and signs the payload using the private key so that the message cannot be tampered with in any way once created. Recipients of the message can unpack it and validate it using the certificate of the stated caller
Should a message have been tampered with this validation would fail, this effectively avoids man in the middle attacks and requestor spoofing
type ServerInfoSource ¶ added in v0.20.0
type TransportMessage ¶
type TransportMessage interface { Federable SetReplyData(reply SecureReply) error SetRequestData(request SecureRequest) error SetReplyTo(reply string) SetSender(sender string) ReplyTo() string SenderID() string SeenBy() [][3]string Message() (string, error) IsValidJSON(data string) error JSON() (string, error) Version() string }
TransportMessage is a container for SecureRequests and SecureReplies it has routing information required to construct the various middleware topic names and such, it's also Federation aware and can track reply to targets, who saw it etc