19 lines
298 B
Go
19 lines
298 B
Go
package limit
|
|
|
|
import "gitverse.ru/andoma/gin"
|
|
|
|
type Handler func(c *gin.Context, remoteAddr, CIDRs string) bool
|
|
|
|
type Limit struct {
|
|
handler Handler
|
|
}
|
|
|
|
type Option func(*Limit)
|
|
|
|
// WithHandler
|
|
func WithHandler(handler Handler) Option {
|
|
return func(limit *Limit) {
|
|
limit.handler = handler
|
|
}
|
|
}
|