Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// Address controls the address used by the HTTP server
Address string
// Port controls the address used by the HTTP server
Port int
// Handler will be passed to the HTTP server to handle HTTP calls
Handler http.Handler
// Closer will be used to handler errors in ressource closing in defer statement. By default, the error is discarded
Closer closer.CloseErrorHandler
}
Server is an object used to launch an HTTP server
func (Server) Listen ¶
func (s Server) Listen() *ServerControl
Listen launch the HTTP server in a separate goroutine and return an instance to control the server lifecycle.
type ServerControl ¶
type ServerControl struct {
// HTTP Server controlled by this instance
Server *http.Server
// Channel setup to listen for SIGINT
Interrupted chan os.Signal
// Error channel used by the running server if any error is detected during launch or while running
Errors chan error
// contains filtered or unexported fields
}
ServerControl is used to access informations and control a running http server
func (ServerControl) Shutdown ¶
func (c ServerControl) Shutdown(timeout time.Duration) error
Shutdown will shutdown the controlled server
func (*ServerControl) Status ¶
func (c *ServerControl) Status() Status
Status function load current server status
func (*ServerControl) Wait ¶
func (c *ServerControl) Wait() error
Wait will wait for the first server error, or a SIGINT signal. If a SIGINT is received, the control server will be shutdown
Click to show internal directories.
Click to hide internal directories.