httpd

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWriteTimeout      = time.Second
	DefaultReadTimeout       = time.Second
	DefaultReadHeaderTimeout = time.Second
	DefaultIdleTimeout       = time.Second
)
View Source
const SvcTypeHttpd boot.SvcType = "httpd"

Variables

This section is empty.

Functions

func Handle

func Handle(pattern string, handler http.Handler)

func HandleAPI

func HandleAPI(pattern string, handler APIHandler)

func HandleFunc

func HandleFunc(pattern string, handler http.HandlerFunc)

Types

type APIHandler

type APIHandler func(http.ResponseWriter, *http.Request) []byte

func (APIHandler) Handle

func (ah APIHandler) Handle(w http.ResponseWriter, r *http.Request) []byte

func (APIHandler) ServeHTTP

func (ah APIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Cfg

type Cfg struct {
	Addr              string        `env:"HTTPD_ADDR"                validate:"required"      yaml:"addr"`
	WriteTimeout      time.Duration `env:"HTTPD_WRITE_TIMEOUT"       yaml:"writeTimeout"`
	ReadTimeout       time.Duration `env:"HTTPD_READ_TIMEOUT"        yaml:"readTimeout"`
	ReadHeaderTimeout time.Duration `env:"HTTPD_READ_HEADER_TIMEOUT" yaml:"readHeaderTimeout"`
	IdleTimeout       time.Duration `env:"HTTPD_IDLE_TIMEOUT"        yaml:"idleTimeout"`
}

func NewCfg

func NewCfg() *Cfg

type Httpd

type Httpd struct {
	runner.Runner
	plugin.Plugin
	*Cfg
	// contains filtered or unexported fields
}

func New

func New() *Httpd

func (*Httpd) AppendError

func (h *Httpd) AppendError(err ...error)

func (*Httpd) GetCfg

func (h *Httpd) GetCfg() interface{}

func (*Httpd) Start

func (h *Httpd) Start() error

func (*Httpd) Stop

func (h *Httpd) Stop() error

func (*Httpd) Type

func (h *Httpd) Type() interface{}

Jump to

Keyboard shortcuts

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