Documentation ¶
Index ¶
- Variables
- func CORS(config ...CORSConfig) raptor.MiddlewareFunc
- func CSRF(config ...CSRFConfig) raptor.MiddlewareFunc
- func DefaultSkipper(*raptor.Context) bool
- func Recover(config ...SecureConfig) raptor.MiddlewareFunc
- func Secure(config ...SecureConfig) raptor.MiddlewareFunc
- type CORSConfig
- type CSRFConfig
- type RecoverConfig
- type SecureConfig
- type Skipper
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultCORSConfig is the default CORS middleware config. DefaultCORSConfig = CORSConfig{ Skipper: DefaultSkipper, AllowOrigins: []string{"*"}, AllowMethods: []string{raptor.HEAD, raptor.GET, raptor.POST, raptor.PUT, raptor.PATCH, raptor.DELETE}, AllowHeaders: []string{raptor.HeaderOrigin, raptor.HeaderAccept, raptor.HeaderContentType, raptor.HeaderAuthorization, raptor.HeaderContentLength, raptor.HeaderAcceptCharset, "X-Requested-With"}, ExposeHeaders: []string{raptor.HeaderContentDisposition}, } )
View Source
var ( // DefaultCSRFConfig : DefaultCSRFConfig = CSRFConfig{ Skipper: DefaultSkipper, } )
View Source
var ( DefaultSecureConfig = SecureConfig{ Skipper: DefaultSkipper, XSSProtection: "1; mode=block", ContentTypeNosniff: "nosniff", XFrameOptions: "SAMEORIGIN", } )
DefaultSecureConfig :
Functions ¶
Types ¶
type CORSConfig ¶
type CORSConfig struct { Skipper Skipper AllowOrigins []string `yaml:"allow_origins"` AllowMethods []string `yaml:"allow_methods"` AllowHeaders []string `yaml:"allow_headers"` AllowCredentials bool `yaml:"allow_credentials"` ExposeHeaders []string `yaml:"expose_headers"` MaxAge int `yaml:"max_age"` }
CORSConfig :
type CSRFConfig ¶
type CSRFConfig struct { Skipper Skipper TokenLength uint8 `yaml:"token_length"` TokenLookup string `yaml:"token_lookup"` ContextKey string `yaml:"context_key"` Cookie *fasthttp.Cookie }
CSRFConfig :
type SecureConfig ¶
type SecureConfig struct { Skipper Skipper XSSProtection string `yaml:"xss_protection"` ContentTypeNosniff string `yaml:"content_type_nosniff"` XFrameOptions string `yaml:"x_frame_options"` HSTSMaxAge int `yaml:"hsts_max_age"` HSTSExcludeSubdomains bool `yaml:"hsts_exclude_subdomains"` ContentSecurityPolicy string `yaml:"content_security_policy"` }
SecureConfig :
Click to show internal directories.
Click to hide internal directories.