Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TopicValidator ¶
func TopicValidator(validators ...MessageValidator) pubsub.ValidatorEx
Types ¶
type MessageValidator ¶
type MessageValidator func(ctx context.Context, from peer.ID, msg *message.Message) pubsub.ValidationResult
MessageValidator validates the given message with original sender `from`. Note: contrarily to pubsub.ValidatorEx, the peerID parameter does not represent the bearer of the message, but its source.
func AuthorizedSenderValidator ¶ added in v0.26.0
func AuthorizedSenderValidator(log zerolog.Logger, channel network.Channel, getIdentity func(peer.ID) (*flow.Identity, bool)) MessageValidator
AuthorizedSenderValidator using the getIdentity func will check if the role of the sender is part of the authorized roles list for the channel being communicated on. A node is considered to be authorized to send a message if all of the following are true. 1. The node is authorized. 2. The message type is a known message type (can be decoded with cbor codec). 3. The authorized roles list for the channel contains the senders role. 4. The node is not ejected