package
0.0.0-20231127154448-5c62fad6ef0c
Repository: https://github.com/winnersoftlab/echo.git
Documentation: pkg.go.dev

# Functions

AddTrailingSlash returns a root level (before router) middleware which adds a trailing slash to the request `URL#Path`.
AddTrailingSlashWithConfig returns an AddTrailingSlash middleware with config.
BasicAuth returns an BasicAuth middleware.
BasicAuthWithConfig returns an BasicAuth middleware with config.
BodyDump returns a BodyDump middleware.
BodyDumpWithConfig returns a BodyDump middleware with config.
BodyLimit returns a BodyLimit middleware.
BodyLimitWithConfig returns a BodyLimit middleware with config.
ContextTimeout returns a middleware which returns error (503 Service Unavailable error) to client when underlying method returns context.DeadlineExceeded error.
ContextTimeoutWithConfig returns a Timeout middleware with config.
CORS returns a Cross-Origin Resource Sharing (CORS) middleware.
CORSWithConfig returns a CORS middleware with config.
CreateExtractors creates ValuesExtractors from given lookups.
CSRF returns a Cross-Site Request Forgery (CSRF) middleware.
CSRFWithConfig returns a CSRF middleware with config.
Decompress decompresses request body based if content encoding type is set to "gzip" with default config.
DecompressWithConfig decompresses request body based if content encoding type is set to "gzip" with config.
DefaultSkipper returns false which processes the middleware.
Gzip returns a middleware which compresses HTTP response using gzip compression scheme.
GzipWithConfig return Gzip middleware with config.
HTTPSNonWWWRedirect redirects http requests to https non www.
HTTPSNonWWWRedirectWithConfig returns an HTTPSRedirect middleware with config.
HTTPSRedirect redirects http requests to https.
HTTPSRedirectWithConfig returns an HTTPSRedirect middleware with config.
HTTPSWWWRedirect redirects http requests to https www.
HTTPSWWWRedirectWithConfig returns an HTTPSRedirect middleware with config.
JWT returns a JSON Web Token (JWT) auth middleware.
JWTWithConfig returns a JWT auth middleware with config.
KeyAuth returns an KeyAuth middleware.
KeyAuthWithConfig returns an KeyAuth middleware with config.
Logger returns a middleware that logs HTTP requests.
LoggerWithConfig returns a Logger middleware with config.
MethodFromForm is a `MethodOverrideGetter` that gets overridden method from the form parameter.
MethodFromHeader is a `MethodOverrideGetter` that gets overridden method from the request header.
MethodFromQuery is a `MethodOverrideGetter` that gets overridden method from the query parameter.
MethodOverride returns a MethodOverride middleware.
MethodOverrideWithConfig returns a MethodOverride middleware with config.
NewRandomBalancer returns a random proxy balancer.
NewRateLimiterMemoryStore returns an instance of RateLimiterMemoryStore with the provided rate (as req/s).
NewRateLimiterMemoryStoreWithConfig returns an instance of RateLimiterMemoryStore with the provided configuration.
NewRoundRobinBalancer returns a round-robin proxy balancer.
NonWWWRedirect redirects www requests to non www.
NonWWWRedirectWithConfig returns an HTTPSRedirect middleware with config.
Proxy returns a Proxy middleware.
ProxyWithConfig returns a Proxy middleware with config.
RateLimiter returns a rate limiting middleware e := echo.New() limiterStore := middleware.NewRateLimiterMemoryStore(20) e.GET("/rate-limited", func(c echo.Context) error { return c.String(http.StatusOK, "test") }, RateLimiter(limiterStore)) */.
RateLimiterWithConfig returns a rate limiting middleware e := echo.New() config := middleware.RateLimiterConfig{ Skipper: DefaultSkipper, Store: middleware.NewRateLimiterMemoryStore( middleware.RateLimiterMemoryStoreConfig{Rate: 10, Burst: 30, ExpiresIn: 3 * time.Minute} ) IdentifierExtractor: func(ctx echo.Context) (string, error) { id := ctx.RealIP() return id, nil }, ErrorHandler: func(context echo.Context, err error) error { return context.JSON(http.StatusTooManyRequests, nil) }, DenyHandler: func(context echo.Context, identifier string) error { return context.JSON(http.StatusForbidden, nil) }, } e.GET("/rate-limited", func(c echo.Context) error { return c.String(http.StatusOK, "test") }, middleware.RateLimiterWithConfig(config)) */.
Recover returns a middleware which recovers from panics anywhere in the chain and handles the control to the centralized HTTPErrorHandler.
RecoverWithConfig returns a Recover middleware with config.
RemoveTrailingSlash returns a root level (before router) middleware which removes a trailing slash from the request URI.
RemoveTrailingSlashWithConfig returns a RemoveTrailingSlash middleware with config.
RequestID returns a X-Request-ID middleware.
RequestIDWithConfig returns a X-Request-ID middleware with config.
RequestLoggerWithConfig returns a RequestLogger middleware with config.
Rewrite returns a Rewrite middleware.
RewriteWithConfig returns a Rewrite middleware with config.
Secure returns a Secure middleware.
SecureWithConfig returns a Secure middleware with config.
Static returns a Static middleware to serves static content from the provided root directory.
StaticWithConfig returns a Static middleware with config.
Timeout returns a middleware which returns error (503 Service Unavailable error) to client immediately when handler call runs for longer than its time limit.
TimeoutWithConfig returns a Timeout middleware with config or panics on invalid configuration.
WWWRedirect redirects non www requests to www.
WWWRedirectWithConfig returns an HTTPSRedirect middleware with config.

