echo

package
v0.0.0-...-9537c91 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: MIT Imports: 3 Imported by: 0

README

echo

Echo middleware for rate limiting HTTP requests.

Five Minutes Tutorial

package main

import (
	"time"

	"github.com/labstack/echo"
	"github.com/wallstreetcn/tollbooth"
	tollbooth_echo "github.com/wallstreetcn/tollbooth/thirdparty/echo"
)

func main() {
	e := echo.New()

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

	e.GET("/", echo.HandlerFunc(func(c echo.Context) error {
		return c.String(200, "Hello, World!")
	}), tollbooth_echo.LimitHandler(limiter))

	e.Start(":4444")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LimitHandler

func LimitHandler(limiter *config.Limiter) echo.MiddlewareFunc

LimitHandler builds an API limit handler.

func LimitMiddleware

func LimitMiddleware(limiter *config.Limiter) echo.MiddlewareFunc

LimitMiddleware builds an API limit middleware for labstack echo framework

Types

This section is empty.

Jump to

Keyboard shortcuts

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