Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidPOWDifficultly is returned when the nonce of a message does not fulfill the PoW difficulty. ErrInvalidPOWDifficultly = errors.New("invalid PoW") // ErrMessageTooSmall is returned when the message does not contain enough data for the PoW. ErrMessageTooSmall = errors.New("message too small") )
var ErrInvalidSignature = fmt.Errorf("invalid signature")
ErrInvalidSignature is returned when a message contains an invalid signature.
var ErrReceivedDuplicateBytes = fmt.Errorf("received duplicate bytes")
ErrReceivedDuplicateBytes is returned when duplicated bytes are rejected.
Functions ¶
This section is empty.
Types ¶
type MessageSignatureFilter ¶
type MessageSignatureFilter struct {
// contains filtered or unexported fields
}
MessageSignatureFilter filters messages based on whether their signatures are valid.
func NewMessageSignatureFilter ¶
func NewMessageSignatureFilter() *MessageSignatureFilter
NewMessageSignatureFilter creates a new message signature filter.
func (*MessageSignatureFilter) Filter ¶
func (filter *MessageSignatureFilter) Filter(msg *message.Message, peer *peer.Peer)
Filter filters up on the given bytes and peer and calls the acceptance callback if the input passes or the rejection callback if the input is rejected.
type PowFilter ¶
type PowFilter struct {
// contains filtered or unexported fields
}
PowFilter is a message bytes filter validating the PoW nonce.
func NewPowFilter ¶
NewPowFilter creates a new PoW bytes filter.
func (*PowFilter) Filter ¶
Filter checks whether the given bytes pass the PoW validation and calls the corresponding callback.
type RecentlySeenBytesFilter ¶
type RecentlySeenBytesFilter struct {
// contains filtered or unexported fields
}
RecentlySeenBytesFilter filters so that bytes which were recently seen don't pass the filter.
func NewRecentlySeenBytesFilter ¶
func NewRecentlySeenBytesFilter() *RecentlySeenBytesFilter
NewRecentlySeenBytesFilter creates a new recently seen bytes filter.
func (*RecentlySeenBytesFilter) Filter ¶
func (filter *RecentlySeenBytesFilter) Filter(bytes []byte, peer *peer.Peer)
Filter filters up on the given bytes and peer and calls the acceptance callback if the input passes or the rejection callback if the input is rejected.