quota

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package quota implement per IP address connection rate limiting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accept

func Accept(ip string) (allowed bool)

Check quota for the given IP address. Check will return true if the IP address is over its quota of connections else false.

func CacheBits

func CacheBits(ip string) uint64

CacheBits returns the current cache.attempts bits for debugging. It is best formatted with '%064b'.

func Config

func Config(c config.Config, timeSource func() time.Time)

Config sets up package configuration for settings that can't be constants. It should be called by main, only once, before anything else starts. Once the configuration is set it should be treated as immutable an not changed.

func Status

func Status()

Types

This section is empty.

Jump to

Keyboard shortcuts

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