Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
Token string
// Addr is the address to listen on. Defaults to defaultAddr.
Addr string
// contains filtered or unexported fields
}
API is the http server responsible for serving the HTTP API endpoints
func (*API) RegisterFunc ¶
func (api *API) RegisterFunc(path string, fn http.HandlerFunc)
RegisterFunc is a wrapper around http.HandleFunc that also sets the flag used to determine whether to launch the API
func (*API) RegisterHandler ¶
RegisterHandler is a wrapper around http.Handler that also sets the flag used to determine whether to launch the API
func (*API) RequireToken ¶
func (api *API) RequireToken(fn http.HandlerFunc) http.HandlerFunc
RequireToken is wrapper around http.HandlerFunc that checks token validity
func (*API) Shutdown ¶ added in v1.0.0
Shutdown stops accepting requests and waits for in-flight ones to finish.
Without this the process could exit while an API-triggered scan was still running, or start one after the daemon had already waited for the last scan to finish -- killing an update partway, which is the same shape of loss as an interrupted stop-and-recreate.