add conn limiter
This commit is contained in:
10
limiter/conn/limiter.go
Normal file
10
limiter/conn/limiter.go
Normal file
@ -0,0 +1,10 @@
|
||||
package conn
|
||||
|
||||
type Limiter interface {
|
||||
Allow(n int) bool
|
||||
Limit() int
|
||||
}
|
||||
|
||||
type ConnLimiter interface {
|
||||
Limiter(key string) Limiter
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package limiter
|
||||
package traffic
|
||||
|
||||
import "context"
|
||||
|
||||
@ -9,7 +9,7 @@ type Limiter interface {
|
||||
Limit() int
|
||||
}
|
||||
|
||||
type RateLimiter interface {
|
||||
type TrafficLimiter interface {
|
||||
In(key string) Limiter
|
||||
Out(key string) Limiter
|
||||
}
|
Reference in New Issue
Block a user