server

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

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

func ListenAndServeTLSWithSNI(srv *http.Server, tlsConfigs []config.TLSConfig) error

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

func New(addr string, configs []config.Config, tls bool) (*Server, error)

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) Serve

func (s *Server) Serve() error

Serve starts the server. It blocks until the server quits.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL