limits

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: MIT Imports: 1 Imported by: 0

README

gin-limits

Build Status Go Report Card

Gin framework middleware that currently implements connections throttling through the use of limits.MaxConnections()

Usage/Example

Simply use the middleware with Gin.

package main

import (
    "net/http"
    "github.com/gin-gonic/gin"
    "github.com/mikeee/gin-limits"
)

func main() {
    r := gin.Default()
    r.Use(limits.MaxConnections(10))

    r.GET("/", func(c *gin.Context) {
        c.JSON(http.StatusOK, gin.H{
            "message": "hello world",
        })
    })

    r.Run(":8080")
}

Licence

This package is released under the MIT License as available in the LICENSE file

Documentation

Overview

limits is a gin middleware handler that allows for connection throttling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaxConnections

func MaxConnections(limit int) gin.HandlerFunc

MaxConnections creates an artificial limit on connections.

Types

This section is empty.

Jump to

Keyboard shortcuts

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