docs(limiter/traffic): add doc comments, unit tests

This commit is contained in:
ginuerzh
2026-05-24 20:54:34 +08:00
parent e9372ea44a
commit dc99f4731f
12 changed files with 1511 additions and 3 deletions
+2
View File
@@ -14,6 +14,8 @@ type llimiter struct {
limiter *rate.Limiter
}
// NewLimiter creates a rate-based traffic Limiter with the given rate
// (bytes per second) and burst size.
func NewLimiter(r int) limiter.Limiter {
return &llimiter{
limiter: rate.NewLimiter(rate.Limit(r), r),