Help us shape the future of Go! Take the 2026 Go Developer Survey

validators

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageValidator

type MessageValidator interface {
	// Validate validates the message and returns true if the message is to be retained and false if it needs to be dropped
	Validate(msg message.Message) bool
}

MessageValidator validates the incoming message.

type SenderValidator

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

SenderValidator validates messages by sender ID

func NewSenderValidator

func NewSenderValidator(sender flow.Identifier) *SenderValidator

NewSenderValidator creates and returns a new SenderValidator for the given sender ID

func (*SenderValidator) Validate

func (sv *SenderValidator) Validate(msg message.Message) bool

Validate returns true if the message origin id is different from the sender ID.

type TargetValidator

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

TargetValidator filters out messages by target ID

func NewTargetValidator

func NewTargetValidator(log zerolog.Logger, target flow.Identifier) *TargetValidator

NewTargetValidator returns a new TargetValidator for the given target id

func (*TargetValidator) Validate

func (tv *TargetValidator) Validate(msg message.Message) bool

Validate returns true if the message is intended for the given target ID else it returns false

Jump to

Keyboard shortcuts

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