v1

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRemoteSignedSecureRequest

func NewRemoteSignedSecureRequest(ctx context.Context, request protocol.Request, security inter.SecurityProvider) (secure protocol.SecureRequest, err error)

NewRemoteSignedSecureRequest is a NewSecureRequest that delegates the signing to a remote signer like aaasvc

func NewReply

func NewReply(request protocol.Request, certname string) (rep protocol.Reply, err error)

NewReply creates a choria:reply:1 based on a previous Request

func NewReplyFromSecureReply

func NewReplyFromSecureReply(sr protocol.SecureReply) (rep protocol.Reply, err error)

NewReplyFromSecureReply create a choria:reply:1 based on the data contained in a SecureReply

func NewRequest

func NewRequest(agent string, senderid string, callerid string, ttl int, requestid string, collective string) (req protocol.Request, err error)

NewRequest creates a choria:request:1

func NewRequestFromSecureRequest

func NewRequestFromSecureRequest(sr protocol.SecureRequest) (protocol.Request, error)

NewRequestFromSecureRequest creates a choria::request:1 based on the data contained in a SecureRequest

func NewSecureReply

func NewSecureReply(reply protocol.Reply, security inter.SecurityProvider) (secure protocol.SecureReply, err error)

NewSecureReply creates a choria:secure:reply:1

func NewSecureReplyFromTransport

func NewSecureReplyFromTransport(message protocol.TransportMessage, security inter.SecurityProvider, skipvalidate bool) (secure protocol.SecureReply, err error)

NewSecureReplyFromTransport creates a new choria:secure:reply:1 from the data contained in a Transport message

func NewSecureRequest

func NewSecureRequest(request protocol.Request, security inter.SecurityProvider) (secure protocol.SecureRequest, err error)

NewSecureRequest creates a choria:secure:request:1

func NewSecureRequestFromTransport

func NewSecureRequestFromTransport(message protocol.TransportMessage, security inter.SecurityProvider, skipvalidate bool) (secure protocol.SecureRequest, err error)

NewSecureRequestFromTransport creates a new choria:secure:request:1 from the data contained in a Transport message

func NewTransportFromJSON

func NewTransportFromJSON(data []byte) (message protocol.TransportMessage, err error)

NewTransportFromJSON creates a new TransportMessage from JSON

func NewTransportMessage

func NewTransportMessage(certname string) (message protocol.TransportMessage, err error)

NewTransportMessage creates a choria:transport:1

Types

type FederationTransportHeader added in v0.26.2

type FederationTransportHeader struct {
	RequestID string   `json:"req,omitempty"`
	ReplyTo   string   `json:"reply-to,omitempty"`
	Targets   []string `json:"target,omitempty"`
}

type Reply added in v0.26.2

type Reply struct {
	Protocol    protocol.ProtocolVersion `json:"protocol"`
	MessageBody string                   `json:"message"`
	Envelope    *ReplyEnvelope           `json:"envelope"`
	// contains filtered or unexported fields
}

func (*Reply) Agent added in v0.26.2

func (r *Reply) Agent() string

Agent retrieves the agent name that sent this reply

func (*Reply) FederationReplyTo added in v0.26.2

func (r *Reply) FederationReplyTo() (replyto string, federated bool)

FederationReplyTo retrieves the reply to string set by the federation broker

func (*Reply) FederationRequestID added in v0.26.2

func (r *Reply) FederationRequestID() (id string, federated bool)

FederationRequestID retrieves the federation specific requestid

func (*Reply) FederationTargets added in v0.26.2

func (r *Reply) FederationTargets() (targets []string, federated bool)

FederationTargets retrieves the list of targets this message is destined for

func (*Reply) IsFederated added in v0.26.2

func (r *Reply) IsFederated() bool

IsFederated determines if this message is federated

func (*Reply) IsValidJSON added in v0.26.2

func (r *Reply) IsValidJSON(data []byte) (err error)

IsValidJSON validates the given JSON data against the schema

func (*Reply) JSON added in v0.26.2

func (r *Reply) JSON() ([]byte, error)

JSON creates a JSON encoded reply

func (*Reply) Message added in v0.26.2

func (r *Reply) Message() (msg []byte)

Message retrieves the JSON encoded message set using SetMessage

func (*Reply) NetworkHops added in v0.26.2

func (r *Reply) NetworkHops() [][3]string

NetworkHops returns a list of tuples this messaged traveled through

func (*Reply) RecordNetworkHop added in v0.26.2

func (r *Reply) RecordNetworkHop(in string, processor string, out string)

RecordNetworkHop appends a hop onto the list of those who processed this message

func (*Reply) RequestID added in v0.26.2

func (r *Reply) RequestID() string

RequestID retrieves the unique request id

func (*Reply) SenderID added in v0.26.2

func (r *Reply) SenderID() string

SenderID retrieves the identity of the sending node

func (*Reply) SetFederationReplyTo added in v0.26.2

func (r *Reply) SetFederationReplyTo(reply string)

SetFederationReplyTo stores the original reply-to destination in the federation headers

func (*Reply) SetFederationRequestID added in v0.26.2

func (r *Reply) SetFederationRequestID(id string)

SetFederationRequestID sets the request ID for federation purposes

func (*Reply) SetFederationTargets added in v0.26.2

func (r *Reply) SetFederationTargets(targets []string)

SetFederationTargets sets the list of hosts this message should go to.

Federation brokers will duplicate the message and send one for each target

func (*Reply) SetMessage added in v0.26.2

func (r *Reply) SetMessage(message []byte)

SetMessage sets the data to be stored in the Reply. It should be JSON encoded already.

func (*Reply) SetUnfederated added in v0.26.2

func (r *Reply) SetUnfederated()

SetUnfederated removes any federation information from the message

func (*Reply) Time added in v0.26.2

func (r *Reply) Time() time.Time

Time retrieves the time stamp that this message was made

func (*Reply) Version added in v0.26.2

func (r *Reply) Version() protocol.ProtocolVersion

Version retrieves the protocol version for this message

type ReplyEnvelope added in v0.26.2

type ReplyEnvelope struct {
	RequestID string `json:"requestid"`
	SenderID  string `json:"senderid"`
	Agent     string `json:"agent"`
	Time      int64  `json:"time"`
	// contains filtered or unexported fields
}

type Request added in v0.26.2

type Request struct {
	Protocol    protocol.ProtocolVersion `json:"protocol"`
	MessageBody string                   `json:"message"`
	Envelope    *RequestEnvelope         `json:"envelope"`
	// contains filtered or unexported fields
}

func (*Request) Agent added in v0.26.2

func (r *Request) Agent() string

Agent retrieves the agent name this message is for

func (*Request) CallerID added in v0.26.2

func (r *Request) CallerID() string

CallerID retrieves the caller id that sent the message

func (*Request) CallerPublicData added in v0.27.0

func (r *Request) CallerPublicData() string

CallerPublicData is not supported for version 1 messages and is always an empty string

func (*Request) Collective added in v0.26.2

func (r *Request) Collective() string

Collective retrieves the name of the sub collective this message is aimed at

func (*Request) FederationReplyTo added in v0.26.2

func (r *Request) FederationReplyTo() (replyto string, federated bool)

FederationReplyTo retrieves the reply to string set by the federation broker

func (*Request) FederationRequestID added in v0.26.2

func (r *Request) FederationRequestID() (id string, federated bool)

FederationRequestID retrieves the federation specific requestid

func (*Request) FederationTargets added in v0.26.2

func (r *Request) FederationTargets() (targets []string, federated bool)

FederationTargets retrieves the list of targets this message is destined for

func (*Request) Filter added in v0.26.2

func (r *Request) Filter() (filter *protocol.Filter, filtered bool)

Filter retrieves the filter for the message. The boolean is true when the filter is not empty

func (*Request) IsFederated added in v0.26.2

func (r *Request) IsFederated() bool

IsFederated determines if this message is federated

func (*Request) IsValidJSON added in v0.26.2

func (r *Request) IsValidJSON(data []byte) error

IsValidJSON validates the given JSON data against the schema

func (*Request) JSON added in v0.26.2

func (r *Request) JSON() ([]byte, error)

JSON creates a JSON encoded request

func (*Request) Message added in v0.26.2

func (r *Request) Message() []byte

Message retrieves the JSON encoded Message body

func (*Request) NetworkHops added in v0.26.2

func (r *Request) NetworkHops() [][3]string

NetworkHops returns a list of tuples this messaged traveled through

func (*Request) NewFilter added in v0.26.2

func (r *Request) NewFilter() *protocol.Filter

NewFilter creates a new empty filter and sets it

func (*Request) RecordNetworkHop added in v0.26.2

func (r *Request) RecordNetworkHop(in string, processor string, out string)

RecordNetworkHop appends a hop onto the list of those who processed this message

func (*Request) RequestID added in v0.26.2

func (r *Request) RequestID() string

RequestID retrieves the unique request ID

func (*Request) SenderID added in v0.26.2

func (r *Request) SenderID() string

SenderID retrieves the sender id that sent the message

func (*Request) SetAgent added in v0.26.2

func (r *Request) SetAgent(agent string)

SetAgent sets the agent this requires is created for

func (*Request) SetCallerID added in v0.26.2

func (r *Request) SetCallerID(id string)

SetCallerID sets the caller id for this request

func (*Request) SetCollective added in v0.26.2

func (r *Request) SetCollective(collective string)

SetCollective sets the collective this request is directed at

func (*Request) SetFederationReplyTo added in v0.26.2

