echov5

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package echov5 provides rate limiting middleware for the Echo v5 web framework. It features IP spoofing protection with trusted proxy CIDR filtering and custom key extraction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractClientIP

func ExtractClientIP(c *echo.Context, trustedProxies []string) string

ExtractClientIP securely extracts the client's real IP address from an Echo v5 *echo.Context. Header values (X-Forwarded-For, X-Real-IP) are parsed only if RemoteAddr originates from a trusted proxy.

func New

func New(limiter *distlimit.Limiter, opts ...Option) echo.MiddlewareFunc

New returns an echo.MiddlewareFunc compatible with Echo v5, configured with the specified distlimit.Limiter and options.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config holds configuration parameters for the Echo v5 rate limit middleware.

type Option

type Option func(*Config)

Option configures functional parameters for the Echo v5 rate limit middleware.

func WithKeyFunc

func WithKeyFunc(fn func(c *echo.Context) string) Option

WithKeyFunc configures a custom key extraction function based on the Echo v5 *echo.Context.

func WithRouteLabeling added in v1.2.0

func WithRouteLabeling(enable bool) Option

WithRouteLabeling enables passing the Echo v5 route path pattern as the route label in telemetry events.

func WithTrustedProxies

func WithTrustedProxies(proxies []string) Option

WithTrustedProxies configures a list of trusted proxy IPs or CIDR networks for safely parsing X-Forwarded-For headers.

Jump to

Keyboard shortcuts

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