httpserver

package module
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

httpserver

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallHealthGorillaMux

func InstallHealthGorillaMux(router *mux.Router)

func InstallMetricsGorillaMux

func InstallMetricsGorillaMux(router *mux.Router)

func InstallMetricsRoutes

func InstallMetricsRoutes(router *http.ServeMux) error

func ListenAndServe

func ListenAndServe(config *ServerConfig, handler http.Handler)

Types

type HealthTracker

type HealthTracker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func GetHealthTracker

func GetHealthTracker() (*HealthTracker, error)

func InstallHealthRoutes

func InstallHealthRoutes(router *http.ServeMux) (*HealthTracker, error)

func (*HealthTracker) GetAlive

func (h *HealthTracker) GetAlive() bool

func (*HealthTracker) GetReady

func (h *HealthTracker) GetReady() bool

func (*HealthTracker) HandleHealthy

func (h *HealthTracker) HandleHealthy(w http.ResponseWriter, r *http.Request)

func (*HealthTracker) HandleLiveness

func (h *HealthTracker) HandleLiveness(w http.ResponseWriter, r *http.Request)

func (*HealthTracker) HandleReadiness

func (h *HealthTracker) HandleReadiness(w http.ResponseWriter, r *http.Request)

func (*HealthTracker) IsInit

func (h *HealthTracker) IsInit() bool

func (*HealthTracker) LogStatusMsg

func (h *HealthTracker) LogStatusMsg(msg string)

func (*HealthTracker) SetAlive

func (h *HealthTracker) SetAlive(alive bool) error

func (*HealthTracker) SetReady

func (h *HealthTracker) SetReady(ready bool) error

type ServerConfig

type ServerConfig struct {
	// Host is the local machine IP Address to bind the HTTP Server to
	Host string `yaml:"host"`

	// Port is the local machine TCP Port to bind the HTTP Server to
	Port    string        `yaml:"port"`
	Timeout TimeoutConfig `yaml:"timeout"`
}

func NewServerConfigDefault

func NewServerConfigDefault() ServerConfig

func RegisterFlagsConfig

func RegisterFlagsConfig(prefix string) *ServerConfig

type TimeoutConfig

type TimeoutConfig struct {
	// Readiness drain timeout
	Drain time.Duration `yaml:"drain"`

	// Server is the general server timeout to use
	// for graceful shutdowns
	Server time.Duration `yaml:"server"`

	// Write is the amount of time to wait until an HTTP server
	// write opperation is cancelled
	Write time.Duration `yaml:"write"`

	// Read is the amount of time to wait until an HTTP server
	// read operation is cancelled
	Read time.Duration `yaml:"read"`

	// Read is the amount of time to wait
	// until an IDLE HTTP session is closed
	Idle time.Duration `yaml:"idle"`
}

func NewTimeoutConfigDefault

func NewTimeoutConfigDefault() TimeoutConfig

Source Files

  • config.go
  • health.go
  • logging.go
  • metrics.go
  • server.go

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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