mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-16 03:44:26 +00:00
24 lines
437 B
Go
24 lines
437 B
Go
package wsutil
|
|
|
|
import (
|
|
"time"
|
|
|
|
"golang.org/x/time/rate"
|
|
)
|
|
|
|
func NewSendLimiter() *rate.Limiter {
|
|
return rate.NewLimiter(rate.Every(time.Minute), 120)
|
|
}
|
|
|
|
func NewDialLimiter() *rate.Limiter {
|
|
return rate.NewLimiter(rate.Every(5*time.Second), 1)
|
|
}
|
|
|
|
func NewIdentityLimiter() *rate.Limiter {
|
|
return NewDialLimiter() // same
|
|
}
|
|
|
|
func NewGlobalIdentityLimiter() *rate.Limiter {
|
|
return rate.NewLimiter(rate.Every(24*time.Hour), 1000)
|
|
}
|