validatorset

package
v0.0.0-...-0b85bb3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package validatorset offers a way to combine a set of libp2p.Validators into a single validator. The combined validator set only passes if *all* of its constituent validators pass.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set is a set of libp2p.Validators.

func New

func New() *Set

New creates a new validator set

func (*Set) Add

func (s *Set) Add(name string, validator pubsub.Validator)

Add adds a new validator to the set with the given name. The name is used in error messages.

func (*Set) Validate

func (s *Set) Validate(ctx context.Context, sender peer.ID, msg *pubsub.Message) bool

Validate validates the message. It returns true if all of the constituent validators in the set also return true. If one or more of them return false, Validate returns false.

Jump to

Keyboard shortcuts

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