server

package
v0.0.0-...-3a0f996 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ContentTypePlainText holds HTTP Content-Type text/plain
	ContentTypePlainText = "text/plain; charset=utf-8"
)

Functions

func Run

func Run(ctx context.Context, conf Config) error

Run sets up and starts a TLS server that can be cancelled usting the given configuration.

Types

type Config

type Config struct {
	Addr      string
	TLSConfig *tls.Config
	Logger    *zap.Logger
}

Config configures the server

type Server

type Server struct {
	*http.Server
	// contains filtered or unexported fields
}

Server holds the http.Server instance

func New

func New(ctx context.Context, conf Config) *Server

New creates a new instance of Server

func (*Server) GracefulShutdown

func (s *Server) GracefulShutdown()

GracefulShutdown waits for os.Interrupt to gracefully shutdown the webserver there is a timeout of 30 seconds before the shutdown is forced.

func (*Server) Run

func (s *Server) Run() error

Run sets up and starts a TLS server that can be cancelled usting the given configuration.

Jump to

Keyboard shortcuts

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