Documentation ¶
Index ¶
- func BasicAuth(realm string, credentials map[string]string) zoox.Middleware
- func CORS(cfg ...*CorsConfig) zoox.Middleware
- func Gzip(cfg ...*GzipConfig) zoox.Middleware
- func HealthCheck() zoox.Middleware
- func Jwt(secret string, algorithm ...string) zoox.Middleware
- func Logger() zoox.Middleware
- func Proxy(cfg *ProxyConfig) zoox.Middleware
- func RateLimit(cfg *RateLimitConfig) zoox.Middleware
- func RealIP() zoox.Middleware
- func Recovery() zoox.Middleware
- func RequestID() zoox.Middleware
- func Rewrite(cfg ...*RewriteConfig) zoox.Middleware
- func Timeout(timeout time.Duration) zoox.Middleware
- type CorsConfig
- type GzipConfig
- type ProxyConfig
- type ProxyRewrite
- type RateLimitConfig
- type RewriteConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicAuth ¶
func BasicAuth(realm string, credentials map[string]string) zoox.Middleware
BasicAuth is a middleware that authenticates via Basic Auth.
func CORS ¶ added in v1.0.20
func CORS(cfg ...*CorsConfig) zoox.Middleware
CORS is a middleware for handling CORS (Cross-Origin Resource Sharing)
func Gzip ¶ added in v1.3.0
func Gzip(cfg ...*GzipConfig) zoox.Middleware
Gzip is a gzip moddleware for zoox.
func HealthCheck ¶
func HealthCheck() zoox.Middleware
HealthCheck is a middleware that checks the health of the application.
func Jwt ¶ added in v1.0.25
func Jwt(secret string, algorithm ...string) zoox.Middleware
Jwt is a middleware that authenticates via JWT.
func Logger ¶
func Logger() zoox.Middleware
Logger is a middleware that logs the request as it goes through the handler.
func Proxy ¶ added in v1.2.9
func Proxy(cfg *ProxyConfig) zoox.Middleware
Proxy is a middleware that authenticates via Basic Auth.
func RateLimit ¶ added in v1.2.17
func RateLimit(cfg *RateLimitConfig) zoox.Middleware
RateLimit middleware for zoox
func RealIP ¶
func RealIP() zoox.Middleware
RealIP is a middleware that adds a "X-Real-IP" header to the request.
func RequestID ¶ added in v1.1.2
func RequestID() zoox.Middleware
RequestID is a middleware that adds a request ID to the context.
func Rewrite ¶ added in v1.0.20
func Rewrite(cfg ...*RewriteConfig) zoox.Middleware
Rewrite is a middleware that rewrites the request path.
Types ¶
type CorsConfig ¶ added in v1.0.20
type CorsConfig struct { IgnoreFunc func(ctx *zoox.Context) bool AllowOrigins []string AllowOriginFunc func(origin string) bool AllowMethods []string AllowHeaders []string AllowCredentials bool ExposeHeaders []string }
CorsConfig is the configuration for the CORS middleware.
func DefaultCorsConfig ¶ added in v1.0.20
func DefaultCorsConfig() *CorsConfig
DefaultCorsConfig is the default CORS configuration.
type GzipConfig ¶ added in v1.3.0
GzipConfig is the configuration for gzip middleware.
type ProxyConfig ¶ added in v1.2.9
type ProxyConfig struct {
Rewrites map[string]ProxyRewrite
}
ProxyConfig is the config of proxy middlewares
type ProxyRewrite ¶ added in v1.2.9
ProxyRewrite ...
type RateLimitConfig ¶ added in v1.2.17
type RateLimitConfig struct { Period time.Duration Limit int64 // Namespace string // RedisHost string RedisPort int RedisDB int RedisPassword string }
RateLimitConfig ...
type RewriteConfig ¶ added in v1.0.20
RewriteConfig is the configuration for the Rewrite middleware.