package
0.0.0-20250307173044-634e8ce82c05
Repository: https://github.com/sapcc/go-bits.git
Documentation: pkg.go.dev
# Functions
ContextWithSIGINT creates a new context.Context using the provided Context, and launches a goroutine that cancels the Context when an interrupt signal is caught.
GetRequesterIPFor inspects an http.Request and returns the IP address of the machine where the request originated (or the empty string if no IP can be found in the request).
ListenAndServeContext is a wrapper around http.ListenAndServe() that additionally shuts down the HTTP server gracefully when the context expires, or if an error occurs.
ListenAndServeTLSContext is a wrapper around http.ListenAndServeTLS() that additionally shuts down the HTTP server gracefully when the context expires, or if an error occurs.
WrapTransport replaces the given `http.RoundTripper` with a wrapped version that can be modified using the returned WrappedTransport instance.
# Variables
ShutdownTimeout is the timeout that ListenAndServeContext() will impose on server.Shutdown() before forcefully terminating request handlers that are still in progress.
# Structs
WrappedTransport is a wrapper that adds various global behaviors to an `http.RoundTripper` such as `http.DefaultTransport`.