http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGracefulListener

func NewGracefulListener(ln net.Listener, maxWaitTime time.Duration) net.Listener

NewGracefulListener wraps the given listener into 'graceful shutdown' listener.

Types

type ConfigServer

type ConfigServer struct {
	ServiceName      string
	Address          string
	ReadTimeout      time.Duration
	WriteTimeout     time.Duration
	GracefullTimeout time.Duration
}

type GracefulListener

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

GracefulListener defines a listener that we can gracefully stop

func (*GracefulListener) Accept

func (ln *GracefulListener) Accept() (net.Conn, error)

Accept creates a conn

func (*GracefulListener) Addr

func (ln *GracefulListener) Addr() net.Addr

Addr returns the listen address

func (*GracefulListener) Close

func (ln *GracefulListener) Close() error

Close closes the inner listener and waits until all the pending open connections are closed before returning.

type Server

type Server interface {
	Run(ctx context.Context) error
}

func NewHttpServer

func NewHttpServer(configServer ConfigServer, router *router.Router) Server

Jump to

Keyboard shortcuts

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