Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrHandlerIsNotSet = errors.New("HTTP handler cannot be left unset") ErrLoggerIsNotSet = errors.New("logger cannot be left unset") ErrReadHeaderTimeoutTooSmall = errors.New("read header timeout is too small") ErrReadTimeoutTooSmall = errors.New("read timeout is too small") ErrShutdownTimeoutTooSmall = errors.New("shutdown timeout is too small") )
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an HTTP server implementation, which uses the HTTP handler provided.
func New ¶
New creates a new HTTP server with the given settings. It returns an error if one of the settings is not valid.
func (*Server) GetAddress ¶
GetAddress obtains the address the HTTP server is listening on.
type Settings ¶
type Settings struct { // Address is the server listening address. // It defaults to :8000. Address string // Handler is the HTTP Handler to use. // It must be set and cannot be left to nil. Handler http.Handler // Logger is the logger to use. // It must be set and cannot be left to nil. Logger Logger // ReadHeaderTimeout is the HTTP header read timeout duration // of the HTTP server. It defaults to 3 seconds if left unset. ReadHeaderTimeout time.Duration // ReadTimeout is the HTTP read timeout duration // of the HTTP server. It defaults to 3 seconds if left unset. ReadTimeout time.Duration // ShutdownTimeout is the shutdown timeout duration // of the HTTP server. It defaults to 3 seconds if left unset. ShutdownTimeout time.Duration }
func (*Settings) OverrideWith ¶
func (*Settings) SetDefaults ¶
func (s *Settings) SetDefaults()
func (Settings) ToLinesNode ¶
Click to show internal directories.
Click to hide internal directories.