Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultSentinelConfig is the default Sentinel middleware config. DefaultSentinelConfig = SentinelConfig{ Skipper: middleware.DefaultSkipper, AllowOrigins: []string{"*"}, AllowsAllOrigin: true, } )
Functions ¶
func Sentinel ¶
func Sentinel() echo.MiddlewareFunc
Sentinel returns a Cross-Origin Resource Sharing (Sentinel) middleware. See: https://developer.mozilla.org/en/docs/Web/HTTP/Access_control_Sentinel
func SentinelWithConfig ¶
func SentinelWithConfig(config SentinelConfig) echo.MiddlewareFunc
SentinelWithConfig returns a Sentinel middleware with config. See: `Sentinel()`.
Types ¶
type SentinelConfig ¶
type SentinelConfig struct { // Skipper defines a function to skip middleware. Skipper middleware.Skipper // AllowOrigin defines a list of origins that may access the resource. // Optional. Default value []string{"*"}. AllowOrigins []string `json:"allow_origins"` // AllowsAllOrigin defines all origin should be accept or not // Optional. Default false, but if AllowOrigins contains "*", automatically turn this true. AllowsAllOrigin bool `json:"allows_all_origin"` AllowsStrictOrigins []string `json:"-"` AllowsStrictMatchers []*regexp.Regexp `json:"-"` }
SentinelConfig defines the config for Sentinel middleware.
Click to show internal directories.
Click to hide internal directories.