http

package
v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeFile

func ServeFile(filePath string) (address string, stop func(), err error)

ServeFile constructs a SingleFileServer on a random port, returning that server.

Types

type ContextServer

type ContextServer struct {
	// contains filtered or unexported fields
}

ContextServer is a Server controlled by a context for stopping gracefully

func NewContextServer

func NewContextServer(ctx context.Context, handler http.Handler) *ContextServer

NewContextServer constructs and returns a server. Mux has the same meaning as in the standard HTTP package (that is, if nil it will use the globally registered handlers)

func (*ContextServer) ListenAndServe

func (s *ContextServer) ListenAndServe(addr string) error

ListenAndServe does the same thing as the net/http equivalent, except using the context.

func (*ContextServer) ListenAndServeTLS

func (s *ContextServer) ListenAndServeTLS(addr, certFile, keyFile string) error

ListenAndServeTLS does the same thing as the net/http equivalent, except using the context.

Jump to

Keyboard shortcuts

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