mailgun/vulcan — pull request #82 by horkhe (2014-11-25 02:18:18+00:00)
Title: Make tokenlimiter capable of getting rates from a request header

Ratelimiting middleware can be configured to retrieve Rates to be applied to requests. To do that one needs to pass a **ConfigMapper** function in an **Options** struct to the **NewTokenLimiterFromOptions**. The function should map an http request to a JSON string that configures token buckets for it. There can be configured several token buckets for a request. A request will be allowed by the middleware if all token bucket allow its consumption. The JSON token bucket config should look like this: `[{"PeriodSec": 1, "Average": 10, "Burst": 20}, {"PeriodSec": 60, "Average": 100}]