Documentation ¶
Index ¶
- Variables
- func NewRemoteSignedSecureRequest(ctx context.Context, request protocol.Request, security inter.SecurityProvider) (protocol.SecureRequest, error)
- func NewReply(request protocol.Request, sender string) (protocol.Reply, error)
- func NewReplyFromSecureReply(sr protocol.SecureReply) (protocol.Reply, error)
- func NewRequest(agent string, sender string, caller string, ttl int, id string, ...) (protocol.Request, error)
- func NewRequestFromSecureRequest(sr protocol.SecureRequest) (protocol.Request, error)
- func NewSecureReply(reply protocol.Reply, security inter.SecurityProvider) (protocol.SecureReply, error)
- func NewSecureReplyFromTransport(message protocol.TransportMessage, security inter.SecurityProvider, ...) (protocol.SecureReply, error)
- func NewSecureRequest(request protocol.Request, security inter.SecurityProvider) (protocol.SecureRequest, error)
- func NewSecureRequestFromTransport(message protocol.TransportMessage, security inter.SecurityProvider, ...) (protocol.SecureRequest, error)
- func NewTransportFromJSON(data []byte) (message protocol.TransportMessage, err error)
- func NewTransportMessage(sender string) (message protocol.TransportMessage, err error)
- type FederationTransportHeader
- type Reply
- func (r *Reply) Agent() string
- func (r *Reply) FederationReplyTo() (replyto string, federated bool)
- func (r *Reply) FederationRequestID() (id string, federated bool)
- func (r *Reply) FederationTargets() (targets []string, federated bool)
- func (r *Reply) IsFederated() bool
- func (r *Reply) IsValidJSON(data []byte) (err error)
- func (r *Reply) JSON() ([]byte, error)
- func (r *Reply) Message() (msg []byte)
- func (r *Reply) NetworkHops() [][3]string
- func (r *Reply) RecordNetworkHop(in string, processor string, out string)
- func (r *Reply) RequestID() string
- func (r *Reply) SenderID() string
- func (r *Reply) SetFederationReplyTo(reply string)
- func (r *Reply) SetFederationRequestID(id string)
- func (r *Reply) SetFederationTargets(targets []string)
- func (r *Reply) SetMessage(message []byte)
- func (r *Reply) SetUnfederated()
- func (r *Reply) Time() time.Time
- func (r *Reply) Version() protocol.ProtocolVersion
- type ReqEnvelope
- type Request
- func (r *Request) Agent() string
- func (r *Request) CallerID() string
- func (r *Request) CallerPublicData() string
- func (r *Request) Collective() string
- func (r *Request) FederationReplyTo() (replyTo string, federated bool)
- func (r *Request) FederationRequestID() (id string, federated bool)
- func (r *Request) FederationTargets() (targets []string, federated bool)
- func (r *Request) Filter() (filter *protocol.Filter, filtered bool)
- func (r *Request) IsFederated() bool
- func (r *Request) IsValidJSON(data []byte) error
- func (r *Request) JSON() ([]byte, error)
- func (r *Request) Message() []byte
- func (r *Request) NetworkHops() [][3]string
- func (r *Request) NewFilter() *protocol.Filter
- func (r *Request) RecordNetworkHop(in string, processor string, out string)
- func (r *Request) RequestID() string
- func (r *Request) SenderID() string
- func (r *Request) SetAgent(agent string)
- func (r *Request) SetCallerID(id string)
- func (r *Request) SetCollective(collective string)
- func (r *Request) SetFederationReplyTo(reply string)
- func (r *Request) SetFederationRequestID(id string)
- func (r *Request) SetFederationTargets(targets []string)
- func (r *Request) SetFilter(filter *protocol.Filter)
- func (r *Request) SetMessage(message []byte)
- func (r *Request) SetRequestID(id string)
- func (r *Request) SetTTL(ttl int)
- func (r *Request) SetUnfederated()
- func (r *Request) SignerPublicData() string
- func (r *Request) TTL() int
- func (r *Request) Time() time.Time
- func (r *Request) Version() protocol.ProtocolVersion
- type SecureReply
- type SecureRequest
- func (r *SecureRequest) CallerPublicData() string
- func (r *SecureRequest) IsValidJSON(data []byte) error
- func (r *SecureRequest) JSON() ([]byte, error)
- func (r *SecureRequest) Message() []byte
- func (r *SecureRequest) SetMessage(request protocol.Request) error
- func (r *SecureRequest) SetSigner(signer []byte) error
- func (r *SecureRequest) Valid() bool
- func (r *SecureRequest) Version() protocol.ProtocolVersion
- type TransportHeaders
- type TransportMessage
- func (m *TransportMessage) FederationReplyTo() (string, bool)
- func (m *TransportMessage) FederationRequestID() (string, bool)
- func (m *TransportMessage) FederationTargets() ([]string, bool)
- func (m *TransportMessage) IsFederated() bool
- func (m *TransportMessage) IsValidJSON(data []byte) error
- func (m *TransportMessage) JSON() ([]byte, error)
- func (m *TransportMessage) Message() ([]byte, error)
- func (m *TransportMessage) NetworkHops() [][3]string
- func (m *TransportMessage) RecordNetworkHop(in string, processor string, out string)
- func (m *TransportMessage) ReplyTo() string
- func (m *TransportMessage) SeenBy() [][3]string
- func (m *TransportMessage) SenderID() string
- func (m *TransportMessage) SetFederationReplyTo(reply string)
- func (m *TransportMessage) SetFederationRequestID(id string)
- func (m *TransportMessage) SetFederationTargets(targets []string)
- func (m *TransportMessage) SetReplyData(reply protocol.SecureReply) error
- func (m *TransportMessage) SetReplyTo(reply string)
- func (m *TransportMessage) SetRequestData(request protocol.SecureRequest) error
- func (m *TransportMessage) SetSender(sender string)
- func (m *TransportMessage) SetUnfederated()
- func (m *TransportMessage) Version() protocol.ProtocolVersion
Constants ¶
This section is empty.
Variables ¶
var (
ErrIncorrectProtocol = fmt.Errorf("version 2 protocol requires a ed25519+jwt based security system")
)
var (
ErrInvalidJSON = errors.New("supplied JSON document does not pass schema validation")
)
Functions ¶
func NewRemoteSignedSecureRequest ¶ added in v0.26.2
func NewRemoteSignedSecureRequest(ctx context.Context, request protocol.Request, security inter.SecurityProvider) (protocol.SecureRequest, error)
NewRemoteSignedSecureRequest is a NewSecureRequest that delegates the signing to a remote signer like aaasvc
func NewReplyFromSecureReply ¶ added in v0.26.2
func NewReplyFromSecureReply(sr protocol.SecureReply) (protocol.Reply, error)
NewReplyFromSecureReply create a choria:reply:1 based on the data contained in a SecureReply
func NewRequest ¶
func NewRequest(agent string, sender string, caller string, ttl int, id string, collective string) (protocol.Request, error)
NewRequest creates a io.choria.protocol.v2.request
func NewRequestFromSecureRequest ¶ added in v0.26.2
func NewRequestFromSecureRequest(sr protocol.SecureRequest) (protocol.Request, error)
NewRequestFromSecureRequest creates a io.choria.protocol.v2.request based on the data contained in a SecureRequest
func NewSecureReply ¶ added in v0.26.2
func NewSecureReply(reply protocol.Reply, security inter.SecurityProvider) (protocol.SecureReply, error)
NewSecureReply creates a io.choria.protocol.v2.secure_reply
func NewSecureReplyFromTransport ¶ added in v0.26.2
func NewSecureReplyFromTransport(message protocol.TransportMessage, security inter.SecurityProvider, skipvalidate bool) (protocol.SecureReply, error)
NewSecureReplyFromTransport creates a new io.choria.protocol.v2.secure_reply from the data contained in a Transport message
func NewSecureRequest ¶ added in v0.26.2
func NewSecureRequest(request protocol.Request, security inter.SecurityProvider) (protocol.SecureRequest, error)
NewSecureRequest creates a choria:secure:request:1
func NewSecureRequestFromTransport ¶ added in v0.26.2
func NewSecureRequestFromTransport(message protocol.TransportMessage, security inter.SecurityProvider, skipvalidate bool) (protocol.SecureRequest, error)
NewSecureRequestFromTransport creates a new choria:secure:request:1 from the data contained in a Transport message
func NewTransportFromJSON ¶ added in v0.26.2
func NewTransportFromJSON(data []byte) (message protocol.TransportMessage, err error)
NewTransportFromJSON creates a new TransportMessage from JSON
func NewTransportMessage ¶ added in v0.26.2
func NewTransportMessage(sender string) (message protocol.TransportMessage, err error)
NewTransportMessage creates a io.choria.protocol.v2.transport
Types ¶
type FederationTransportHeader ¶ added in v0.26.2
type FederationTransportHeader struct { // The request ID a federated message belongs to RequestID string `json:"request,omitempty"` // The original `reply` before federation ReplyTo string `json:"reply,omitempty"` // The identities who the federated message is for Targets []string `json:"targets,omitempty"` }
type Reply ¶ added in v0.26.2
type Reply struct { // The protocol version for this transport `io.choria.protocol.v2.reply` / protocol.ReplyV2 Protocol protocol.ProtocolVersion `json:"protocol"` // The arbitrary data contained in the reply - like a RPC reply MessageBody []byte `json:"message"` // The ID of the request this reply relates to Request string `json:"request"` // The host sending the reply Sender string `json:"sender"` // The agent the reply originates from SendingAgent string `json:"agent"` // The unix nano time the request was created TimeStamp int64 `json:"time"` // contains filtered or unexported fields }
func (*Reply) FederationReplyTo ¶ added in v0.26.2
FederationReplyTo retrieves the reply to string set by the federation broker
func (*Reply) FederationRequestID ¶ added in v0.26.2
FederationRequestID retrieves the federation specific requestid
func (*Reply) FederationTargets ¶ added in v0.26.2
FederationTargets retrieves the list of targets this message is destined for
func (*Reply) IsFederated ¶ added in v0.26.2
IsFederated determines if this message is federated
func (*Reply) IsValidJSON ¶ added in v0.26.2
IsValidJSON validates the given JSON data against the schema
func (*Reply) Message ¶ added in v0.26.2
Message retrieves the JSON encoded message set using SetMessage
func (*Reply) NetworkHops ¶ added in v0.26.2
NetworkHops returns a list of tuples this messaged traveled through
func (*Reply) RecordNetworkHop ¶ added in v0.26.2
RecordNetworkHop appends a hop onto the list of those who processed this message
func (*Reply) SetFederationReplyTo ¶ added in v0.26.2
SetFederationReplyTo stores the original reply-to destination in the federation headers
func (*Reply) SetFederationRequestID ¶ added in v0.26.2
SetFederationRequestID sets the request ID for federation purposes
func (*Reply) SetFederationTargets ¶ added in v0.26.2
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
SetMessage sets the data to be stored in the Reply
func (*Reply) SetUnfederated ¶ added in v0.26.2
func (r *Reply) SetUnfederated()
SetUnfederated removes any federation information from the message
func (*Reply) Version ¶ added in v0.26.2
func (r *Reply) Version() protocol.ProtocolVersion
Version retrieves the protocol version for this message
type ReqEnvelope ¶ added in v0.26.2
type ReqEnvelope struct { RequestID string `json:"id"` SenderID string `json:"sender"` CallerID string `json:"caller"` Collective string `json:"collective"` Agent string `json:"agent"` TTL int `json:"ttl"` Time int64 `json:"time"` Filter *protocol.Filter `json:"filter,omitempty"` // contains filtered or unexported fields }
type Request ¶ added in v0.26.2
type Request struct { Protocol protocol.ProtocolVersion `json:"protocol"` MessageBody []byte `json:"message"` ReqEnvelope // contains filtered or unexported fields }
func (*Request) CallerPublicData ¶ added in v0.27.0
CallerPublicData is the JWT validated by the Secure Request, only set when a request is created from a SecureRequest
func (*Request) Collective ¶ added in v0.26.2
Collective retrieves the name of the sub collective this message is aimed at
func (*Request) FederationReplyTo ¶ added in v0.26.2
FederationReplyTo retrieves the reply to string set by the federation broker
func (*Request) FederationRequestID ¶ added in v0.26.2
FederationRequestID retrieves the federation specific requestid
func (*Request) FederationTargets ¶ added in v0.26.2
FederationTargets retrieves the list of targets this message is destined for
func (*Request) Filter ¶ added in v0.26.2
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
IsFederated determines if this message is federated
func (*Request) IsValidJSON ¶ added in v0.26.2
IsValidJSON validates the given JSON data against the schema
func (*Request) NetworkHops ¶ added in v0.26.2
NetworkHops returns a list of tuples this messaged traveled through
func (*Request) RecordNetworkHop ¶ added in v0.26.2
RecordNetworkHop appends a hop onto the list of those who processed this message
func (*Request) SetCallerID ¶ added in v0.26.2
SetCallerID sets the caller id for this request
func (*Request) SetCollective ¶ added in v0.26.2
SetCollective sets the collective this request is directed at
func (*Request) SetFederationReplyTo ¶ added in v0.26.2
SetFederationReplyTo stores the original reply-to destination in the federation headers
func (*Request) SetFederationRequestID ¶ added in v0.26.2
SetFederationRequestID sets the request ID for federation purposes
func (*Request) SetFederationTargets ¶ added in v0.26.2
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
SetFilter sets and overwrites the filter for a message with a new one
func (*Request) SetMessage ¶ added in v0.26.2
SetMessage set the message body that's contained in this request
func (*Request) SetRequestID ¶ added in v0.26.2
SetRequestID sets the request ID 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
SignerPublicData is the JWT of the request signer validated by the Secure Request, only set when a request is created from a SecureRequest
func (*Request) Version ¶ added in v0.26.2
func (r *Request) Version() protocol.ProtocolVersion
Version retrieves the protocol version for this message
type SecureReply ¶ added in v0.26.2
type SecureReply struct { // The protocol version for this secure reply `io.choria.protocol.v2.secure_reply` / protocol.SecureReplyV2 Protocol protocol.ProtocolVersion `json:"protocol"` // The reply held in the Secure Request MessageBody []byte `json:"reply"` // A sha256 of the reply Hash string `json:"hash"` // A signature made using the ed25519 seed of the sender Signature []byte `json:"signature,omitempty"` // The JWT of the sending host SenderJWT string `json:"sender,omitempty"` // 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) error
func (*SecureReply) JSON ¶ added in v0.26.2
func (r *SecureReply) JSON() ([]byte, error)
func (*SecureReply) Message ¶ added in v0.26.2
func (r *SecureReply) Message() []byte
func (*SecureReply) SetMessage ¶ added in v0.26.2
func (r *SecureReply) SetMessage(reply protocol.Reply) error
func (*SecureReply) Valid ¶ added in v0.26.2
func (r *SecureReply) Valid() bool
func (*SecureReply) Version ¶ added in v0.26.2
func (r *SecureReply) Version() protocol.ProtocolVersion
type SecureRequest ¶ added in v0.26.2
type SecureRequest struct { // The protocol version for this secure request `io.choria.protocol.v2.secure_request` / protocol.SecureRequestV2 Protocol protocol.ProtocolVersion `json:"protocol"` // The request held in the Secure Request MessageBody []byte `json:"request"` // A signature made using the ed25519 seed of the caller or signer Signature []byte `json:"signature"` // The JWT of the caller CallerJWT string `json:"caller"` // The JWT of the delegated signer, present when the AAA server is used SignerJWT string `json:"signer,omitempty"` // contains filtered or unexported fields }
SecureRequest contains 1 serialized Request signed and with the related JWTs 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) error
func (*SecureRequest) JSON ¶ added in v0.26.2
func (r *SecureRequest) JSON() ([]byte, error)
func (*SecureRequest) Message ¶ added in v0.26.2
func (r *SecureRequest) Message() []byte
func (*SecureRequest) SetMessage ¶ added in v0.26.2
func (r *SecureRequest) SetMessage(request protocol.Request) error
func (*SecureRequest) SetSigner ¶ added in v0.27.0
func (r *SecureRequest) SetSigner(signer []byte) error
func (*SecureRequest) Valid ¶ added in v0.26.2
func (r *SecureRequest) Valid() bool
func (*SecureRequest) Version ¶ added in v0.26.2
func (r *SecureRequest) Version() protocol.ProtocolVersion
type TransportHeaders ¶ added in v0.26.2
type TransportHeaders struct { // A transport specific response channel for this message, used in requests ReplyTo string `json:"reply,omitempty"` // The host that sent this message Sender string `json:"sender,omitempty"` // A trace of host/broker pairs that the message traversed SeenBy [][3]string `json:"trace,omitempty"` // Headers to assist federation Federation *FederationTransportHeader `json:"federation,omitempty"` }
type TransportMessage ¶ added in v0.26.2
type TransportMessage struct { // The protocol version for this transport `io.choria.protocol.v2.transport` / protocol.TransportV2 Protocol protocol.ProtocolVersion `json:"protocol"` // The payload to be transport, a Secure Request or Secure Reply Data []byte `json:"data"` // Optional headers Headers *TransportHeaders `json:"headers,omitempty"` // contains filtered or unexported fields }
func (*TransportMessage) FederationReplyTo ¶ added in v0.26.2
func (m *TransportMessage) FederationReplyTo() (string, bool)
func (*TransportMessage) FederationRequestID ¶ added in v0.26.2
func (m *TransportMessage) FederationRequestID() (string, bool)
func (*TransportMessage) FederationTargets ¶ added in v0.26.2
func (m *TransportMessage) FederationTargets() ([]string, bool)
func (*TransportMessage) IsFederated ¶ added in v0.26.2
func (m *TransportMessage) IsFederated() bool
func (*TransportMessage) IsValidJSON ¶ added in v0.26.2
func (m *TransportMessage) IsValidJSON(data []byte) error
func (*TransportMessage) JSON ¶ added in v0.26.2
func (m *TransportMessage) JSON() ([]byte, error)
func (*TransportMessage) Message ¶ added in v0.26.2
func (m *TransportMessage) Message() ([]byte, error)
func (*TransportMessage) NetworkHops ¶ added in v0.26.2
func (m *TransportMessage) NetworkHops() [][3]string
func (*TransportMessage) RecordNetworkHop ¶ added in v0.26.2
func (m *TransportMessage) RecordNetworkHop(in string, processor string, out string)
func (*TransportMessage) ReplyTo ¶ added in v0.26.2
func (m *TransportMessage) ReplyTo() string
func (*TransportMessage) SeenBy ¶ added in v0.26.2
func (m *TransportMessage) SeenBy() [][3]string
func (*TransportMessage) SenderID ¶ added in v0.26.2
func (m *TransportMessage) SenderID() string
func (*TransportMessage) SetFederationReplyTo ¶ added in v0.26.2
func (m *TransportMessage) SetFederationReplyTo(reply string)
func (*TransportMessage) SetFederationRequestID ¶ added in v0.26.2
func (m *TransportMessage) SetFederationRequestID(id string)
func (*TransportMessage) SetFederationTargets ¶ added in v0.26.2
func (m *TransportMessage) SetFederationTargets(targets []string)
func (*TransportMessage) SetReplyData ¶ added in v0.26.2
func (m *TransportMessage) SetReplyData(reply protocol.SecureReply) error
func (*TransportMessage) SetReplyTo ¶ added in v0.26.2
func (m *TransportMessage) SetReplyTo(reply string)
func (*TransportMessage) SetRequestData ¶ added in v0.26.2
func (m *TransportMessage) SetRequestData(request protocol.SecureRequest) error
func (*TransportMessage) SetSender ¶ added in v0.26.2
func (m *TransportMessage) SetSender(sender string)
func (*TransportMessage) SetUnfederated ¶ added in v0.26.2
func (m *TransportMessage) SetUnfederated()
func (*TransportMessage) Version ¶ added in v0.26.2
func (m *TransportMessage) Version() protocol.ProtocolVersion