ratelimit

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParser

NewParser creates a new ratelimit annotation parser

Types

type Config

type Config struct {
	// Connections indicates a limit with the number of connections per IP address
	Connections Zone `json:"connections"`
	// RPS indicates a limit with the number of connections per second
	RPS Zone `json:"rps"`

	RPM Zone `json:"rpm"`

	LimitRate int `json:"limit-rate"`

	LimitRateAfter int `json:"limit-rate-after"`

	Name string `json:"name"`

	ID string `json:"id"`

	Whitelist []string `json:"whitelist"`
}

Config returns rate limit configuration for an Ingress rule limiting the number of connections per IP address and/or connections per second. If you both annotations are specified in a single Ingress rule, RPS limits takes precedence

func (*Config) Equal

func (rt1 *Config) Equal(rt2 *Config) bool

Equal tests for equality between two RateLimit types

type Zone

type Zone struct {
	Name  string `json:"name"`
	Limit int    `json:"limit"`
	Burst int    `json:"burst"`
	// SharedSize amount of shared memory for the zone
	SharedSize int `json:"sharedSize"`
}

Zone returns information about the NGINX rate limit (limit_req_zone) http://nginx.org/en/docs/http/ngx_http_limit_req_module.html#limit_req_zone

func (*Zone) Equal

func (z1 *Zone) Equal(z2 *Zone) bool

Equal tests for equality between two Zone types

Jump to

Keyboard shortcuts

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