Documentation
¶
Index ¶
- func CORSMiddleware(config types.ICORSConfigurer) types.Middleware
- func CsrfMiddleware(config types.ICsrfConfig) types.Middleware
- func HTTPSRedirectMiddleware() types.Middleware
- func JWTMiddleware(jwtConfig types.IJWTConfig) types.Middleware
- func LoggingMiddleware(logger *zap.Logger) func(http.Handler) http.Handler
- func RateLimiterMiddleware(rl types.IRateLimiter) types.Middleware
- func SanitizationMiddleware() types.Middleware
- type CORSConfig
- func (c *CORSConfig) AllowCredentials() bool
- func (c *CORSConfig) AllowedHeaders() []string
- func (c *CORSConfig) AllowedMethods() []string
- func (c *CORSConfig) AllowedOrigins() []string
- func (c *CORSConfig) SetAllowCredentials(allow bool)
- func (c *CORSConfig) SetAllowedHeaders(headers []string)
- func (c *CORSConfig) SetAllowedMethods(methods []string)
- func (c *CORSConfig) SetAllowedOrigins(origins []string)
- type CsrfConfig
- func (c *CsrfConfig) CookieDomain() string
- func (c *CsrfConfig) CookieHTTPOnly() bool
- func (c *CsrfConfig) CookieName() string
- func (c *CsrfConfig) CookiePath() string
- func (c *CsrfConfig) CookieSameSite() csrf.SameSiteMode
- func (c *CsrfConfig) CookieSecure() bool
- func (c *CsrfConfig) SecretKey() []byte
- func (c *CsrfConfig) SetCookieDomain(domain string)
- func (c *CsrfConfig) SetCookieHTTPOnly(httpOnly bool)
- func (c *CsrfConfig) SetCookieName(name string)
- func (c *CsrfConfig) SetCookiePath(path string)
- func (c *CsrfConfig) SetCookieSameSite(sameSite csrf.SameSiteMode)
- func (c *CsrfConfig) SetCookieSecure(secure bool)
- func (c *CsrfConfig) SetSecretKey(key []byte)
- func (c *CsrfConfig) SetTokenLookup(lookup string)
- func (c *CsrfConfig) TokenLookup() string
- type JWTConfig
- func (j *JWTConfig) Algorithms() []string
- func (j *JWTConfig) Audience() []string
- func (j *JWTConfig) Issuer() []string
- func (j *JWTConfig) Key() []byte
- func (j *JWTConfig) SetAlgorithms(algorithms []string)
- func (j *JWTConfig) SetAudience(audience []string)
- func (j *JWTConfig) SetIssuer(issuer []string)
- func (j *JWTConfig) SetKey(key string)
- type RateLimiter
- func (rl *RateLimiter) CleanupExpired()
- func (rl *RateLimiter) MaxRequests() int
- func (rl *RateLimiter) Mu() *sync.Mutex
- func (rl *RateLimiter) Requests() map[string]types.IRateRecord
- func (rl *RateLimiter) SetMaxRequests(maxRequests int)
- func (rl *RateLimiter) SetWindow(window time.Duration)
- func (rl *RateLimiter) Window() time.Duration
- type RateRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORSMiddleware ¶
func CORSMiddleware(config types.ICORSConfigurer) types.Middleware
func CsrfMiddleware ¶
func CsrfMiddleware(config types.ICsrfConfig) types.Middleware
func HTTPSRedirectMiddleware ¶
func HTTPSRedirectMiddleware() types.Middleware
func JWTMiddleware ¶
func JWTMiddleware(jwtConfig types.IJWTConfig) types.Middleware
func RateLimiterMiddleware ¶
func RateLimiterMiddleware(rl types.IRateLimiter) types.Middleware
func SanitizationMiddleware ¶
func SanitizationMiddleware() types.Middleware
Types ¶
type CORSConfig ¶
type CORSConfig struct {
// contains filtered or unexported fields
}
func NewCORSConfig ¶
func NewCORSConfig() *CORSConfig
func (*CORSConfig) AllowCredentials ¶
func (c *CORSConfig) AllowCredentials() bool
func (*CORSConfig) AllowedHeaders ¶
func (c *CORSConfig) AllowedHeaders() []string
func (*CORSConfig) AllowedMethods ¶
func (c *CORSConfig) AllowedMethods() []string
func (*CORSConfig) AllowedOrigins ¶
func (c *CORSConfig) AllowedOrigins() []string
func (*CORSConfig) SetAllowCredentials ¶
func (c *CORSConfig) SetAllowCredentials(allow bool)
func (*CORSConfig) SetAllowedHeaders ¶
func (c *CORSConfig) SetAllowedHeaders(headers []string)
func (*CORSConfig) SetAllowedMethods ¶
func (c *CORSConfig) SetAllowedMethods(methods []string)
func (*CORSConfig) SetAllowedOrigins ¶
func (c *CORSConfig) SetAllowedOrigins(origins []string)
type CsrfConfig ¶
type CsrfConfig struct {
// contains filtered or unexported fields
}
func NewCsrfConfig ¶
func NewCsrfConfig() *CsrfConfig
NewCsrfConfig crea una nueva configuración con valores por defecto
func (*CsrfConfig) CookieDomain ¶
func (c *CsrfConfig) CookieDomain() string
func (*CsrfConfig) CookieHTTPOnly ¶
func (c *CsrfConfig) CookieHTTPOnly() bool
func (*CsrfConfig) CookieName ¶
func (c *CsrfConfig) CookieName() string
func (*CsrfConfig) CookiePath ¶
func (c *CsrfConfig) CookiePath() string
func (*CsrfConfig) CookieSameSite ¶
func (c *CsrfConfig) CookieSameSite() csrf.SameSiteMode
func (*CsrfConfig) CookieSecure ¶
func (c *CsrfConfig) CookieSecure() bool
func (*CsrfConfig) SecretKey ¶
func (c *CsrfConfig) SecretKey() []byte
func (*CsrfConfig) SetCookieDomain ¶
func (c *CsrfConfig) SetCookieDomain(domain string)
func (*CsrfConfig) SetCookieHTTPOnly ¶
func (c *CsrfConfig) SetCookieHTTPOnly(httpOnly bool)
func (*CsrfConfig) SetCookieName ¶
func (c *CsrfConfig) SetCookieName(name string)
func (*CsrfConfig) SetCookiePath ¶
func (c *CsrfConfig) SetCookiePath(path string)
func (*CsrfConfig) SetCookieSameSite ¶
func (c *CsrfConfig) SetCookieSameSite(sameSite csrf.SameSiteMode)
func (*CsrfConfig) SetCookieSecure ¶
func (c *CsrfConfig) SetCookieSecure(secure bool)
func (*CsrfConfig) SetSecretKey ¶
func (c *CsrfConfig) SetSecretKey(key []byte)
func (*CsrfConfig) SetTokenLookup ¶
func (c *CsrfConfig) SetTokenLookup(lookup string)
func (*CsrfConfig) TokenLookup ¶
func (c *CsrfConfig) TokenLookup() string
type JWTConfig ¶
type JWTConfig struct {
// contains filtered or unexported fields
}
func NewJWTConfig ¶
func NewJWTConfig() *JWTConfig
func (*JWTConfig) Algorithms ¶
func (*JWTConfig) SetAlgorithms ¶
func (*JWTConfig) SetAudience ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter() *RateLimiter
func (*RateLimiter) CleanupExpired ¶
func (rl *RateLimiter) CleanupExpired()
func (*RateLimiter) MaxRequests ¶
func (rl *RateLimiter) MaxRequests() int
func (*RateLimiter) Mu ¶
func (rl *RateLimiter) Mu() *sync.Mutex
func (*RateLimiter) Requests ¶
func (rl *RateLimiter) Requests() map[string]types.IRateRecord
func (*RateLimiter) SetMaxRequests ¶
func (rl *RateLimiter) SetMaxRequests(maxRequests int)
func (*RateLimiter) SetWindow ¶
func (rl *RateLimiter) SetWindow(window time.Duration)
func (*RateLimiter) Window ¶
func (rl *RateLimiter) Window() time.Duration
type RateRecord ¶
type RateRecord struct {
// contains filtered or unexported fields
}
func (*RateRecord) Count ¶
func (rr *RateRecord) Count() int
func (*RateRecord) Increment ¶
func (r *RateRecord) Increment()
func (*RateRecord) ResetTime ¶
func (rr *RateRecord) ResetTime() time.Time
Click to show internal directories.
Click to hide internal directories.