Documentation ¶
Index ¶
- func AuthServer(cfg *AuthServerConfig) zoox.Middleware
- func BasicAuth(realm string, credentials map[string]string) zoox.Middleware
- func BearerToken(tokens []string) zoox.Middleware
- func CORS(cfg ...*CorsConfig) zoox.Middleware
- func CacheControl(cfg *CacheControlConfig) zoox.Middleware
- func Gzip(cfg ...*GzipConfig) zoox.Middleware
- func HealthCheck(path ...string) zoox.Middleware
- func Jwt() 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 AuthServerConfig
- type CacheControlConfig
- type CacheControlItem
- type CorsConfig
- type GzipConfig
- type ProxyConfig
- type ProxyGroupRewrite
- type ProxyGroupRewrites
- type ProxyRewrite
- type ProxyRewriteRules
- type RateLimitConfig
- type RewriteConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthServer ¶ added in v1.8.10
func AuthServer(cfg *AuthServerConfig) zoox.Middleware
AuthServer is a middleware that authenticates via Auth Server.
func BasicAuth ¶
func BasicAuth(realm string, credentials map[string]string) zoox.Middleware
BasicAuth is a middleware that authenticates via Basic Auth.
func BearerToken ¶ added in v1.8.5
func BearerToken(tokens []string) zoox.Middleware
BearerToken is a middleware that authenticates via Bearer Token.
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 CacheControl ¶ added in v1.8.3
func CacheControl(cfg *CacheControlConfig) zoox.Middleware
CacheControl is a middleware that adds a "Cache-Control" header to the request.
func Gzip ¶ added in v1.3.0
func Gzip(cfg ...*GzipConfig) zoox.Middleware
Gzip is a gzip moddleware for zoox.
func HealthCheck ¶
func HealthCheck(path ...string) zoox.Middleware
HealthCheck is a middleware that checks the health of the application.
func Jwt ¶ added in v1.0.25
func Jwt() 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 AuthServerConfig ¶ added in v1.8.10
type AuthServerConfig struct {
Server string `json:"server"`
}
AuthServerConfig ...
type CacheControlConfig ¶ added in v1.8.3
type CacheControlConfig struct { Paths []string MaxAge time.Duration // Items []*CacheControlItem }
CacheControlConfig ...
type CacheControlItem ¶ added in v1.8.3
CacheControlItem ...
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 MaxAge int64 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 Rewrites ProxyGroupRewrites `yaml:"rewrites" json:"rewrites"` }
ProxyConfig is the config of proxy middlewares
type ProxyGroupRewrite ¶ added in v1.3.14
type ProxyGroupRewrite struct { Name string `yaml:"name" json:"name"` RegExp string `yaml:"regexp" json:"regexp"` Rewrite ProxyRewrite `yaml:"rewrite" json:"rewrite"` }
ProxyGroupRewrite is a group of proxy rewrites
type ProxyGroupRewrites ¶ added in v1.3.14
type ProxyGroupRewrites []ProxyGroupRewrite
ProxyGroupRewrites is a list of rewrite rules
type ProxyRewrite ¶ added in v1.2.9
type ProxyRewrite struct { Target string `yaml:"target" json:"target"` Rewrites ProxyRewriteRules `yaml:"rewrites" json:"rewrites"` }
ProxyRewrite ...
type ProxyRewriteRules ¶ added in v1.3.14
ProxyRewriteRules ...
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.