server

package
v1.7.1-0...-23dd39d Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder is a new builder for Servers.

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new builder object for servers.

func (*Builder) Build

func (b *Builder) Build() *Server

Build builds a Server object.

func (*Builder) WithBindAddress

func (b *Builder) WithBindAddress(bindAddress string) *Builder

WithBindAddress sets the bind address.

func (*Builder) WithHandler

func (b *Builder) WithHandler(pattern string, handler http.Handler) *Builder

WithHandler adds a specific handler.

func (*Builder) WithHandlerFunc

func (b *Builder) WithHandlerFunc(pattern string, handlerFunc http.HandlerFunc) *Builder

WithHandlerFunc adds a specific handlerFunc.

func (*Builder) WithHandlerFuncs

func (b *Builder) WithHandlerFuncs(handlerFuncs map[string]http.HandlerFunc) *Builder

WithHandlerFuncs sets the handlerFuncs list.

func (*Builder) WithHandlers

func (b *Builder) WithHandlers(handlers map[string]http.Handler) *Builder

WithHandlers sets the handlers list.

func (*Builder) WithPort

func (b *Builder) WithPort(port int) *Builder

WithPort sets the port.

func (*Builder) WithTLS

func (b *Builder) WithTLS(certPath, keyPath string) *Builder

WithTLS sets the paths for the TLS certificate and key. If they are set then a HTTPS server will be built.

type Server

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

Server is a HTTP(S) server.

func (*Server) Start

func (s *Server) Start(ctx context.Context)

Start starts the server. If the TLS cert and key paths are provided then it will start it as HTTPS server.

Jump to

Keyboard shortcuts

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