Documentation
¶
Index ¶
Constants ¶
View Source
const PluginName = "static"
ID contains default service name.
View Source
const RootPluginName = "http"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Static struct {
// Dir contains name of directory to control access to.
Dir string
// Forbid specifies list of file extensions which are forbidden for access.
// Example: .php, .exe, .bat, .htaccess and etc.
Forbid []string
// Always specifies list of extensions which must always be served by static
// service, even if file not found.
Always []string
// Request headers to add to every static.
Request map[string]string
// Response headers to add to every static.
Response map[string]string
}
}
Config describes file location and controls access to them.
func (*Config) AlwaysForbid ¶
AlwaysForbid must return true if file extension is not allowed for the upload.
func (*Config) AlwaysServe ¶
AlwaysServe must indicate that file is expected to be served by static service.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin serves static files. Potentially convert into middleware?
func (*Plugin) Init ¶
Init must return configure service and return true if service hasStatus enabled. Must return error in case of misconfiguration. Services must not be used without proper configuration pushed first.
func (*Plugin) Middleware ¶
func (s *Plugin) Middleware(next http.Handler) http.HandlerFunc
middleware must return true if request/response pair is handled within the middleware.
Click to show internal directories.
Click to hide internal directories.