validator

package
v0.26.17-access-fix-dy... Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: AGPL-3.0 Imports: 12 Imported by: 1

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

type ValidatorData

type ValidatorData struct {
	Message *message.Message
	From    peer.ID
}

Jump to

Keyboard shortcuts

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