Documentation
¶
Overview ¶
Package websrv manages the default optional web service for the program with variable subservices.
Index ¶
- Constants
- Variables
- func Init(log cdtype.Logger)
- type Srv
- func (s *Srv) IsMonitored() bool
- func (s *Srv) Register(key string, call http.HandlerFunc, log cdtype.Logger) error
- func (s *Srv) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (s *Srv) SetMonitored(setActive bool)
- func (s *Srv) Start(key string) error
- func (s *Srv) Stop(key string) error
- func (s *Srv) URL() string
- func (s *Srv) Unregister(key string) error
Constants ¶
View Source
const ( // PathPprof is the registered url for the monitoring pprof service. PathPprof = "debug/pprof" // PathCharts is the registered url for the monitoring charts service. PathCharts = "debug/charts" )
Variables ¶
View Source
var ( // DefaultHost is the default hostname used for the web service. DefaultHost = "localhost" // DefaultPort is the default port used for the web service. DefaultPort = 15610 // Service manages the default web service for the program. Service *Srv )
Functions ¶
Types ¶
type Srv ¶
type Srv struct { Host string // Where to Port int // Listen. // contains filtered or unexported fields }
Srv defines a web service handling subservices.
func NewSrv ¶
NewSrv creates a new web service managing multiple You better use the already created Service var.
func (*Srv) IsMonitored ¶
IsMonitored returns whether monitoring pages are active or not.
func (*Srv) ServeHTTP ¶
func (s *Srv) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP forwards the web call to the services matching the url prefix.
func (*Srv) SetMonitored ¶
SetMonitored sets if monitoring pages are active or not.
func (*Srv) Unregister ¶
Unregister unregisters the service matching the given prefix key.
Click to show internal directories.
Click to hide internal directories.