Documentation ¶
Index ¶
- Variables
- type MessageSignatureFilter
- func (filter *MessageSignatureFilter) Filter(msg *message.Message, peer *peer.Peer)
- func (filter *MessageSignatureFilter) OnAccept(callback func(msg *message.Message, peer *peer.Peer))
- func (filter *MessageSignatureFilter) OnReject(callback func(msg *message.Message, err error, peer *peer.Peer))
- func (filter *MessageSignatureFilter) Shutdown()
- type PowFilter
- type RecentlySeenBytesFilter
- func (filter *RecentlySeenBytesFilter) Filter(bytes []byte, peer *peer.Peer)
- func (filter *RecentlySeenBytesFilter) OnAccept(callback func(bytes []byte, peer *peer.Peer))
- func (filter *RecentlySeenBytesFilter) OnReject(callback func(bytes []byte, err error, peer *peer.Peer))
- func (filter *RecentlySeenBytesFilter) Shutdown()
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)
func (*MessageSignatureFilter) OnAccept ¶
func (filter *MessageSignatureFilter) OnAccept(callback func(msg *message.Message, peer *peer.Peer))
func (*MessageSignatureFilter) Shutdown ¶
func (filter *MessageSignatureFilter) Shutdown()
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.
func (*PowFilter) OnAccept ¶
OnAccept registers the given callback as the acceptance function of the filter.
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)
func (*RecentlySeenBytesFilter) OnAccept ¶
func (filter *RecentlySeenBytesFilter) OnAccept(callback func(bytes []byte, peer *peer.Peer))
func (*RecentlySeenBytesFilter) OnReject ¶
func (filter *RecentlySeenBytesFilter) OnReject(callback func(bytes []byte, err error, peer *peer.Peer))
func (*RecentlySeenBytesFilter) Shutdown ¶
func (filter *RecentlySeenBytesFilter) Shutdown()