Documentation ¶
Overview ¶
Package http provides HTTP client and server implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶ added in v0.7.0
type Options struct { // TCP address to listen on. If a file path is given, the server will use a // Unix Domain Socket. Addr string // Cert and Key are required for enabling TLS. Cert, Key string // Requests handler. Just as http.Server, if nil is given, // http.DefaultServeMux will be used. Handler http.Handler ShutdownCtx func() context.Context }
Options wraps all the customizable options for a Server.
type Server ¶
type Server struct { http.Server // TLS certificates. Cert, Key string // Shutdown context used for gracefully shutdown, it is implemented as a // function since deadlines will start at server creation and not at shutdown. ShutdownCtx func() context.Context // contains filtered or unexported fields }
Server is a http.Server with some extra functionalities.
func (*Server) ListenAndServe ¶
ListenAndServe listens for HTTP requests. If s.Addr is a filepath, the server will listen in a Unix Domain Socket; if s.Cert and s.Key are not empty, the server will listen over a TLS listener; otherwise the server will listen on a regular TCP listener.
By default, the server will gracefully shutdown when the program receives a SIGINT signal.
Directories ¶
Path | Synopsis |
---|---|
Package middleware provides flexibility at the HTTP request/response process.
|
Package middleware provides flexibility at the HTTP request/response process. |
Click to show internal directories.
Click to hide internal directories.