func NewExtractor(variable string) (SourceExtractor, error) {
	if variable == "client.ip" {
		return ExtractorFunc(extractClientIP), nil
	}
	if variable == "request.host" {
		return ExtractorFunc(extractHost), nil
	}
	if strings.HasPrefix(variable, "request.header.") {
		header := strings.TrimPrefix(variable, "request.header.")
		if len(header) == 0 {
			return nil, fmt.Errorf("wrong header: %s", header)
		}
		return makeHeaderExtractor(header), nil
	}
	return nil, fmt.Errorf("unsupported limiting variable: '%s'", variable)
}
NewExtractor creates a new SourceExtractor
package utils
import (
	"fmt"
	"net/http"
	"strings"
)
type SourceExtractor interface {
	Extract(req *http.Request) (token string, amount int64, err error)
}
type ExtractorFunc func(req *http.Request) (token string, amount int64, err error)
func (f ExtractorFunc) Extract(req *http.Request) (string, int64, error) {
	return f(req)
}
type ExtractSource func(req *http.Request)