Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFederationData(from Federable, to Federable)
- func IsSecure() bool
- type CompoundFilter
- type CompoundFilters
- 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() CompoundFilters
- 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, log Logger) bool
- func (f *Filter) MatchClassesFile(file 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) MatchRequest(request Request, agents []string, identity string, classesFile string, ...) bool
- type Logger
- type Reply
- type Request
- type SecureReply
- type SecureRequest
- 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
Types ¶
type CompoundFilter ¶
type CompoundFilter []map[string]interface{}
CompoundFilter is a mcollective compound filter
type CompoundFilters ¶
type CompoundFilters []CompoundFilter
CompoundFilters is a set of mcollective compound filters
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 CompoundFilters `json:"compound"` // contains filtered or unexported fields }
Filter is a MCollective 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 JSON string representing a valid mcollective compound filter as parsed by MCollective::Matcher.create_compound_callstack
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 ¶
func (f *Filter) CompoundFilters() 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 ¶ added in v1.4.0
MatchAgents determines if the filter would match a list of agents
func (*Filter) MatchClasses ¶ added in v1.4.0
MatchClasses determines if the filter would match against the list of classes
func (*Filter) MatchClassesFile ¶ added in v1.4.0
MatchClassesFile determines if the filter would match a list of classes
func (*Filter) MatchFacts ¶ added in v1.4.0
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 ¶ added in v1.4.0
MatchFactsFile determines if the filter would match a given set of facts found in a file
func (*Filter) MatchIdentity ¶ added in v1.4.0
MatchIdentity determines if the filter would match a given identity
type Logger ¶ added in v1.4.0
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 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