http

package
Version: v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServer added in v0.6.0

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

func New

func New(config server.Config, opts ...Option) (*HTTPServer, error)

New creates an HTTP server with a default handler and has not started to accept requests yet.

func (*HTTPServer) Handle added in v0.6.0

func (s *HTTPServer) Handle(mux http.Handler)

Handle associates the given handler with the server.

func (*HTTPServer) Serve added in v0.6.0

func (s *HTTPServer) Serve(result chan<- error)

Serve accepts incoming connections, creating a new service goroutine for each. The service goroutine reads requests and then call the handler to reply to them.

func (*HTTPServer) Stop added in v0.6.0

func (s *HTTPServer) Stop()

Stop shuts down the http server gracefully without interrupting an active connections.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option provides options for configuring the creation of a http server.

func WithLogger

func WithLogger(l log.Logger) Option

WithLogger will add logging to the http server.

func WithTLS

func WithTLS(cfg *tls.Config) Option

WithTLS will configure the server to require TLS.

type Server

type Server interface {
	server.Server            // Implements Serve and Stop
	Handle(mux http.Handler) // Handle the given mux.
}

Server is an HTTP server to serve HTTP requests.

Directories

Path Synopsis
Package mockhttp is a generated GoMock package.
Package mockhttp is a generated GoMock package.

Jump to

Keyboard shortcuts

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