exthttp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpServer

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

func NewHttpServer

func NewHttpServer(handler http.Handler, logger *log.Logger, opts ...OptionFunc) *HttpServer

func (*HttpServer) Run

func (hs *HttpServer) Run(g *run.Group, statusProber prober.Probe)

func (*HttpServer) Shutdown

func (hs *HttpServer) Shutdown(err error)

func (*HttpServer) Start

func (hs *HttpServer) Start() error

type MuxServer

type MuxServer struct {
	*HttpServer
	// contains filtered or unexported fields
}

MuxServer 简单的 http mux server 一般用来挂载 prometheus 和 pprof.

func NewMuxServer

func NewMuxServer(logger *log.Logger, opts ...OptionFunc) *MuxServer

func (*MuxServer) Handle

func (ms *MuxServer) Handle(pattern string, handler http.Handler)

func (*MuxServer) HandleFunc

func (ms *MuxServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*MuxServer) RegisterLogControl

func (ms *MuxServer) RegisterLogControl(handler http.Handler)

func (*MuxServer) RegisterMetrics

func (ms *MuxServer) RegisterMetrics(g prometheus.Gatherer)

func (*MuxServer) RegisterProber

func (ms *MuxServer) RegisterProber(p *prober.HTTPProbe)

func (*MuxServer) RegisterProfiler

func (ms *MuxServer) RegisterProfiler()

func (*MuxServer) RunGroup

func (ms *MuxServer) RunGroup(g *run.Group)

type Option

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

type OptionFunc

type OptionFunc func(option *Option)

func WithGracePeriod

func WithGracePeriod(gracePeriod time.Duration) OptionFunc

func WithListen

func WithListen(listen string) OptionFunc

func WithServiceName

func WithServiceName(name string) OptionFunc

Jump to

Keyboard shortcuts

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