1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
package connlimit
import (
"github.com/vulcand/oxy/v2/utils"
)
// Option represents an option you can pass to New.
type Option func(l *ConnLimiter) error
// Logger defines the logger used by ConnLimiter.
func Logger(l utils.Logger) Option {
return func(cl *ConnLimiter) error {
cl.log = l
return nil
}
}
// Verbose additional debug information.
func Verbose(verbose bool) Option {
return func(cl *ConnLimiter) error {
cl.verbose = verbose
return nil
}
}
// ErrorHandler sets error handler of the server.
func ErrorHandler(h utils.ErrorHandler) Option {
return func(cl *ConnLimiter) error {
cl.errHandler = h
return nil
}
}
|