httputil

package
v2.5.2-rc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultServerConfig = serverConfig{
	ReadHeaderTimeout: 5 * time.Second,
	ReadTimeout:       30 * time.Second,
	WriteTimeout:      30 * time.Second,
	IdleTimeout:       120 * time.Second,
}

DefaultServerConfig is the default server config

Functions

func LimitListener

func LimitListener(addr string) (net.Listener, error)

LimitListener creates a tcp keep-alive listener with 400 maximum connections.

func NewServer

func NewServer(addr string, handler http.Handler, opts ...ServerOption) http.Server

NewServer creates a HTTP server with time out settings.

Types

type ServerOption

type ServerOption func(*serverConfig)

ServerOption is a server option

func ReadHeaderTimeout

func ReadHeaderTimeout(h time.Duration) ServerOption

ReadHeaderTimeout sets header timeout

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL