httpserver

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultShutdownTimeout is the default ShutdownTimeout (see Config)
	DefaultShutdownTimeout = time.Second * 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Name is the name of the server. It is only used for logging. It can
	// be empty.
	Name string

	// Address is the address to bind the server to. It must be set.
	Address string

	// Handler is the HTTP handler to be served. It must be set.
	Handler http.Handler

	// TLSConfig is the TLS configuration for the server. It is optional.
	TLSConfig *tls.Config

	// ShutdownTimeout controls how long to wait for requests to finish before
	// returning from Run() after the context is canceled. It defaults to
	// 10 seconds if unset. If set to a negative value, the server will be
	// closed immediately.
	ShutdownTimeout time.Duration
}

Config holds the HTTP server configuration

type Server

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

Server is the HTTP server

func New

func New(log *zap.Logger, config Config) (*Server, error)

New creates a new URL Service Server.

func (*Server) Addr

func (server *Server) Addr() string

Addr returns the public address.

func (*Server) Run

func (server *Server) Run(ctx context.Context) (err error)

Run runs the server until it's either closed or it errors.

Jump to

Keyboard shortcuts

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