func WithLimiter(limiter core.Limiter) InterceptorOption {
	return func(cfg *interceptorConfig) {
		cfg.limiter = limiter
	}
}
WithLimiter sets the given limiter for the intercepted client.
package grpc
import (
	"context"
	"fmt"
	golangGrpc "google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"github.com/platinummonkey/go-concurrency-limits/core"
	"github.com/platinummonkey/go-concurrency-limits/limit"
	"github.com/platinummonkey/go-concurrency-limits/limiter"
	"github.com/platinummonkey/go-concurrency-limits/strategy"
)
type ResponseType int
const (
	ResponseTypeSuccess ResponseType = iota
	ResponseTypeIgnore
	ResponseTypeDropped
)
type LimitExceededResponseClassifier func(ctx context.Context, method string, req interface{}, l core.Limiter) (interface{}, codes.Code, error)
type ClientResponseClassifier func(ctx context.Context, method string, req, reply interface{}, err error) ResponseType
type ServerResponseClassifier func(
	ctx context.Context, req interface{}, info *golangGrpc.UnaryServerInfo, resp interface{}, err error,
) ResponseType
func defaultLimitExceededResponseClassifier(
	ctx context.Context,
	method string,
	req interface{},
	l core.Limiter,
) (interface{}, codes.Code, error) {
	return nil, codes.ResourceExhausted, fmt.Errorf("limit exceeded for limiter=%v", l)
}
func defaultClientResponseClassifier(
	ctx context.Context,
	method string,
	req interface{},
	reply interface{},
	err error,
) ResponseType {
	if err != nil {
		return ResponseTypeDropped
	}
	return ResponseTypeSuccess
}
func defaultServerResponseClassifier(
	ctx context.Context,
	req interface{},
	info *golangGrpc.UnaryServerInfo,
	resp interface{},
	err error,
) ResponseType {
	if err != nil {
		return ResponseTypeDropped
	}
	return ResponseTypeSuccess
}
type interceptorConfig struct {
	name                            string
	tags                            []string
	limiter                         core.Limiter
	limitExceededResponseClassifier LimitExceededResponseClassifier
	serverResponseClassifer         ServerResponseClassifier
	clientResponseClassifer         ClientResponseClassifier
}
type InterceptorOption func(*interceptorConfig)
func defaults(cfg *interceptorConfig) {
	name := cfg.name
	if name == "" {
		name = "default"
	}
	tags := cfg.tags
	if tags == nil {
		tags = make([]string, 0)
	}
	cfg.limiter, _ = limiter.NewDefaultLimiterWithDefaults(
		name,
		strategy.NewSimpleStrategy(1000),
		limit.NoopLimitLogger{},
		core.EmptyMetricRegistryInstance,
		tags...,
	)
	cfg.limitExceededResponseClassifier = defaultLimitExceededResponseClassifier
	cfg.clientResponseClassifer = defaultClientResponseClassifier
	cfg.serverResponseClassifer = defaultServerResponseClassifier
}
func WithName(name string) InterceptorOption {
	return func(cfg *interceptorConfig) {
		cfg.name = name
	}
}
func WithTags(tags []string) InterceptorOption {
	return func(cfg *interceptorConfig) {
		cfg.tags = tags
	}
}