chore(lint): upgrade golangci-lint to v1.47.2

- Fix Slowloris attacks on HTTP servers
- Force set default of 5 minutes for pprof read timeout
- Change `ShutdownTimeout` to time.Duration since it cannot be set to 0
This commit is contained in:
Quentin McGaw
2022-07-28 21:55:10 +00:00
parent 877617cc53
commit a6f00f2fb2
24 changed files with 348 additions and 158 deletions

View File

@@ -9,11 +9,13 @@ import (
// Server is an HTTP server implementation, which uses
// the HTTP handler provided.
type Server struct {
address string
addressSet chan struct{}
handler http.Handler
logger Logger
shutdownTimeout time.Duration
address string
addressSet chan struct{}
handler http.Handler
logger Logger
readHeaderTimeout time.Duration
readTimeout time.Duration
shutdownTimeout time.Duration
}
// New creates a new HTTP server with the given settings.
@@ -26,10 +28,12 @@ func New(settings Settings) (s *Server, err error) {
}
return &Server{
address: settings.Address,
addressSet: make(chan struct{}),
handler: settings.Handler,
logger: settings.Logger,
shutdownTimeout: *settings.ShutdownTimeout,
address: settings.Address,
addressSet: make(chan struct{}),
handler: settings.Handler,
logger: settings.Logger,
readHeaderTimeout: settings.ReadHeaderTimeout,
readTimeout: settings.ReadTimeout,
shutdownTimeout: settings.ShutdownTimeout,
}, nil
}