func (r *Request) SetFederationReplyTo(reply string)

SetFederationReplyTo stores the original reply-to destination in the federation headers

func (*Request) SetFederationRequestID added in v0.26.2

func (r *Request) SetFederationRequestID(id string)

SetFederationRequestID sets the request ID for federation purposes

func (*Request) SetFederationTargets added in v0.26.2

func (r *Request) SetFederationTargets(targets []string)

SetFederationTargets sets the list of hosts this message should go to.

Federation brokers will duplicate the message and send one for each target

func (*Request) SetFilter added in v0.26.2

func (r *Request) SetFilter(filter *protocol.Filter)

SetFilter sets and overwrites the filter for a message with a new one

func (*Request) SetMessage added in v0.26.2

func (r *Request) SetMessage(message []byte)

SetMessage set the message body thats contained in this request. It should be JSON encoded text

func (*Request) SetRequestID added in v0.26.2

func (r *Request) SetRequestID(id string)

SetRequestID sets the request ID for this message

func (*Request) SetTTL added in v0.26.2

func (r *Request) SetTTL(ttl int)

SetTTL sets the validity period for this message

func (*Request) SetUnfederated added in v0.26.2

func (r *Request) SetUnfederated()

SetUnfederated removes any federation information from the message

func (*Request) SignerPublicData added in v0.27.0

func (r *Request) SignerPublicData() string

SignerPublicData is not supported for version 1 messages and is always an empty string

func (*Request) TTL added in v0.26.2

func (r *Request) TTL() int

TTL retrieves the maximum allow lifetime of this message

func (*Request) Time added in v0.26.2

func (r *Request) Time() time.Time

Time retrieves the time this message was first made

func (*Request) Version added in v0.26.2

func (r *Request) Version() protocol.ProtocolVersion

Version retrieves the protocol version for this message

type RequestEnvelope added in v0.26.2

type RequestEnvelope struct {
	RequestID  string           `json:"requestid"`
	SenderID   string           `json:"senderid"`
	CallerID   string           `json:"callerid"`
	Collective string           `json:"collective"`
	Agent      string           `json:"agent"`
	TTL        int              `json:"ttl"`
	Time       int64            `json:"time"`
	Filter     *protocol.Filter `json:"filter"`
	// contains filtered or unexported fields
}

type SecureReply added in v0.26.2

type SecureReply struct {
	Protocol    protocol.ProtocolVersion `json:"protocol"`
	MessageBody string                   `json:"message"`
	Hash        string                   `json:"hash"`
	// contains filtered or unexported fields
}

SecureReply contains 1 serialized Reply hashed

func (*SecureReply) IsValidJSON added in v0.26.2

func (r *SecureReply) IsValidJSON(data []byte) (err error)

IsValidJSON validates the given JSON data against the schema

func (*SecureReply) JSON added in v0.26.2

func (r *SecureReply) JSON() ([]byte, error)

JSON creates a JSON encoded reply

func (*SecureReply) Message added in v0.26.2

func (r *SecureReply) Message() []byte

Message retrieves the stored message content

func (*SecureReply) SetMessage added in v0.26.2

func (r *SecureReply) SetMessage(reply protocol.Reply) (err error)

SetMessage sets the message contained in the Reply and updates the hash

func (*SecureReply) Valid added in v0.26.2

func (r *SecureReply) Valid() bool

Valid validates the body of the message by comparing the recorded hash with the hash of the body

func (*SecureReply) Version added in v0.26.2

func (r *SecureReply) Version() protocol.ProtocolVersion

Version retrieves the protocol version for this message

type SecureRequest added in v0.26.2

type SecureRequest struct {
	Protocol          protocol.ProtocolVersion `json:"protocol"`
	MessageBody       string                   `json:"message"`
	Signature         string                   `json:"signature"`
	PublicCertificate string                   `json:"pubcert"`
	// contains filtered or unexported fields
}

SecureRequest contains 1 serialized Request signed and with the public cert attached

func (*SecureRequest) CallerPublicData added in v0.27.0

func (r *SecureRequest) CallerPublicData() string

func (*SecureRequest) IsValidJSON added in v0.26.2

func (r *SecureRequest) IsValidJSON(data []byte) (err error)

IsValidJSON validates the given JSON data against the schema

func (*SecureRequest) JSON added in v0.26.2

func (r *SecureRequest) JSON() ([]byte, error)

JSON creates a JSON encoded request

func (*SecureRequest) Message added in v0.26.2

func (r *SecureRequest) Message() []byte

Message retrieves the stored message. It will be a JSON encoded version of the request set via SetMessage

func (*SecureRequest) SetMessage added in v0.26.2

func (r *SecureRequest) SetMessage(request protocol.Request) (err error)

SetMessage sets the message contained in the Request and updates the signature

func (*SecureRequest) SetSigner added in v0.27.0

