tollbooth_iris

package
v0.0.0-...-1c10c5e Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2017 License: MIT Imports: 3 Imported by: 0

README

tollbooth_iris

Iris middleware for rate limiting HTTP requests.

Five Minutes Tutorial

package main

import (
    "time"

    "github.com/didip/tollbooth"
    "github.com/didip/tollbooth/thirdparty/tollbooth_iris"

    "github.com/kataras/iris"
    "github.com/kataras/iris/context"
)

func main() {
    app := iris.New()

    // Create a limiter struct.
    limiter := tollbooth.NewLimiter(1, time.Second)

    app.GET("/", tollbooth_iris.LimitHandler(limiter), func(ctx context.Context) {
        ctx.WriteString("Hello, world!")
    })

    app.Run(iris.Addr(":8080"))
}

Documentation

Overview

Package tollbooth_iris provides rate-limiting logic to Iris request handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LimitHandler

func LimitHandler(limiter *config.Limiter) context.Handler

LimitHandler is a middleware that performs rate-limiting given a "limiter" configuration.

Types

This section is empty.

Jump to

Keyboard shortcuts

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