Documentation ¶
Index ¶
- type Option
- func WithContextFiller(contextFillers ...fillcontext.Filler) Option
- func WithCookieKeys(hashKey, blockKey []byte) Option
- func WithDisableWarnings(disable bool) Option
- func WithLogIgnorePaths(paths []string) Option
- func WithRedirectToHTTPS(from, to int) Option
- func WithRedirectToHost(target string) Option
- func WithStatic(mount string, searchPaths ...string) Option
- func WithTrustedProxies(cidrs ...string) Option
- type Registerer
- type Server
- func (s *Server) APIRouter() *mux.Router
- func (s *Server) Prefix(prefix string) *mux.Route
- func (s *Server) PrefixWithRedirect(prefix string) *mux.Route
- func (s *Server) RootRouter() *mux.Router
- func (s *Server) Router() *mux.Router
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) Static(prefix string, fs http.FileSystem)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options)
Option for the web server
func WithContextFiller ¶
func WithContextFiller(contextFillers ...fillcontext.Filler) Option
WithContextFiller sets context fillers that are executed on every request context.
func WithCookieKeys ¶
WithCookieKeys sets the cookie hash key and block key.
func WithDisableWarnings ¶ added in v3.16.1
WithDisableWarnings configures if the webserver should emit misconfiguration warnings.
func WithLogIgnorePaths ¶ added in v3.8.4
WithLogIgnorePaths silences log messages for a list of URLs.
func WithRedirectToHTTPS ¶
WithRedirectToHTTPS redirects HTTP requests to HTTPS.
func WithRedirectToHost ¶
WithRedirectToHost redirects all requests to this host.
func WithStatic ¶
WithStatic sets the mount and search paths for static assets.
func WithTrustedProxies ¶
WithTrustedProxies adds trusted proxies from which proxy headers are trusted.
type Registerer ¶
type Registerer interface {
RegisterRoutes(s *Server)
}
Registerer allows components to register their services to the web server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the server.
func (*Server) PrefixWithRedirect ¶ added in v3.16.2
PrefixWithRedirect will create a route ending in slash. Paths which coincide with the route, but do not end with slash, will be redirect to the slash ending route.
func (*Server) RootRouter ¶
RootRouter returns the root router. In most cases the Router() should be used instead of the root router.