Documentation ¶
Overview ¶
Package server implements a configurable, general-purpose web server. It relies on configurations obtained from the adjacent config package and can execute middleware as defined by the adjacent middleware package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileServer ¶
func FileServer(root http.FileSystem, hide []string) middleware.Handler
This FileServer is adapted from the one in net/http by the Go authors. Significant modifications have been made.
License:
Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
func ListenAndServeTLSWithSNI ¶
ListenAndServeTLSWithSNI serves TLS with Server Name Indication (SNI) support, which allows multiple sites (different hostnames) to be served from the same address. This method is adapted directly from the std lib's net/http ListenAndServeTLS function, which was written by the Go Authors. It has been modified to support multiple certificate/key pairs.
Types ¶
type Server ¶
type Server struct { HTTP2 bool // temporary while http2 is not in std lib (TODO: remove flag when part of std lib) // contains filtered or unexported fields }
Server represents an instance of a server, which serves static content at a particular address (host and port).
func New ¶
New creates a new Server which will bind to addr and serve the sites/hosts configured in configs. This function does not start serving.
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is the entry point for every request to the address that s is bound to. It acts as a multiplexer for the requests hostname as defined in the Host header so that the correct virtualhost (configuration and middleware stack) will handle the request.