limiter

package
v0.0.0-...-622c2fc Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package limiter implements various rate limiting functions for login protection and API access limiting. It uses cache2go - https://github.com/muesli/cache2go library to limit 3d party dependencies, e.g redis. cache2go has an expiry functionallity so we do not have to store and handle how to expire stored failed logins

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiLimitReached

func ApiLimitReached(incomingIP string) bool

ApiLimitReached checks if the login limit is reached for a specific IP Return true if login attempts reached the limit, false otherwise.

func ApiRecordRequest

func ApiRecordRequest(incomingIP string) (currentRequests, requestsLimit int)

ApiRecordRequest records a new API request Returns the current requests and the request limit

func LoginLimitReached

func LoginLimitReached(incomingIP string) bool

LoginLimitReached checks if the login limit is reached for a specific IP Return true if login attempts reached the limit, false otherwise.

func RecordLoginAttempt

func RecordLoginAttempt(username string, incomingIP string) (bool, int, time.Time)

InspectLoginAttempt records and checks if a login limit has been reached Returns true if a limit has been reached, false otherwise and the remaining attetmps

Types

This section is empty.

Jump to

Keyboard shortcuts

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