server

package
v0.0.0-...-2523971 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultServer = New()

DefaultServer is the default server used by most top-level functions of this package

Functions

func AddFlags

func AddFlags(fs *pflag.FlagSet)

AddFlags adds command line flags of the default server to fs

func Directive

func Directive() service.Directive

Directive returns a service.Directive that configures the default server

func Serve

func Serve(h http.Handler) error

Serve starts serving h on the default server

Types

type Server

type Server struct {
	// Addr is the address to listen on
	Addr string

	// TLSKeyPath may hold the path to the PEM encoded private key
	TLSKeyPath string

	// TLSCertPath may hold the path to the PEM encoded certificate
	TLSCertPath string

	// Server is the underlying HTTP server that should be used
	Server *http.Server
}

Server wraps a http.Server and provides easy configuration by config directives and flags

func New

func New() *Server

New creates a new server

func (*Server) AddFlags

func (s *Server) AddFlags(f *pflag.FlagSet)

AddFlags adds common flags to the flagset

func (*Server) Directive

func (s *Server) Directive() service.Directive

Directive returns a service.Directive that can be used to configure the HTTP server

func (*Server) Serve

func (s *Server) Serve(h http.Handler) error

Serve starts serving h

Jump to

Keyboard shortcuts

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