Documentation ¶
Index ¶
- Constants
- type Option
- func WithGracePeriod(t time.Duration) Option
- func WithListen(s string) Option
- func WithMetricReadEndpoint(u *url.URL) Option
- func WithMetricUIEndpoint(u *url.URL) Option
- func WithMetricWriteEndpoint(u *url.URL) Option
- func WithProfile(p bool) Option
- func WithProxyOptions(opts ...proxy.Option) Option
- func WithReadTimeout(t time.Duration) Option
- func WithRequestTimeout(t time.Duration) Option
- func WithTLSConfig(c *tls.Config) Option
- func WithWriteTimeout(t time.Duration) Option
- type Server
Constants ¶
const DefaultGracePeriod = 5 * time.Second
DefaultGracePeriod is the default value of the duration gracefully shuts down the server without interrupting any active connections.
const DefaultReadTimeout = 2 * time.Minute
DefaultReadTimeout is the default value of the maximum duration for reading the entire request, including the body.
const DefaultRequestTimeout = 2 * time.Minute
DefaultRequestTimeout is the default value of the timeout duration per request.
const DefaultWriteTimeout = 2 * time.Minute
DefaultWriteTimeout is the default value of the maximum duration before timing out writes of the response.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option overrides behavior of Server.
func WithGracePeriod ¶
WithGracePeriod sets graceful shutdown period for the server.
func WithListen ¶
WithListen sets the port to listen for the server.
func WithMetricReadEndpoint ¶
WithMetricReadEndpoint sets the URL to proxy metrics read request to.
func WithMetricWriteEndpoint ¶
WithMetricWriteEndpoint sets the URL to proxy metrics write request to.
func WithProfile ¶
WithProfile sets the option to enable/disable profiler endpoint.
func WithProxyOptions ¶
WithProxyOptions sets the proxy options fot the underlying reverse proxy.
func WithReadTimeout ¶
WithReadTimeout sets the read timeout duration for the underlying HTTP server.
func WithRequestTimeout ¶
WithRequestTimeout sets the timeout duration for an individual request.
func WithWriteTimeout ¶
WithWriteTimeout sets the write timeout duration for the underlying HTTP server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server defines parameters for running an HTTP server.
func (*Server) ListenAndServe ¶
ListenAndServe listens on the TCP network address and handles connections with given server configuration.