From a2223761bc63f523fcc0a1ea513f692ccc95ed77 Mon Sep 17 00:00:00 2001 From: Valentin Kuznetsov Date: Fri, 25 Mar 2022 15:03:51 -0400 Subject: [PATCH] Add WithWhiteList option --- options.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/options.go b/options.go index cfa13ea..bb493a1 100644 --- a/options.go +++ b/options.go @@ -62,3 +62,13 @@ func WithClientIPHeader(header string) Option { o.ClientIPHeader = header } } + +// WithWhiteList will configure the limiter to use list of provided +// exception keys (which may be IP addresses or custome header values). +// This list will be consulted at every request and if key will be found in +// WhiteList the limiter functionality will be skipped for that key. +func WithWhiteList(wlist []string) Option { + return func(o *Options) { + o.WhiteList = wlist + } +}