Documentation ¶
Index ¶
- Variables
- func CopyFederationData(from Federable, to Federable)
- func IsRegistrationAgent(agent string) bool
- func IsRemoteSignerAgent(agent string) bool
- func IsSecure() bool
- func SchemaBytes(protocol ProtocolVersion) ([]byte, error)
- func SchemaValidate(protocol ProtocolVersion, data []byte) (valid bool, errors []string, err error)
- 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 ProtocolVersion
- type Reply
- type Request
- type SecureReply
- type SecureRequest
- type ServerInfoSource
- type TransportMessage
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSchemaUnknown indicates the schema could not be found ErrSchemaUnknown = errors.New("unknown schema") // ErrSchemaValidationFailed indicates that the validator failed to perform validation, perhaps due to invalid schema ErrSchemaValidationFailed = errors.New("validation failed") )
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 IsRegistrationAgent ¶ added in v0.25.0
IsRegistrationAgent determines if agent is the registration target agent
func IsRemoteSignerAgent ¶ added in v0.24.0
IsRemoteSignerAgent determines if agent is the standard remote signer
func IsSecure ¶
func IsSecure() bool
IsSecure determines if this build will validate senders at protocol level
func SchemaBytes ¶ added in v0.26.2
func SchemaBytes(protocol ProtocolVersion) ([]byte, error)
SchemaBytes returns the JSON schema matching a specific protocol definition like `ReplyV1`
func SchemaValidate ¶ added in v0.26.2
func SchemaValidate(protocol ProtocolVersion, data []byte) (valid bool, errors []string, err error)
SchemaValidate validates data against the JSON schema for protocol
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 an 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 an 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 an 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 ...any) Debugf(format string, args ...any) Errorf(format string, args ...any) }
Logger provides logging facilities
type ProtocolVersion ¶ added in v0.26.2
type ProtocolVersion string
ProtocolVersion defines known protocol versions
const ( RequestV1 ProtocolVersion = "choria:request:1" ReplyV1 ProtocolVersion = "choria:reply:1" SecureRequestV1 ProtocolVersion = "choria:secure:request:1" SecureReplyV1 ProtocolVersion = "choria:secure:reply:1" TransportV1 ProtocolVersion = "choria:transport:1" RequestV2 ProtocolVersion = "io.choria.protocol.v2.request" ReplyV2 ProtocolVersion = "io.choria.protocol.v2.reply" SecureRequestV2 ProtocolVersion = "io.choria.protocol.v2.secure_request" SecureReplyV2 ProtocolVersion = "io.choria.protocol.v2.secure_reply" TransportV2 ProtocolVersion = "io.choria.protocol.v2.transport" Unknown ProtocolVersion = "io.choria.protocol.unknown" RemoteSigningAgent = "aaa_signer" RegistrationAgent = "registration" )
func VersionFromJSON ¶ added in v0.26.2
func VersionFromJSON(data []byte) ProtocolVersion
func (ProtocolVersion) String ¶ added in v0.26.2
func (p ProtocolVersion) String() string
func (*ProtocolVersion) UnmarshalJSON ¶ added in v0.26.2
func (p *ProtocolVersion) UnmarshalJSON(data []byte) error
type Reply ¶
type Reply interface { Federable SetMessage(message []byte) Message() []byte RequestID() string SenderID() string Agent() string Time() time.Time JSON() ([]byte, error) Version() ProtocolVersion IsValidJSON(data []byte) error }
Reply is a core MCollective Reply containing JSON serialized agent payload
type Request ¶
type Request interface { Federable SetMessage(message []byte) SetCallerID(id string) SetCollective(collective string) SetAgent(agent string) NewFilter() *Filter SetFilter(*Filter) SetRequestID(id string) SetTTL(ttl int) Message() []byte RequestID() string SenderID() string CallerID() string CallerPublicData() string SignerPublicData() string Collective() string Agent() string TTL() int Time() time.Time Filter() (*Filter, bool) JSON() ([]byte, error) Version() ProtocolVersion IsValidJSON(data []byte) error }
Request is a core MCollective Request containing JSON serialized agent payload
type SecureReply ¶
type SecureReply interface { SetMessage(reply Reply) error Valid() bool JSON() ([]byte, error) Message() []byte Version() ProtocolVersion IsValidJSON(data []byte) error }
SecureReply is a container for a Reply. It's the reply counterpart 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 SetSigner(signer []byte) error Valid() bool JSON() ([]byte, error) Version() ProtocolVersion IsValidJSON(data []byte) error Message() []byte CallerPublicData() 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() ([]byte, error) IsValidJSON(data []byte) error JSON() ([]byte, error) Version() ProtocolVersion }
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