protocol

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: Apache-2.0 Imports: 8 Imported by: 9

Documentation

Index

Constants

View Source
const (
	RequestV1       = "choria:request:1"
	ReplyV1         = "choria:reply:1"
	SecureRequestV1 = "choria:secure:request:1"
	SecureReplyV1   = "choria:secure:reply:1"
	TransportV1     = "choria:transport:1"
)

Variables

View Source
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

View Source
var Secure = "true"

Secure controls the signing and validations of certificates in the protocol

Functions

func CopyFederationData

func CopyFederationData(from Federable, to Federable)

CopyFederationData copies the Federation related data from one message to another

func IsSecure

func IsSecure() bool

IsSecure determines if this build will validate senders at protocol level

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 NewFilter

func NewFilter() *Filter

NewFilter creates a new empty filter

func (*Filter) AddAgentFilter

func (f *Filter) AddAgentFilter(agent string)

AddAgentFilter appends a filter to the agent filters

func (*Filter) AddClassFilter

func (f *Filter) AddClassFilter(class string)

AddClassFilter appends a filter to the class filters

func (*Filter) AddCompoundFilter

func (f *Filter) AddCompoundFilter(query string) error

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

func (f *Filter) AddFactFilter(fact string, operator string, value string) (err error)

AddFactFilter appends a filter to the fact filters

func (*Filter) AddIdentityFilter

func (f *Filter) AddIdentityFilter(id string)

AddIdentityFilter appends a filter to the identity filters

func (*Filter) AgentFilters

func (f *Filter) AgentFilters() []string

AgentFilters retrieve the list of agent filters

func (*Filter) ClassFilters

func (f *Filter) ClassFilters() []string

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

func (f *Filter) Empty() bool

Empty determines if a filter is empty - that is all its contained filter arrays are empty

func (*Filter) FactFilters

func (f *Filter) FactFilters() [][3]string

FactFilters retrieve the list of fact filters

func (*Filter) IdentityFilters

func (f *Filter) IdentityFilters() []string

IdentityFilters retrieve the list of identity filters

func (*Filter) MatchAgents added in v1.4.0

func (f *Filter) MatchAgents(knownAgents []string) bool

MatchAgents determines if the filter would match a list of agents

func (*Filter) MatchClasses added in v1.4.0

func (f *Filter) MatchClasses(knownClasses []string, log Logger) bool

MatchClasses determines if the filter would match against the list of classes

func (*Filter) MatchClassesFile added in v1.4.0

func (f *Filter) MatchClassesFile(file string, log Logger) bool

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

func (f *Filter) MatchFactsFile(file string, log Logger) bool

MatchFactsFile determines if the filter would match a given set of facts found in a file

func (*Filter) MatchIdentity added in v1.4.0

func (f *Filter) MatchIdentity(ident string) bool

MatchIdentity determines if the filter would match a given identity

func (*Filter) MatchRequest added in v1.4.0

func (f *Filter) MatchRequest(request Request, agents []string, identity string, classesFile string, factsFile string, log Logger) bool

MatchRequest determines if a request matches the filter

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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