# Constants

Algorithms.
GZIPEncoding content-encoding header if set to "gzip", decompress body contents.
StatusCodeContextCanceled is a custom HTTP status code for situations where a client unexpectedly closed the connection to the server.

# Variables

DefaultBasicAuthConfig is the default BasicAuth middleware config.
DefaultBodyDumpConfig is the default BodyDump middleware config.
DefaultBodyLimitConfig is the default BodyLimit middleware config.
DefaultCORSConfig is the default CORS middleware config.
DefaultCSRFConfig is the default CSRF middleware config.
DefaultDecompressConfig defines the config for decompress middleware.
DefaultGzipConfig is the default Gzip middleware config.
DefaultJWTConfig is the default JWT auth middleware config.
DefaultKeyAuthConfig is the default KeyAuth middleware config.
DefaultLoggerConfig is the default Logger middleware config.
DefaultMethodOverrideConfig is the default MethodOverride middleware config.
DefaultProxyConfig is the default Proxy middleware config.
DefaultRateLimiterConfig defines default values for RateLimiterConfig.
DefaultRateLimiterMemoryStoreConfig provides default configuration values for RateLimiterMemoryStore.
DefaultRecoverConfig is the default Recover middleware config.
DefaultRedirectConfig is the default Redirect middleware config.
DefaultRequestIDConfig is the default RequestID middleware config.
DefaultRewriteConfig is the default Rewrite middleware config.
DefaultSecureConfig is the default Secure middleware config.
DefaultStaticConfig is the default Static middleware config.
DefaultTimeoutConfig is the default Timeout middleware config.
DefaultTrailingSlashConfig is the default TrailingSlash middleware config.
ErrCSRFInvalid is returned when CSRF check fails.
ErrExtractorError denotes an error raised when extractor function is unsuccessful.
Errors.
Errors.
ErrRateLimitExceeded denotes an error raised when rate limit is exceeded.

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
ContextTimeoutConfig defines the config for ContextTimeout middleware.
No description provided by the author
No description provided by the author
No description provided by the author
DefaultGzipDecompressPool is the default implementation of Decompressor interface.
ErrKeyAuthMissing is error type when KeyAuth middleware is unable to extract value from lookups.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RateLimiterMemoryStoreConfig represents configuration for RateLimiterMemoryStore.
No description provided by the author
RedirectConfig defines the config for Redirect middleware.
No description provided by the author
RequestLoggerConfig is configuration for Request Logger middleware.
RequestLoggerValues contains extracted values from logger.
No description provided by the author
No description provided by the author
No description provided by the author
TimeoutConfig defines the config for Timeout middleware.
No description provided by the author
No description provided by the author

# Interfaces

Decompressor is used to get the sync.Pool used by the middleware to get Gzip readers.
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ValuesExtractor defines a function for extracting values (keys/tokens) from the given context.