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.
Click to show internal directories.
Click to hide internal directories.