github.com/koko1123/flow-go-1@v0.29.6/network/validator/validator.go (about) 1 package validator 2 3 import ( 4 "github.com/libp2p/go-libp2p/core/peer" 5 6 "github.com/koko1123/flow-go-1/network/p2p" 7 ) 8 9 // MessageValidator validates the given message with original sender `from` and returns an error if validation fails 10 // else upon successful validation it should return the decoded message type string. 11 // Note: contrarily to pubsub.ValidatorEx, the peerID parameter does not represent the bearer of the message, but its source. 12 type MessageValidator func(from peer.ID, msg interface{}) (string, error) 13 14 // PubSubMessageValidator validates the given message with original sender `from` and returns p2p.ValidationResult. 15 // Note: contrarily to pubsub.ValidatorEx, the peerID parameter does not represent the bearer of the message, but its source. 16 type PubSubMessageValidator func(from peer.ID, msg interface{}) p2p.ValidationResult