server

package
v0.0.0-...-1193fc5 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package server provides an implementation of interfaces servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr              string
	ReadTimeout       time.Duration
	ReadHeaderTimeout time.Duration
	WriteTimeout      time.Duration
	IdleTimeout       time.Duration
	StopTimeout       time.Duration
	MaxHeaderBytes    int
	ErrorsOutput      io.Writer
	Router            http.Handler
	KeepAliveEnabled  bool
}

Config delivers a set of settings for server implementation.

func (Config) Validate

func (c Config) Validate() error

Validate validates Config according to predefined rules.

type Server

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

Server predetermines the consistency of the implementation servers.Launcher. Using the methods of the structure, without being initialized by the New() constructor, will lead to panic.

func New

func New(cfg Config) (*Server, error)

New - constructor Server.

func (*Server) Serve

func (s *Server) Serve() error

Serve serving the server.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the server.

Jump to

Keyboard shortcuts

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