Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// MyPeerID is the peer ID of the host. Messages where From == MyPeerID will
// not be rate limited and will not be counted toward the global or per-peer
// limits.
MyPeerID peer.ID
// GlobalLimit is the maximum rate of messages per second across all peers.
GlobalLimit rate.Limit
// GlobalBurst is the maximum number of messages that can be received at once
// from all peers.
GlobalBurst int
// PerPeerLimit is the maximum rate of messages for each peer.
PerPeerLimit rate.Limit
// PerPeerBurst is the maximum number of messages that can be received at once
// from each peer.
PerPeerBurst int
// MaxMessageSize is the maximum size (in bytes) for a message. Any messages
// that exceed this size will be considered invalid.
MaxMessageSize int
}
Config is a set of configuration options for the validator.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator is a rate limiting pubsub validator that only allows messages to be sent at a certain rate.
func New ¶
New creates and returns a new rate limiting validator. BUG(albrow): New currently leaks goroutines due to a limitation of the caching library used under the hood.
Notes ¶
Bugs ¶
New currently leaks goroutines due to a limitation of the caching library used under the hood.
Click to show internal directories.
Click to hide internal directories.