func (r *SecureRequest) SetSigner(_ []byte) error

func (*SecureRequest) Valid added in v0.26.2

func (r *SecureRequest) Valid() bool

Valid determines if the request is valid

func (*SecureRequest) Version added in v0.26.2

func (r *SecureRequest) Version() protocol.ProtocolVersion

Version retrieves the protocol version for this message

type TransportHeaders added in v0.26.2

type TransportHeaders struct {
	ReplyTo           string                     `json:"reply-to,omitempty"`
	MCollectiveSender string                     `json:"mc_sender,omitempty"`
	SeenBy            [][3]string                `json:"seen-by,omitempty"`
	Federation        *FederationTransportHeader `json:"federation,omitempty"`
}

type TransportMessage added in v0.26.2

type TransportMessage struct {
	Protocol protocol.ProtocolVersion `json:"protocol"`
	Data     []byte                   `json:"data"`
	Headers  *TransportHeaders        `json:"headers"`
	// contains filtered or unexported fields
}

func (*TransportMessage) FederationReplyTo added in v0.26.2

func (m *TransportMessage) FederationReplyTo() (replyto string, federated bool)

FederationReplyTo retrieves the reply to string set by the federation broker

func (*TransportMessage) FederationRequestID added in v0.26.2

func (m *TransportMessage) FederationRequestID() (id string, federated bool)

FederationRequestID retrieves the federation specific requestid

func (*TransportMessage) FederationTargets added in v0.26.2

func (m *TransportMessage) FederationTargets() (targets []string, federated bool)

FederationTargets retrieves the list of targets this message is destined for

func (*TransportMessage) IsFederated added in v0.26.2

func (m *TransportMessage) IsFederated() bool

IsFederated determines if this message is federated

func (*TransportMessage) IsValidJSON added in v0.26.2

func (m *TransportMessage) IsValidJSON(data []byte) error

IsValidJSON validates the given JSON data against the Transport schema

func (*TransportMessage) JSON added in v0.26.2

func (m *TransportMessage) JSON() ([]byte, error)

JSON creates a JSON encoded message

func (*TransportMessage) Message added in v0.26.2

func (m *TransportMessage) Message() (data []byte, err error)

Message retrieves the stored data

func (*TransportMessage) NetworkHops added in v0.26.2

func (m *TransportMessage) NetworkHops() [][3]string

NetworkHops returns a list of tuples this messaged traveled through

func (*TransportMessage) RecordNetworkHop added in v0.26.2

func (m *TransportMessage) RecordNetworkHop(in string, processor string, out string)

RecordNetworkHop appends a hop onto the list of those who processed this message

func (*TransportMessage) ReplyTo added in v0.26.2

func (m *TransportMessage) ReplyTo() string

ReplyTo retrieves the destination description where replies should go to

func (*TransportMessage) SeenBy added in v0.26.2

func (m *TransportMessage) SeenBy() [][3]string

SeenBy retrieves the list of end points that this messages passed thruogh

func (*TransportMessage) SenderID added in v0.26.2

func (m *TransportMessage) SenderID() string

SenderID retrieves the identity of the sending host

func (*TransportMessage) SetFederationReplyTo added in v0.26.2

func (m *TransportMessage) SetFederationReplyTo(reply string)

SetFederationReplyTo stores the original reply-to destination in the federation headers

func (*TransportMessage) SetFederationRequestID added in v0.26.2

func (m *TransportMessage) SetFederationRequestID(id string)

SetFederationRequestID sets the request ID for federation purposes

func (*TransportMessage) SetFederationTargets added in v0.26.2

func (m *TransportMessage) SetFederationTargets(targets []string)

SetFederationTargets sets the list of hosts this message should go to.

Federation brokers will duplicate the message and send one for each target

func (*TransportMessage) SetReplyData added in v0.26.2

func (m *TransportMessage) SetReplyData(reply protocol.SecureReply) error

SetReplyData extracts the JSON body from a SecureReply and stores it

func (*TransportMessage) SetReplyTo added in v0.26.2

func (m *TransportMessage) SetReplyTo(reply string)

SetReplyTo sets the reply-to targget

func (*TransportMessage) SetRequestData added in v0.26.2

func (m *TransportMessage) SetRequestData(request protocol.SecureRequest) error

SetRequestData extracts the JSON body from a SecureRequest and stores it

func (*TransportMessage) SetSender added in v0.26.2

func (m *TransportMessage) SetSender(sender string)

SetSender sets the "mc_sender" - typically the identity of the sending host

func (*TransportMessage) SetUnfederated added in v0.26.2

func (m *TransportMessage) SetUnfederated()

SetUnfederated removes any federation information from the message

func (*TransportMessage) Version added in v0.26.2

Version retrieves the protocol version for this message

Jump to

Keyboard shortcuts

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