File: options.go

package info (click to toggle)
golang-github-vulcand-oxy 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 728 kB
  • sloc: makefile: 14
file content (32 lines) | stat: -rw-r--r-- 647 bytes parent folder | download
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
	}
}