tollbooth_gin

package
v0.0.0-...-605330a Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2016 License: MIT Imports: 3 Imported by: 0

README

tollbooth_gin

Gin middleware for rate limiting HTTP requests.

Five Minutes Tutorial

package main

import (
    "github.com/didip/tollbooth"
    "github.com/didip/tollbooth/thirdparty/tollbooth_gin"
    "github.com/gin-gonic/gin"
    "time"
)

func main() {
    r := gin.New()

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

    r.GET("/", tollbooth_gin.LimitHandler(limiter), func(c *gin.Context) {
        c.String(200, "Hello, world!")
    })

    r.Run(":12345")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LimitHandler

func LimitHandler(limiter *config.Limiter) gin.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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