app

package
v0.0.0-...-19ef425 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 选择不常用的值方便调试
	InterruptExitCode = 13
	TimeoutExitCode   = 18
)

Variables

View Source
var (
	ErrAtLeastOneServer = errors.New("at least one server is required")
)

Functions

func New

func New(servers []Server, opts ...option) (*app, error)

func WithCallbackTimeout

func WithCallbackTimeout(timeout time.Duration) option

func WithShutdownCallbacks

func WithShutdownCallbacks(s ...ShutdownCallback) option

func WithShutdownTimeout

func WithShutdownTimeout(timeout time.Duration) option

func WithWaitTimeout

func WithWaitTimeout(timeout time.Duration) option

Types

type Server

type Server interface {
	Name() string
	Addr() string
	Handle(pattern string, handler http.Handler)
	Start() error
	Stop(ctx context.Context) error
}

type ShutdownCallback

type ShutdownCallback func(ctx context.Context)

Jump to

Keyboard shortcuts

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