router

package
v3.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package router provides several rate-limit routers.

The ratelimit package provides an efficient token bucket implementation. See http://en.wikipedia.org/wiki/Token_bucket for more details.

Index

Constants

View Source
const Namespace = "qos/ratelimit/router"

Namespace is the key to use to store and access the custom config data for the router

Variables

View Source
var (
	ErrNoExtraCfg    = errors.New("no extra config")
	ErrWrongExtraCfg = errors.New("wrong extra config")
)
View Source
var ZeroCfg = Config{}

ZeroCfg is the zero value for the Config struct

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxRate        float64
	Capacity       uint64
	Strategy       string
	ClientMaxRate  float64
	ClientCapacity uint64
	Key            string
}

Config is the custom config struct containing the params for the router middlewares

func ConfigGetter

func ConfigGetter(e config.ExtraConfig) (Config, error)

ConfigGetter parses the extra config for the rate adapter and returns a ZeroCfg and an error if something goes wrong.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL