limit

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LimitCounter

type LimitCounter struct {
	// MaxConnections defines the maximum number of concurrent connections allowed.
	MaxConnections int32

	// CurrentConnections tracks the current number of active connections in the LimitCounter middleware.
	CurrentConnections int32
}

LimitCounter tracks the current number of active connections and limits them based on a specified maximum.

func NewLimitCounter

func NewLimitCounter(maxConnections int32) *LimitCounter

NewLimitCounter creates a new LimitCounter instance with the specified maximum number of concurrent connections.

func (*LimitCounter) Middleware

func (lc *LimitCounter) Middleware() gin.HandlerFunc

Middleware limits the number of concurrent connections handled by the server based on MaxConnections. It is context-aware and prioritizes certain types of requests.

Jump to

Keyboard shortcuts

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