Documentation ¶
Index ¶
- func CryptoRandBytes(size int) ([]byte, error)
- func CryptoRandInt(min, max int64) int64
- func MergeSeeds(one [][]byte, two [][]byte) [][]byte
- func RandInt(min, max int) int
- func ReadPost(r io.Reader, delim byte)
- func ShuffleBytes(slice [][]byte)
- func SliceDiff(one [][]byte, two [][]byte) [][]byte
- type Limiter
- type PeerLimiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CryptoRandBytes ¶
func CryptoRandInt ¶
func MergeSeeds ¶
func ShuffleBytes ¶
func ShuffleBytes(slice [][]byte)
Types ¶
type Limiter ¶
type Limiter struct { Throttle chan time.Time Ticker *time.Ticker // contains filtered or unexported fields }
func NewLimiter ¶
Return a new rate limiter. This is used to make sure that something like a requrest for instance does not run too many times. However, it does allow bursting. For example, it may refill at a rate of 3 tokens per minute, and have a burst of three. This means that if it has been running for more than a minute without being used then, it will be able to be used 3 times in rapid succession - no limiting will apply.
type PeerLimiter ¶
type PeerLimiter struct {
// contains filtered or unexported fields
}
Limits requests from peers
func (*PeerLimiter) Setup ¶
func (pl *PeerLimiter) Setup()
Click to show internal directories.
Click to hide internal directories.