Documentation
¶
Index ¶
- func BasicSecurityHeaderMiddleware() mux.MiddlewareFunc
- func CacheControlMiddleware(globPatterns []string, directive *CacheControlDirective) mux.MiddlewareFunc
- type CacheControlDirective
- func (c *CacheControlDirective) Immutable() *CacheControlDirective
- func (c *CacheControlDirective) MaxAge(t time.Duration) *CacheControlDirective
- func (c *CacheControlDirective) MaxStale(t time.Duration) *CacheControlDirective
- func (c *CacheControlDirective) MinFresh(t time.Duration) *CacheControlDirective
- func (c *CacheControlDirective) MustRevalidate() *CacheControlDirective
- func (c *CacheControlDirective) NoCache() *CacheControlDirective
- func (c *CacheControlDirective) NoStore() *CacheControlDirective
- func (c *CacheControlDirective) NoTransform() *CacheControlDirective
- func (c *CacheControlDirective) OnlyIfCached() *CacheControlDirective
- func (c *CacheControlDirective) Private() *CacheControlDirective
- func (c *CacheControlDirective) ProxyRevalidate() *CacheControlDirective
- func (c *CacheControlDirective) Public() *CacheControlDirective
- func (c *CacheControlDirective) SharedMaxAge(t time.Duration) *CacheControlDirective
- func (c *CacheControlDirective) String() string
- type CacheControlRulePair
- type Middleware
- type MiddlewareManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicSecurityHeaderMiddleware ¶
func BasicSecurityHeaderMiddleware() mux.MiddlewareFunc
func CacheControlMiddleware ¶
func CacheControlMiddleware(globPatterns []string, directive *CacheControlDirective) mux.MiddlewareFunc
CacheControlMiddleware is the middleware function to be provided as a parameter to mux.Handler()
Types ¶
type CacheControlDirective ¶
type CacheControlDirective struct {
// contains filtered or unexported fields
}
CacheControlDirective is a data structure that represents the entry for Cache-Control rules
func NewCacheControlDirective ¶
func NewCacheControlDirective() *CacheControlDirective
NewCacheControlDirective returns creates a new instance of CacheControlDirective and returns its pointer
func (*CacheControlDirective) Immutable ¶
func (c *CacheControlDirective) Immutable() *CacheControlDirective
func (*CacheControlDirective) MaxAge ¶
func (c *CacheControlDirective) MaxAge(t time.Duration) *CacheControlDirective
func (*CacheControlDirective) MaxStale ¶
func (c *CacheControlDirective) MaxStale(t time.Duration) *CacheControlDirective
func (*CacheControlDirective) MinFresh ¶
func (c *CacheControlDirective) MinFresh(t time.Duration) *CacheControlDirective
func (*CacheControlDirective) MustRevalidate ¶
func (c *CacheControlDirective) MustRevalidate() *CacheControlDirective
func (*CacheControlDirective) NoCache ¶
func (c *CacheControlDirective) NoCache() *CacheControlDirective
func (*CacheControlDirective) NoStore ¶
func (c *CacheControlDirective) NoStore() *CacheControlDirective
func (*CacheControlDirective) NoTransform ¶
func (c *CacheControlDirective) NoTransform() *CacheControlDirective
func (*CacheControlDirective) OnlyIfCached ¶
func (c *CacheControlDirective) OnlyIfCached() *CacheControlDirective
func (*CacheControlDirective) Private ¶
func (c *CacheControlDirective) Private() *CacheControlDirective
func (*CacheControlDirective) ProxyRevalidate ¶
func (c *CacheControlDirective) ProxyRevalidate() *CacheControlDirective
func (*CacheControlDirective) Public ¶
func (c *CacheControlDirective) Public() *CacheControlDirective
func (*CacheControlDirective) SharedMaxAge ¶
func (c *CacheControlDirective) SharedMaxAge(t time.Duration) *CacheControlDirective
func (*CacheControlDirective) String ¶
func (c *CacheControlDirective) String() string
type CacheControlRulePair ¶
type CacheControlRulePair struct { GlobPattern string CacheControlRule string CompiledGlobPattern glob.Glob }
CacheControlRulePair is a container that lumps together the glob pattern, cache control rule that should be applied to for the matching pattern and the compiled glob pattern for use in runtime. see https://github.com/gobwas/glob for detailed examples of glob patterns.
func NewCacheControlRulePair ¶
func NewCacheControlRulePair(globPattern string, cacheControlRule string) (CacheControlRulePair, error)
NewCacheControlRulePair returns a new CacheControlRulePair with the provided text glob pattern and its compiled counterpart and the cache control rule.
type Middleware ¶
type Middleware interface { //Intercept(h http.Handler) http.Handler Interceptor() mux.MiddlewareFunc Name() string }
type MiddlewareManager ¶
type MiddlewareManager interface { SetGlobalMiddleware(middleware []mux.MiddlewareFunc) error SetNewMiddleware(route *mux.Route, middleware []mux.MiddlewareFunc) error RemoveMiddleware(route *mux.Route) error GetRouteByUriAndMethod(uri, method string) (*mux.Route, error) GetRouteByUri(uri string) (*mux.Route, error) GetStaticRoute(prefix string) (*mux.Route, error) }
func NewMiddlewareManager ¶
func NewMiddlewareManager(endpointHandlerMapPtr *map[string]http.HandlerFunc, router *mux.Router, logger *slog.Logger) MiddlewareManager
NewMiddlewareManager sets up a new middleware manager singleton instance