Documentation ¶
Overview ¶
Package miyabi provides graceful version of net/http compatible HTTP server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ShutdownSignal is the signal for graceful shutdown. // syscall.SIGTERM by default. Please set another signal if you want. ShutdownSignal = syscall.SIGTERM // RestartSignal is the signal for graceful restart. // syscall.SIGHUP by default. Please set another signal if you want. RestartSignal = syscall.SIGHUP // Timeout specifies the timeout for terminate of the old process. // A zero value disables the timeout. Timeout = 3 * time.Minute // ServerState specifies the optional callback function that is called // when the server changes state. See the State type and associated // constants for details. ServerState func(state State) // FDEnvKey is the environment variable name of inherited file descriptor for graceful restart. FDEnvKey = "MIYABI_FD" )
Functions ¶
func ListenAndServe ¶
ListenAndServe acts like http.ListenAndServe but can be graceful shutdown and restart. If addr begin with "unix:", will listen on a Unix domain socket instead of TCP.
Types ¶
type Server ¶
Server is similar to http.Server. However, ListenAndServe, ListenAndServeTLS and Serve can be graceful shutdown and restart.
func (*Server) ListenAndServe ¶
ListenAndServe acts like http.Server.ListenAndServe but can be graceful shutdown and restart. If srv.Addr begin with "unix:", will listen on a Unix domain socket instead of TCP.
func (*Server) ListenAndServeTLS ¶
ListenAndServeTLS acts like http.Server.ListenAndServeTLS but can be graceful shutdown and restart.
func (*Server) Serve ¶
Serve acts like http.Server.Serve but can be graceful shutdown. If you want to graceful restart, use ListenAndServe or ListenAndServeTLS instead.
func (*Server) SetKeepAlivesEnabled ¶
SetKeepAlivesEnabled is same as http.Server.SetKeepAlivesEnabled.