v0.0.0-...-1a11905 Latest Latest

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 8 Imported by: 0




View Source
const ServerShutdownTimeout = 60 * time.Second

ServerShutdownTimeout is the default time to wait before closing connections on shutdown.


This section is empty.


This section is empty.


type Server

type Server struct {
	// contains filtered or unexported fields

Server is a incomplete component that implements a basic HTTP/HTTPS server.

func New

func New(addr string, handler http.Handler, tlsConfig *tls.Config) *Server

New creates a new HTTP/HTTPS server configured with the passed address, http.Handler and tls.Config.

func (*Server) Forbidden

func (srv *Server) Forbidden(w http.ResponseWriter)

Forbidden writes on the http.ResponseWriter a text/plain forbidden response.

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe() error

ListenAndServe listens on the TCP network address srv.Addr and then calls Serve to handle requests on incoming connections.

func (*Server) Reload

func (srv *Server) Reload(ns *Server) error

Reload reloads the current server with the configuration of the passed server.

func (*Server) Serve

func (srv *Server) Serve(ln net.Listener) error

Serve runs Serve or ServeTLS on the underlying http.Server and listen to channels to reload or shutdown the server.

func (*Server) Shutdown

func (srv *Server) Shutdown() error

Shutdown gracefully shuts down the server without interrupting any active connections.

Jump to

Keyboard shortcuts

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